/* All the CSS code from the previous <style> tag goes here */
/* --- 1. THEME & COLOR PALETTE --- */
:root {
    /* Palette */
    --primary-color: #1A3D7C;
    --accent-color: #38A169;
    --warning-color: #DD6B20;
    --error-color: #C53030;

    /* Light Theme */
    --bg-primary: #F7FAFC;
    --bg-secondary: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --border-color: #EDF2F7;
}

.dark-mode {
    /* Dark Theme */
    --bg-primary: #1A202C;
    --bg-secondary: #2D3748;
    --text-primary: #EDF2F7;
    --text-secondary: #A0AEC0;
    --border-color: #4A5568;
}

/* --- 2. GLOBAL RESETS & FONT --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.2s, color 0.2s;
}

/* --- 3. MAIN APP LAYOUT --- */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- 4. SIDEBAR (FINAL - Fluid & Scaling Version) --- */
.sidebar {
    width: 280px;
    background-color: var(--primary-color);
    color: #FFFFFF;
    display: flex;
    flex-direction: column; /* Lays out header, nav, and profile vertically */
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 100;
    /* Use clamp() for fluid padding. Scales with viewport height (vh) */
    /* clamp(MINIMUM, PREFERRED, MAXIMUM) */
    padding: clamp(0.75rem, 2.5vh, 1.5rem) 1rem;
}

.sidebar-header {
    font-weight: 700;
    text-align: center;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0; /* Prevents header from shrinking too much */
    font-size: clamp(1.25rem, 4vh, 1.75rem); /* Fluid font size */
    padding-bottom: clamp(1rem, 3vh, 1.5rem);
}

.sidebar-nav {
    flex-grow: 1; /* This is KEY. It takes up all available middle space */
    min-height: 0; /* A flexbox trick to allow shrinking */
    /* REMOVED overflow-y: auto. The content will now scale instead of scroll. */
}

.sidebar-nav ul {
    list-style-type: none;
    height: 100%; /* Make the list fill the nav area */
    display: flex;
    flex-direction: column;
    /* This distributes the nav items evenly within the available space */
    justify-content: center; 
}

.sidebar-nav li {
    margin: 0.1rem 0; /* Minimal margin */
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    /* Fluid vertical padding and font size */
    padding: clamp(0.4rem, 1.2vh, 0.8rem) 1rem;
    font-size: clamp(0.8rem, 1.8vh, 0.95rem);
    gap: clamp(0.75rem, 1.5vw, 1rem);
}

.sidebar-nav .nav-icon {
    flex-shrink: 0;
    width: 24px;
    text-align: center;
    /* Fluid icon size */
    font-size: clamp(1rem, 2.2vh, 1.25rem);
}

.sidebar-nav li.active,
.sidebar-nav li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav li.active {
    font-weight: 600;
    color: var(--accent-color);
}

.user-profile {
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0; /* Prevent this from shrinking away */
    padding-top: clamp(0.75rem, 2.5vh, 1.25rem);
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: #EDF2F7;
    color: var(--primary-color);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 600;
    flex-shrink: 0;
    cursor: pointer;
}

.user-details-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    margin-bottom: 0.25rem;
    font-size: clamp(0.85rem, 1.8vh, 0.95rem);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
}

.action-icon,
.theme-toggle {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: clamp(1.1rem, 2.2vh, 1.25rem);
}

.action-icon:hover, .theme-toggle:hover {
    opacity: 1;
}

/* --- 5. MAIN CONTENT AREA --- */
.main-content {
    flex-grow: 1;
    padding: 32px 48px;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
}
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}
.content-header h1 {
    font-size: 32px;
}
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.2s;
}
.btn-primary {
    background-color: var(--accent-color);
    color: white;
}
.btn:hover { opacity: 0.85; }

.card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.staff-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.staff-table th, .staff-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.staff-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.status-pill {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.status-pill.up-to-date { background-color: #C6F6D5; color: #22543D; }
.status-pill.expires-soon { background-color: #FEEBC8; color: #9C4221; }
.status-pill.expired { background-color: #FED7D7; color: #9B2C2C; }
.dark-mode .status-pill.up-to-date { background-color: #2F855A; color: #C6F6D5; }
.dark-mode .status-pill.expires-soon { background-color: #9C4221; color: #FEEBC8; }
.dark-mode .status-pill.expired { background-color: #9B2C2C; color: #FED7D7; }

/* Dashboard card specific styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.dashboard-card {
    background-color: var(--bg-secondary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}
.card-header {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 16px;
}
.card-content {
    font-size: 14px;
}
.card-highlight {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}
.card-highlight.green { color: var(--accent-color); }
.card-highlight.orange { color: var(--warning-color); }
.card-highlight.red { color: var(--error-color); }

/* --- 6. RESPONSIVE DESIGN --- */
.hamburger-menu {
    display: none;
    cursor: pointer;
    font-size: 28px;
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 101;
}
.backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
@media (max-width: 1024px) {
    .sidebar { width: 88px; }
    .sidebar-header, .nav-text, .user-details { display: none; }
    .main-content { padding: 24px; }
}
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.is-visible { transform: translateX(0); }
    .sidebar.is-visible .sidebar-header,
    .sidebar.is-visible .nav-text,
    .sidebar.is-visible .user-details {
        display: block;
    }
    .main-content { padding: 24px; padding-top: 80px; }
    .hamburger-menu, .backdrop.is-visible { display: block; }
}


/* --- 7. MODAL STYLES --- */
/* ======================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--bg-secondary);
    padding: 32px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(-50px);
    transition: transform 0.3s ease;
}

.modal-overlay.is-visible .modal-container {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.modal-header h2 {
    font-size: 24px;
    color: var(--text-primary);
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--error-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Add this to the .status-pill section for the new status */
.status-pill.pending { background-color: #E2E8F0; color: #4A5568; }
.dark-mode .status-pill.pending { background-color: #4A5568; color: #E2E8F0; }


/* --- 8. UI ANIMATIONS --- */
/* ======================== */
@keyframes fadeInHighlight {
    from {
        background-color: rgba(56, 161, 105, 0.2); /* A faint green flash */
    }
    to {
        background-color: transparent;
    }
}

.new-row-highlight {
    animation: fadeInHighlight 1.5s ease-out;
}

/* --- 9. NEW PAGE LAYOUT & CONTEXT SWITCHER --- */
.main-content {
    /* This is now a flex container for the new layout */
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 32px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
}

.context-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-switcher label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.context-switcher select {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
}

.page-content {
    flex-grow: 1;
    /* This area will contain our dynamic content */
}


/* --- 10. CATEGORY LANDING PAGE CARDS --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.category-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.07);
}

.category-card .card-icon {
    font-size: 32px;
    margin-bottom: 16px;
}

.category-card h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 14px;
    flex-grow: 1; /* Pushes the stats to the bottom */
    margin-bottom: 24px;
}

.card-stats {
    font-weight: 600;
    color: var(--text-primary);
}

/* --- 11. USER PROFILE DROPDOWN MENU --- */
.user-profile {
    position: relative; /* Required for positioning the dropdown */
    cursor: pointer;
}

.user-menu {
    position: absolute;
    bottom: 100%; /* Position it above the user profile section */
    left: 0;
    width: 100%;
    margin-bottom: 12px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 101;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.user-menu.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu ul {
    list-style-type: none;
}

.user-menu li {
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu li:hover {
    background-color: var(--bg-primary);
}

.user-menu li .nav-icon {
    font-size: 16px;
}

.user-menu li.separator {
    height: 1px;
    background-color: var(--border-color);
    padding: 0;
    margin: 4px 0;
}


/* --- 12. TABS COMPONENT STYLES --- */
.tabs-nav {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 32px;
}

.tabs-nav ul {
    list-style-type: none;
    display: flex;
    gap: 24px;
}

.tabs-nav li {
    padding: 16px 4px;
    margin-bottom: -2px; /* Pulls the bottom border up to overlap */
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.tabs-nav li:hover {
    color: var(--text-primary);
}

.tabs-nav li.is-active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.dark-mode .tabs-nav li.is-active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-pane {
    display: none; /* Hide all tab panes by default */
}

.tab-pane.is-active {
    display: block; /* Show only the active one */
}

/* --- 13. BACK BUTTON & HEADER LAYOUT --- */
.header-with-back-button {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.btn-back:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* --- 14. USER ACTION ICONS --- */
.user-profile {
    /* No longer need a direct gap, the new container will handle it */
    gap: 0; 
}

.user-details {
    margin-right: auto; /* Pushes action icons to the right */
    padding-left: 12px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-right: 8px;
}

.action-icon {
    font-size: 22px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.action-icon:hover {
    opacity: 1;
}

/* Adjustments for icon-only tablet view */
@media (max-width: 1024px) {
    .user-actions {
        display: none; /* Hide these on tablet view for simplicity */
    }
    .user-details {
        display: none;
    }
}

/* --- 15. FINAL USER PROFILE LAYOUT --- */

/* The main container for the whole bottom-left section */
.user-profile {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced gap */
    position: relative;
}

/* The area that specifically toggles the menu */
.user-profile-toggle-area {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.user-profile-toggle-area:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 40px; /* Back to original size */
    height: 40px;
    font-size: 16px;
}

.user-name {
    font-weight: 600;
}

/* The container for the icons */
.user-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 8px;
}

.action-icon {
    font-size: 22px;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 8px;
    border-radius: 8px;
    display: block;
}
.action-icon:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.05);
}

@media (max-width: 1024px) {
    .user-name, .user-actions {
        display: none;
    }
}


/* --- 16. NEW COMPLIANCE TASK STYLES (Complete & Corrected) --- */

/* NEW: Styles for the filter bar */
.filter-bar {
    display: flex;
    gap: 1rem;
}

.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.tasks-container {
    width: 100%; /* This is the key line to fix the shrinking layout */
}

/* Base styles for task groups and headers */
.tasks-group {
    margin-bottom: 40px;
}

.tasks-header {
    font-size: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.tasks-header.overdue {
    color: var(--error-color);
}

/* NEW: Style for completed headers */
.tasks-header.completed {
    color: var(--accent-color);
}

/* Base style for all task items */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 16px;
    /* NEW: Add cursor and hover effect for interactivity */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* NEW: Modifier for completed tasks */
.task-item.is-completed {
    background-color: var(--bg-primary);
    opacity: 0.7;
    cursor: default; /* No action on completed tasks */
}
.task-item.is-completed:hover {
    transform: none;
    box-shadow: none;
}
.task-item.is-completed .task-info h4 {
    text-decoration: line-through;
}

/* Styles for the content inside a task item */
.task-info h4 {
    font-size: 18px;
    margin-bottom: 4px;
}

.task-info p {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.task-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.task-actions span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* NEW: Style for the recorded data display */
.task-recorded-data {
    font-weight: 700;
    font-size: 1.25rem;
    margin-right: 1rem;
    color: var(--text-primary);
}

/* NEW: A helper class for large inputs in modals */
.large-input {
    font-size: 1.5rem;
    text-align: center;
    font-weight: 700;
    padding: 16px;
}

/* --- 17. TASK DETAIL & VIEWING ENHANCEMENTS --- */

/* Make the photo icon bigger and more prominent */
.task-actions .action-icon {
    font-size: 1.75rem; /* Much larger */
    opacity: 1;
}

/* Make the whole completed task item feel interactive */
.task-item.is-completed {
    cursor: pointer; /* Change cursor to indicate it's clickable */
    transition: background-color 0.2s;
}
.task-item.is-completed:hover {
    background-color: var(--bg-secondary); /* A subtle highlight on hover */
}

/* Fix the temperature input scrollbar issue */
.temperature-input-wrapper .large-input {
    box-sizing: border-box; /* Ensures padding is included in the width, not added to it */
    width: 100%;
    padding-right: 4rem; 
}

/* Styles for the new "View Details" modal */
.task-view-modal .detail-row {
    margin-bottom: 1rem;
    font-size: 1rem;
}
.task-view-modal .detail-row strong {
    color: var(--text-secondary);
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}
task-view-modal .photo-container {
    width: 100%;
    height: 400px; /* Set a fixed height for the viewing box */
    background-color: var(--bg-primary); /* Background for letterboxing */
    border-radius: 8px;
    margin-top: 1rem;
    
    /* These three lines will PERFECTLY center the image inside */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The image itself now just needs to behave and not exceed the container */
.task-view-modal .task-photo-view {
    max-width: 100%;  /* Never wider than the container */
    max-height: 100%; /* Never taller than the container */
    width: auto;      /* Maintain aspect ratio */
    height: auto;     /* Maintain aspect ratio */
    object-fit: contain; /* This will now work as intended */
}

/* --- 20. PHOTO PREVIEW STYLES --- */
.photo-preview-container {
    margin-top: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    min-height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* ✅ ADD THIS LINE ✅ */
    gap: 0.5rem;             /* And add a small gap for spacing */
}

.photo-placeholder {
    width: 100%;
    height: 400px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    margin-top: 1rem;

    /* Use flexbox to perfectly center the text (emoji) */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Use font-size to control the emoji size, not object-fit */
    font-size: 8rem; /* A very large font size */
    opacity: 0.6; /* Make it look like a placeholder */
}

.photo-preview-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    object-fit: contain;
}

/* --- 18. TASK EDIT/DELETE ACTIONS --- */

/* The task-item now needs to accommodate multiple action groups */
.task-item {
    gap: 0.5rem; /* Reduce main gap */
}
.task-info {
    flex-grow: 1; /* Allow info to take up available space */
}

/* Container for the new Edit/Delete icons */
.task-item-actions {
    display: flex;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
    margin-left: auto; /* Push to the far right */
}

.task-item-actions .action-icon {
    font-size: 1.25rem;
}
.task-item-actions .action-icon.delete:hover {
    color: var(--error-color);
}


/* --- 21. REMOVE PHOTO BUTTON --- */
.remove-photo-btn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: var(--error-color);
    background-color: transparent;
    border: 1px solid var(--error-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.remove-photo-btn:hover {
    background-color: var(--error-color);
    color: white;
}

/* --- 22. ENHANCED DATE FILTER DROPDOWN (Definitive Version) --- */

/* This is the main container for all the filters */
.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* This new wrapper div allows us to position the dropdown correctly */
.date-select-wrapper {
    position: relative; /* This is the positioning anchor */
}

/* This is the main dropdown panel that appears */
.date-range-dropdown {
    display: none; /* This is the default state */
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
    width: max-content;
}

/* We add this class with JavaScript to make it appear */
.date-range-dropdown.is-visible {
    display: flex; /* This overrides the 'none' and shows the element */
}

/* Styles for the groups of labels and inputs inside the dropdown */
.date-range-dropdown .form-group {
    margin-bottom: 0; /* Override default form-group margin */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-range-dropdown label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.date-range-dropdown input[type="date"] {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit; /* Use the main app font */
}

/* Style the little calendar icon inside the date input */
.date-range-dropdown input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: brightness(0.8);
}
.dark-mode .date-range-dropdown input[type="date"]::-webkit-calendar-picker-indicator {
   filter: invert(1) brightness(0.8);
}

/* A smaller version of our primary button for use in dropdowns */
.btn-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
    margin-top: 0.5rem; /* Space above the apply button */
}

/* --- 24. DYNAMIC DATE FILTER DISPLAY --- */

/* This is the container for the displayed custom range text */
.custom-range-display {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* The 'X' button to clear the filter */
.clear-filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 0.75rem;
    padding: 0 0.25rem;
}

.clear-filter-btn:hover {
    color: var(--error-color);
}
/* End of /css/style.css */