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

html, body {
    width: 100%;
    overflow-x: hidden;
    font-family: 'Oswald', sans-serif; /* Correct fallback font */
    font-weight: 300; /* Default to Light 300 */
    background-color: #f7f8f9;
}

.page-title {
    font-size: 3em; /* Adjust text size */
    font-weight: bold; /* Set to normal weight */
    color: #333; /* Adjust color to match the theme */
    margin: 20px 0; /* Add equal spacing above and below the title */
}

/* Hero Section */
.page-hero {
    background-image: url('/static/images/GIN_clean_row_3.jpg');
    background-size: auto 125px; /* Kontrolli korgust, laius automaatne */
    background-position: center;
    background-repeat: repeat-x; /* Korda ainult horisontaalselt */
    width: 100%;
    height: 125px; /* Tee pilt 2x luhemaks */
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Hero Content */
.hero-content h1 {
    font-size: 3.5em;
    color: white;
    text-shadow: 7px 7px 15px rgba(0, 0, 0, 0.9);
    margin: 0;
}

/* General Container */
.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0px;
    text-align: center;
}

/* Form Styling */
form {
    margin-top: 20px; /* Add spacing above the form */
    margin-bottom: 17px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

input[type="text"] {
    flex: 1 1 70%;
    padding: 10px;
    font-size: 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
}

button {
    flex: 1 1 25%;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    background-color: #178f5b;
    color: white;
    border: 2px solid #178f5b;
    border-radius: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

button:hover {
    background-color: white;
    color: #178f5b;
}

/* General Table Styling */
table {
    width: 100%; /* Ensure the table spans the container */
    border-collapse: collapse;
    table-layout: fixed; /* Fixed layout for consistent column widths */
    margin-top: 20px;
    text-align: left;
}

th, td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: middle;
    font-size: 17px;
    word-wrap: break-word;
}

td {
    font-weight: 300;
}

/* Table Header Styling */
thead tr {
    display: flex; /* Use flexbox for horizontal alignment */
    justify-content: space-between; /* Evenly distribute headers */
    align-items: center; /* Vertically center headers and buttons */
    gap: 15px; /* Add spacing between header-text and buttons */
    flex-wrap: nowrap; /* Prevent wrapping */
}

/* Header Styling */
th {
    display: flex; /* Align header text and button inline */
    align-items: center; /* Vertically align header text and button */
    justify-content: flex-start; /* Align text and button to the left */
    padding: 8px; /* Add consistent padding */
    white-space: nowrap; /* Prevent wrapping within header text/button */
    font-weight: bold; /* Bold header text */
    font-size: 17px; /* Adjust header font size */
    gap: 5px; /* Add spacing between header text and button */
    flex: 1; /* Distribute available space equally */
    min-width: 80px; /* Prevent headers from shrinking too much */
}

/* Sort Button Styling */
.sort-button {
    padding: 5px 8px; /* Adjust button padding */
    background: none; /* Remove default button background */
    border: none; /* Remove button border */
    color: #178f5b; /* Match button text color to theme */
    cursor: pointer; /* Pointer cursor for buttons */
    font-size: 12px; /* Adjust button font size */
    display: inline-block; /* Ensure inline button alignment */
    flex-shrink: 0; /* Prevent button from shrinking */
    text-align: center; /* Center-align button text/icon */
}

.sort-button i {
    transition: transform 0.3s ease;
    display: inline-block; /* Ensure icons don't stretch */
}

.sort-button[data-order="asc"] i {
    transform: rotate(0deg); /* Default upward arrow */
}

.sort-button[data-order="desc"] i {
    transform: rotate(180deg); /* Rotated downward arrow */
}

/* Proportional Column Sizing */
th:nth-child(1), td:nth-child(1) {
    width: 60%; /* Assign 60% width to the first column */
}
th:nth-child(2), td:nth-child(2),
th:nth-child(3), td:nth-child(3) {
    width: 20%; /* Assign 20% width to the second and third columns */
}

/* Responsive Styling */
@media (max-width: 1024px) {
    .page-hero {
        height: 125px;
    }

    .hero-content h1 {
        font-size: 2.8em;
    }

    input[type="text"] {
        flex: 1 1 80%;
    }

    button {
        flex: 1 1 15%;
    }
    
}

@media (max-width: 768px) {
    thead tr {
        flex-wrap: nowrap; /* Maintain horizontal alignment */
        gap: 10px; /* Reduce gap between headers */
    }

    th, td {
        font-size: 14px;
        padding: 6px;
    }

    th:nth-child(1), td:nth-child(1) {
        width: 60%; /* Retain the same proportions */
    }
    th:nth-child(2), td:nth-child(2),
    th:nth-child(3), td:nth-child(3) {
        width: 20%;
    }

    table {
        table-layout: fixed;
        word-wrap: break-word;
    }

    .page-hero {
        height: 100px;
    }

    .hero-content h1 {
        font-size: 2.4em;
    }

    input[type="text"], button {
        width: 100%;
    }

    .sort-button {
        min-width: 25px;
        max-width: 30px;
        padding: 3px 6px; /* Smaller padding for compact size */
        font-size: 12px;
    }
    
}

@media (max-width: 480px) {
    thead tr {
        flex-wrap: nowrap; /* Keep headers aligned horizontally */
        justify-content: flex-start; /* Align headers to the left */
        gap: 8px; /* Compact gap for tight spaces */
    }
    
    th, td {
        font-size: 12px;
        padding: 5px;
    }

    th:nth-child(1), td:nth-child(1) {
        width: 60%; /* Retain the same proportions */
    }
    th:nth-child(2), td:nth-child(2),
    th:nth-child(3), td:nth-child(3) {
        width: 20%;
    }

    input[type="text"], button {
        width: 100%;
    }

    table {
        table-layout: fixed;
        word-wrap: break-word;
    }

    .sort-button {
        padding: 2px 6px; /*nupu laius */
        font-size: 10px;
    }

    .page-hero {
        height: 100px;
    }

    .hero-content h1 {
        font-size: 2em;
    }

    .sort-button {
        min-width: 20px;
        max-width: 25px;
        padding: 2px 5px;
        font-size: 10px;
    }
}

/* Header Styling Fix */
thead tr {
    display: table-row; /* Align `th` with `td` naturally */
    text-align: left;
}

th {
    display: table-cell; /* Ensure headers behave like table cells */
    font-weight: bold;
}

/* SEO ja kasutusmugavus: kompaktsed tekstid, nähtavad siselingid. */
.page-title {
    font-size: 44px;
    line-height: 1.14;
    margin: 12px auto 5px;
}
.page-intro {
    max-width: 720px;
    margin: 0 auto 5px;
    padding: 0 8px;
    font-size: 17px;
    line-height: 1.35;
    color: #383838;
}
.data-meta {
    margin: 0 auto 8px;
    font-size: 14px;
    line-height: 1.35;
    color: #555;
}
.category-nav-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin: 6px auto 10px;
}
.category-nav-top a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 31px;
    padding: 5px 12px;
    border: 1px solid #c8e2d5;
    border-radius: 20px;
    background: #fff;
    color: #16784f;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 500;
    text-decoration: none;
}
.category-nav-top a:hover, .category-nav-top a:focus-visible {
    background: #eaf7f0;
    text-decoration: underline;
}
#search-form { margin-top: 9px; margin-bottom: 12px; }
.seo-details {
    margin: 24px auto 30px;
    padding: 18px 10px 0;
    border-top: 1px solid #ddd;
    color: #444;
    text-align: center;
}
.seo-details h2 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.25;
}
.seo-details p {
    max-width: 700px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .page-hero {
        height: 56px;
        background-size: auto 56px;
    }
    .container {
        width: 100%;
        max-width: 100%;
        margin: 8px auto 0;
        padding: 0 14px;
    }
    .page-title {
        font-size: 29px;
        line-height: 1.1;
        margin: 0 auto 4px;
    }
    .page-intro {
        padding: 0;
        margin: 0 auto 3px;
        font-size: 14px;
        line-height: 1.3;
    }
    .data-meta {
        margin: 0 auto 6px;
        font-size: 12px;
        line-height: 1.3;
    }
    .category-nav-top {
        margin: 5px auto 8px;
        gap: 5px 7px;
    }
    .category-nav-top a {
        min-height: 29px;
        padding: 5px 9px;
        font-size: 12px;
    }
    /* Üherealine otsing: lühike nupp ei puuduta ekraani servi. */
    #search-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 88px;
        align-items: stretch;
        gap: 8px;
        margin: 6px 0 10px;
        padding: 0 2px;
    }
    #search-form input[type="text"] {
        width: 100%;
        min-width: 0;
        height: 44px;
        flex: none;
        padding: 8px 12px;
        font-size: 16px;
    }
    #search-form button[type="submit"] {
        width: 88px;
        min-width: 0;
        max-width: 88px;
        height: 44px;
        flex: none;
        justify-self: end;
        padding: 7px;
        border-radius: 22px;
        font-size: 15px;
    }
    #results table {
        margin-top: 4px;
        table-layout: fixed;
    }
    #results th, #results td {
        padding: 8px 5px;
        font-size: 15px;
        line-height: 1.35;
        overflow-wrap: break-word;
    }
    #results th {
        font-size: 14px;
        white-space: normal;
    }
    #results th:nth-child(1), #results td:nth-child(1) { width: 55%; }
    #results th:nth-child(2), #results td:nth-child(2) { width: 27%; }
    #results th:nth-child(3), #results td:nth-child(3) { width: 18%; }
    #results td:nth-child(2) { font-size: 14px; }
    #results .sort-button {
        width: auto;
        min-width: 0;
        max-width: none;
        padding: 2px 3px;
        margin: 0;
        font-size: 11px;
    }
    .seo-details h2 { font-size: 20px; }
    .seo-details p { font-size: 15px; }
}
@media (max-width: 380px) {
    .page-title { font-size: 27px; }
    .category-nav-top a { padding-left: 7px; padding-right: 7px; }
}
