/* --- Base & Layout --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa; /* Light grey background */
    color: #212529; /* Dark text */
    line-height: 1.6;
}

.container {
    width: 85%;
    max-width: 1100px; /* Max width for larger screens */
    margin: 0 auto; /* Center container */
    overflow: hidden; /* Clear floats */
    padding: 0 15px; /* Add some padding */
}

.main-header {
    background: linear-gradient(to right, #007bff, #0056b3); /* Blue gradient */

    color: #fff;
    padding: 15px 0;
    border-bottom: #dee2e6 1px solid; /* Light border */
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);

}

.main-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}



/* Base Rules */
.main-header .flags {
    /* Use vw for width */
    width: 12vw; /* EXAMPLE: 12% of viewport width - TUNE THIS */

    /* Add min/max to prevent extremes */
    min-width: 40px; /* EXAMPLE minimum */
    max-width: 80px; /* EXAMPLE maximum */

    /* Keep flex centering */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.main-header .flags img {
     /* Option A: Let height be constrained by container/flex alignment (might work) */
     /* max-height: 100%; */
     /* max-width: 100%; */
     /* width: auto; */

     /* Option B: Set height relative to vw width (more consistent scaling) */
     /* Adjust multiplier based on desired aspect ratio/size */
     height: 6vw; /* EXAMPLE: Height is half the container width - TUNE THIS */
     /* Add min/max height to match min/max width roughly */
     min-height: 20px; /* EXAMPLE */
     max-height: 45px; /* EXAMPLE */

     width: auto; /* Maintain aspect ratio based on height */
     max-width: 100%; /* Prevent overflow anyway */
     display: block;
     margin: 0;
}

.main-header h1 {
    /* Existing rules like margin, text-align, flex-grow etc. */
    margin: 0;
    padding: 0 1.5vw; /* Use vw for padding too? Or em/px */
    text-align: center;
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;

    /* Fluid Typography using clamp() */
    /* clamp(MIN_FONT_SIZE, PREFERRED_FLUID_SIZE, MAX_FONT_SIZE) */
    /* Adjust values carefully */
    font-size: clamp(1.5em, 4vw + 0.5em, 2.8em);
    /* Explanation:
       - Minimum font size: 1.5em
       - Preferred size: Scales with viewport width (4vw) plus a base (0.5em)
       - Maximum font size: 2.8em
    */

    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 1px; /* Maybe make this fluid too? Or adjust in clamp */
}



/* --- Navigation --- */
nav.main-nav {
    background: #ffffff; /* White background */
    padding: 10px 0;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
nav.main-nav a {
    color: #007bff; /* Link blue */
    text-decoration: none;
    padding: 8px 18px;
    margin: 0 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-weight: 500;
}
nav.main-nav a:hover, nav.main-nav a.active {
    background-color: #007bff;
    color: #fff;
}
nav.main-nav .logout-link { /* Different style for logout/admin */
    color: #dc3545; /* Red */
}
nav.main-nav .admin-link {
    color: #28a745; /* Green */
}
nav.main-nav .logout-link:hover, nav.main-nav .admin-link:hover {
    color: #fff; /* White on hover */
    background-color: #5a6268; /* Dark grey */
}


/* --- Main Content Area --- */
.content {
    background: #fff;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
}

/* --- Featured Article --- */
.featured-article {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 25px;
    margin-bottom: 25px;
}
.featured-article h2 {
    color: #0056b3; /* Darker blue */
    margin-top: 0;
    font-size: 1.8em;
}
.featured-article img { /* Style for article image if added */
   max-width: 100%;
   height: auto;
   margin-bottom: 15px;
   border-radius: 4px;
}

/* --- Article List & Summary --- */
.article-list h2 {
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.article-summary {
    border-bottom: 1px dotted #ced4da;
    padding: 20px 0;
    margin-bottom: 15px;
}
.article-summary:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 5px;
}
.article-summary h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.4em;
}
.article-summary h3 a {
    color: #007bff;
    text-decoration: none;
}
.article-summary h3 a:hover {
    text-decoration: underline;
}
.article-meta {
    font-size: 0.85em;
    color: #6c757d; /* Grey text */
    margin-bottom: 10px;
}
.article-summary .read-more {
    display: inline-block;
    margin-top: 10px;
    font-weight: bold;
    color: #007bff;
    text-decoration: none;
}
.article-summary .read-more:hover {
    text-decoration: underline;
}

/* --- Single Article Page --- */
.single-article h1 {
    color: #0056b3;
    margin-bottom: 10px;
}
.single-article .article-meta {
    margin-bottom: 20px;
}
.single-article .article-content {
    font-size: 1.1em; /* Slightly larger text for reading */
}
.single-article .article-content p {
    margin-bottom: 1em;
}


/* --- Pagination --- */
.pagination {
    margin: 30px 0;
    text-align: center;
    list-style: none;
    padding: 0;
}
.pagination li {
    display: inline-block; /* Use inline-block for list items */
    margin: 0 3px;
}
.pagination a, .pagination span {
    display: block; /* Make links block for padding */
    padding: 8px 15px;
    border: 1px solid #dee2e6;
    text-decoration: none;
    color: #007bff;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.pagination .disabled span, .pagination .disabled a {
    color: #6c757d;
    background-color: #e9ecef;
    border-color: #dee2e6;
    cursor: not-allowed;
}
.pagination .current span, .pagination .current a { /* Style the current page */
    font-weight: bold;
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    cursor: default;
}
.pagination a:hover:not(.disabled a) { /* Hover effect for non-disabled/non-current links */
    background-color: #e9ecef;
    border-color: #adb5bd;
}


/* --- Business Directory --- */
.business-entry {
    border-bottom: 1px dotted #ced4da;
    padding: 15px 0;
    margin-bottom: 15px;
}
.business-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 5px;
}
.business-entry h3 { margin-bottom: 5px; font-size: 1.3em; }
.business-entry p { margin: 4px 0; font-size: 0.95em; }
.business-entry strong { color: #495057; font-weight: 600; }
.business-entry a { color: #007bff; text-decoration: none; }
.business-entry a:hover { text-decoration: underline; }


/* --- Forms --- */
form div {
    margin-bottom: 15px;
}
form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #495057;
}
form input[type="text"],
form input[type="password"],
form input[type="email"],
form input[type="url"],
form textarea,
form select {
    width: 100%; /* Full width */
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding in width */
    font-size: 1em;
}
form textarea {
    min-height: 150px; /* Good default height for text areas */
    resize: vertical; /* Allow vertical resizing */
}
form input[type="checkbox"] {
   width: auto; /* Checkboxes don't need full width */
   margin-right: 5px;
   vertical-align: middle;
}
form input[type="submit"], button.btn, a.btn { /* General button styling */
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1em;
    text-decoration: none; /* For <a> tags styled as buttons */
    display: inline-block;
    transition: background-color 0.3s ease;
}
form input[type="submit"]:hover, button.btn:hover, a.btn:hover {
    background-color: #0056b3; /* Darker blue on hover */
}
button.btn-danger, a.btn-danger {
    background-color: #dc3545; /* Red for delete/danger */
}
button.btn-danger:hover, a.btn-danger:hover {
    background-color: #c82333;
}
button.btn-secondary, a.btn-secondary {
    background-color: #6c757d; /* Grey for cancel/secondary */
}
button.btn-secondary:hover, a.btn-secondary:hover {
    background-color: #5a6268;
}

.form-error, ul.errors {
    color: #dc3545; /* Red for errors */
    font-size: 0.9em;
    margin-top: 5px;
}
ul.errors {
    list-style: none;
    padding: 0;
    margin-left: 0;
}
ul.errors li { margin-bottom: 3px; }


/* --- Flash Messages --- */
.flashes {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}
.flashes li {
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid transparent;
    border-radius: 4px;
}
.flashes .success { /* Assuming categories are set in flash() calls */
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.flashes .danger, .flashes .error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.flashes .warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}
.flashes .info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}


/* --- Admin Area Specifics --- */
.admin-actions { white-space: nowrap; } /* Prevent buttons wrapping */
.admin-actions a, .admin-actions button {
    margin-right: 8px;
    padding: 5px 10px;
    font-size: 0.9em;
}
.admin-actions form { display: inline; } /* Keep delete form inline */

/* Admin Tables */
table.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
table.admin-table th, table.admin-table td {
    border: 1px solid #dee2e6;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}
table.admin-table th {
    background-color: #e9ecef;
    font-weight: bold;
}
table.admin-table tbody tr:nth-child(odd) {
    background-color: #f8f9fa; /* Subtle striping */
}
table.admin-table tbody tr:hover {
    background-color: #f1f1f1; /* Hover effect */
}


/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 25px;
    color: #6c757d; /* Grey text */
    font-size: 0.9em;
    background-color: #e9ecef; /* Light background */
    border-top: 1px solid #dee2e6;
}


/* ========================== */
/* Responsive Design Adjustments */
/* ========================== */

/* Medium devices (tablets, etc. - 768px and down) */
@media (max-width: 768px) {
    .container {
        width: 90%; /* Allow content to use more width */
    }

    .main-header {
        padding: 12px 0; /* Slightly reduce vertical padding */
        margin-bottom: 20px;
    }

    .main-header .flags {
        width: 55px; /* Adjust fixed width for smaller screens - TUNE THIS */
    }
    .main-header .flags img {
        height: 38px; /* Adjust height */
    }
    .main-header h1 {
        font-size: 2.1em;
        padding: 0 8px; /* Adjust padding */
    }


    /* --- Navigation Bar Adjustments (Common Need) --- */
    /* You'll likely need to style the nav separately. */
    /* Example: Make links bigger targets, maybe start stacking */
    nav.main-nav a {
        padding: 8px 12px;
        margin: 0 3px;
        font-size: 0.95em;
    }
}

/* Small devices (landscape phones, etc. - 576px and down) */
@media (max-width: 576px) {
    .container {
        width: 95%; /* Use even more width */
    }



    .main-header h1 {
         /* Maybe adjust clamp values slightly for very small screens */
         font-size: clamp(1.4em, 5vw + 0.2em, 2em);
    }
     .main-header .flags {
         /* Optionally adjust vw, min/max if needed */
         /* width: 14vw; */
         /* min-width: 35px; */
     }
     .main-header .flags img {
        /* Optionally adjust vw, min/max if needed */
        /* height: 7vw; */
        /* min-height: 18px; */
     }


    /* Option 2: Stack header elements (uncomment if preferred) */
    /* .main-header .container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .main-header h1 {
        font-size: 1.8em;
        order: 2; // Title below flags
        margin: 5px 0;
    }
    .main-header .flags {
        order: 1; // Flags above title
        margin-bottom: 5px;
    }
    .main-header .flags img {
         margin: 0 8px;
         height: 35px;
    } */


    .content {
        padding: 15px; /* Reduce padding inside main content */
    }

     /* --- Navigation Bar Adjustments for Small Screens --- */
    /* This usually requires significant changes - often a 'hamburger' menu */
    nav.main-nav .container {
       display: flex;
       flex-direction: column; /* Stack nav links */
       align-items: center;
    }
    nav.main-nav a {
        display: block; /* Make links full width */
        width: 80%;
        margin: 5px auto; /* Center links with margin */
        padding: 10px;
        text-align: center;
        border: 1px solid #eee; /* Add borders for clarity */
    }
    nav.main-nav {
        padding: 10px 0;
    }
}

/* Extra small devices (portrait phones, etc. - adjust breakpoint if needed) */
@media (max-width: 400px) {

     .main-header .flags {
        width: 40px; /* TUNE THIS */
     }
     .main-header .flags img {
        height: 28px; /* Adjust height */
     }
     .main-header h1 {
        font-size: 1.45em;
     }

}

