/* Modern responsive design for abkuerzungen.de */

:root {
    --primary-color: #ffe066;
    --primary-light: #ffedac;
    --text-color: #333;
    --link-color: #990033;
    --background-color: #f5f5f5;
    --heading-font-size: 1.2rem; /* For headings only */
    --body-font-size: 15px; /* For all other text */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Tahoma, Arial, Helvetica, sans-serif;
    font-size: var(--body-font-size);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* Tap targets and form fixes */
    .search-input,
    .language-selector-button,
    .search-results a,
    input[type="text"],
    button,
    select {
        min-height: 44px;
    }
    
    input[type="text"],
    button,
    select {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 0;
    }
}

/* Header styles - more compact */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem; /* Reduced padding */
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 48px; /* Slightly shorter */
}

.logo {
    height: 32px; /* Reduced from 40px */
    width: auto;
    max-width: 100%;
    object-fit: contain;
    vertical-align: middle;
}

.logo-link {
    display: inline-block;
    transition: opacity 0.2s ease;
    margin-right: 1.5rem;
}

.logo-link:hover {
    opacity: 0.8;
}

/* Compact language selector popup */
.language-selector {
    position: relative;
    margin-left: auto; /* Push to right side */
}

.language-selector-button {
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: var(--body-font-size);
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.language-selector-button:hover {
    background: var(--primary-color);
    color: var(--text-color);
}

/* Remove focus outline since we handle focus manually */
.language-selector-button:focus {
    outline: none;
}

.language-selector-button::after {
    content: "▼";
    font-size: 0.8em;
    color: var(--text-color);
}

.language-selector-popup {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.2rem; /* Smaller gap */
    background: white;
    border: 1px solid var(--primary-light);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    min-width: 120px;
    z-index: 1000;
    display: none;
}

/* Popup is controlled by JavaScript - initially hidden */
.language-selector-popup {
    display: none;
}

/* Show popup when active */
.language-selector-popup.active {
    display: block;
}

.language-selector-popup a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: var(--body-font-size);
    transition: all 0.2s ease;
}

.language-selector-popup a:hover {
    background: var(--primary-light);
    color: var(--text-color);
}

.language-current {
    color: var(--text-color);
    font-weight: 600;
}

/* Main content - consistent layout with flex grow */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 0; /* Important for flex children */
}

/* Content container - consistent width for all content */
.content-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Search form styles - compact with icon button */
.search-form {
    width: 100%;
    display: flex;
    align-items: center;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.2rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease;
    background-color: white;
}

.search-form:focus-within {
    box-shadow: 0 0 0 2px rgba(246, 224, 94, 0.3);
}

.search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    padding: 0.4rem 0.6rem;
    font-size: var(--body-font-size);
    font-family: inherit;
    line-height: normal;
    background: transparent !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: none !important;
}

.search-button {
    padding: 0.4rem;
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 24px;
    background-image: url('../img/button_search.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.4;
}

.search-input:focus {
    box-shadow: 0 0 0 2px rgba(246, 224, 94, 0.3);
}

/* Search button with magnifying glass icon */
.search-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 24px;
    height: 24px;
    background-image: url('../img/button_search.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.4; /* Even lighter color */
}

.search-button:hover {
    opacity: 0.6; /* Hover effect */
}

/* Results container - consistent with other content */
.results-container {
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--primary-light);
    margin: 1rem auto 1rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.results-header h2 {
    font-size: var(--heading-font-size);
    margin: 0;
    font-weight: 600;
}

.back-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: var(--body-font-size);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-button:hover {
    text-decoration: underline;
}

/* Search results table - tighter spacing, better alignment */
.search-results {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px; /* Always maintain reasonable minimum width */
}

/* Table wrapper for horizontal scrolling */
.table-scroll-wrapper {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1rem;
}

.search-results th {
    text-align: left;
    padding: 0.5rem 0.5rem;
    font-weight: 600;
    background-color: var(--primary-light);
    vertical-align: top;
}

.search-results td {
    padding: 0.5rem 0.5rem;
    vertical-align: top;
}



.search-results tr:nth-child(odd) {
    background-color: var(--primary-light);
}

.search-results tr:nth-child(even) {
    background-color: var(--primary-color);
}

/* Feedback buttons - simple fade transition */
.feedback-container {
    margin-top: 1rem;
    background-color: var(--primary-light);
    border-radius: 8px;
    overflow: hidden;
    transition: 
        height 0.3s ease,
        margin 0.3s ease,
        opacity 0.2s ease;
    height: auto;
}

.feedback-layer.feedback-buttons-layer {
    padding: 0.8rem;
    transition: opacity 0.3s ease;
}

.feedback-layer.feedback-thankyou-layer {
    padding: 0.8rem;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none; /* Allow clicks to pass through */
    background-color: var(--primary-light); /* Match button area background color */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px; /* Match container border radius */
}

.feedback-container {
    margin-top: 1rem;
    background-color: var(--primary-light);
    border-radius: 8px;
    overflow: hidden;
    transition: 
        height 0.3s ease-in-out,
        margin 0.3s ease-in-out,
        opacity 0.2s ease-in-out;
    height: auto;
    position: relative; /* Positioning context for absolute children */
    z-index: 10; /* Ensure it stays above other content */
}

.feedback-layer.feedback-thankyou-layer .feedback-thankyou {
    font-size: var(--body-font-size);
    color: var(--text-color);
    text-align: center;
}

.feedback-text {
    margin-bottom: 0.8rem;
    font-size: var(--body-font-size);
    color: var(--text-color);
    text-align: center;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.feedback-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 16px;
    font-size: var(--body-font-size);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 100px;
}

.feedback-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.found-button {
    background-color: #4CAF50;
    color: white;
}

.found-button:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

.notfound-button {
    background-color: #f44336;
    color: white;
}

.notfound-button:hover {
    background-color: #d32f2f;
    transform: translateY(-1px);
}

/* Footer - with proper spacing */
footer {
    text-align: center;
    padding: 0.75rem 1rem; /* Reduced from 1rem */
    background-color: var(--primary-color);
    font-size: var(--body-font-size);
    margin-top: auto; /* Push footer to bottom */
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem; /* Reduced from 1.5rem */
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--link-color);
    text-decoration: underline;
}

/* Search results enhancements - tighter spacing */
.language {
    font-size: var(--body-font-size);
    color: #666;
    margin-left: 0.3rem;
}

.comment {
    display: block;
    padding-top: 0.2rem;
    font-style: italic;
    font-size: var(--body-font-size);
    color: #555;
    margin-top: 0.2rem;
}

/* Icon styling - larger, more visible SVG icons */
.icon-category, .icon-country {
    width: 20px;
    height: 20px;
    display: block;
    vertical-align: middle;
}

/* Category/country popups - aligned to left to avoid overflow issues */
.popupButton {
    position: relative;
    cursor: help;
    display: inline-block;
    width: 24px;
    height: 24px;
    padding: 2px;
}

/* Icon buttons using CSS pseudo-elements */
.popupButton.category-button::before,
.popupButton.country-button::before {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Debug: add border to see if element exists */
    /* border: 1px solid red; */
}

.popupButton.category-button::before {
    background-image: url('../img/button_category_info.svg');
}

.popupButton.country-button::before {
    background-image: url('../img/button_country_info.svg');
}

.popupButton:hover {
    opacity: 0.8;
}

.popupButton:active {
    opacity: 0.6;
}

.popup {
    position: absolute;
    z-index: 1000; /* High z-index to appear above scroll container */
    background-color: white;
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
    display: none;
    max-width: 300px;
    
    /* Position to the left of the button */
    right: 100%; /* Align right edge of popup with right edge of button */
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Adjust for centering */
    margin-right: 10px; /* Add some spacing */
}

.popup > ul {
    margin: 0px;
    padding-left: 20px;
}

.popupButton:hover > .popup {
    display: block;
}

/* Ensure scroll container doesn't clip popups */
.table-scroll-wrapper {
    position: relative;
}

/* Search results table - better column distribution */
.search-results th.shortForm {
    width: 120px; /* Reduced from 140px */
    min-width: 100px; /* More flexible minimum */
}

.search-results th.longForm {
    width: auto; /* Takes remaining space */
    min-width: 200px; /* Ensure reasonable width */
}

.search-results th.icon {
    width: 24px;
}



/* Ensure short form stays aligned */
.search-results td:first-child {
    vertical-align: top;
    font-size: var(--body-font-size);
}

@media (max-width: 768px) {
    header {
        padding: 0.75rem 1rem;
    }

    .language-selector-button {
        padding: 0.3rem 0.6rem;
        font-size: var(--body-font-size);
    }

    main {
        padding: 1rem;
    }

    .search-input {
        font-size: var(--body-font-size);
        padding: 0.8rem 1.5rem;
    }

    .results-container {
        padding: 1rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-results th,
    .search-results td {
        padding: 0.4rem 0.4rem;
    }

    .search-results th.shortForm {
        width: 100px;
        min-width: 80px;
    }

    .search-results th.longForm {
        min-width: 160px;
    }

    footer {
        font-size: var(--body-font-size);
    }
}

@media (max-width: 480px) {
    :root {
        --search-width: 95%;
    }

    .search-input {
        font-size: var(--body-font-size);
        padding: 0.7rem 1rem;
    }

    .search-results thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .results-header h2 {
        font-size: 1.2rem;
    }
}

/* Paragraph styling - proper spacing between paragraphs */
.para {
    margin-bottom: 1rem;
    text-align: left;
    width: 100%;
}

.para:last-child {
    margin-bottom: 0;
}

/* Content panel - consistent styling for all content areas */
.content-panel {
    width: 100%;
    margin: 1rem auto;
    padding: 1.5rem;
    background-color: var(--primary-light);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Centered content for imprint */
.content-panel.centered {
    text-align: center;
}

.content-panel h2, .content-panel p {
    margin-bottom: 1rem;
}

.content-panel a {
    color: var(--link-color);
    text-decoration: underline;
}

/* Main page content - keep on white background */
.main-content {
    width: 100%;
    margin: 1rem auto;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.strong {
    font-weight: 600;
}

.emphasis {
    font-style: italic;
}

/* Link styles - simple magenta links with always-visible underline */
a {
    color: var(--link-color);
    text-decoration: underline;
}

/* Button styles */
.button {
    background-color: var(--primary-light);
    border: 1px solid var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.button:hover {
    background-color: var(--primary-color);
}

/* Form elements */
input[type="text"],
textarea,
select {
    padding: 0.5rem;
    font-family: inherit;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(246, 224, 94, 0.2);
}