/* ------------------------------------ */
/* 🌐 Dashboard layout - LIGHT MODE (ADAPTIVE BASE) */
/* ------------------------------------ */

/* --- General Text & Links --- */
.hl-print-link,
.hl-modal-close:hover {
    color: var(--nv-primary-accent, #c7ae6a);
}
.hl-print-link {
    text-decoration: none;
    font-weight: 600; /* Slightly bolder link text */
}
.hl-print-link:hover {
    text-decoration: underline;
}

/* Ensure all labels and text within containers follow theme text color */
.hl-filter-form label,
.hl-create-staff-form label,
.hl-submission p,
.hl-submission label,
.hl-modal-content * {
    color: var(--nv-text-color, #323232);
}

/* Forms & Filter Boxes (Secondary Background: --nv-light-bg) */
.hl-filter-form,
.hl-bulk-assign-form,
.hl-create-staff-form,
.hl-hidden-form-container {
    margin-bottom: 2em;
    padding: 1.2em; /* Slight increase in padding */
    background: var(--nv-light-bg, #f4f4f4);
    border: 1px solid rgba(var(--nv-text-color, 50, 50, 50), 0.15); /* Softer border */
    border-radius: 8px; /* Slightly rounder corners */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle lift */
}

/* Submission Cards and Modal Content (Primary Background: --nv-site-bg) */
.hl-submission,
.hl-modal-content {
    /* 🔑 V6: Card is now full-width block element */
    background: var(--nv-site-bg, #ffffff);
    border: 1px solid rgba(var(--nv-text-color, 50, 50, 50), 0.15);
    padding: 0; /* 🔑 V6: Padding moved to hl-card-content */
    border-radius: 8px;
    overflow: hidden; /* CRITICAL: Ensures internal elements respect the border-radius */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Clearer card separation */
    color: var(--nv-text-color, #323232);
    margin-bottom: 20px; /* 🔑 V6: Add bottom margin for separation */
    flex: 1 1 100%; /* 🔑 V6: Ensure card takes full width */
}
.hl-submission p strong {
    font-weight: 600; /* Emphasize key data labels */
}


/* 🚀 INPUTS, SELECTS, AND **TRACKER DROPDOWNS** (The Fix) */
.hl-filter-form select,
.hl-filter-form input[type="date"],
.hl-create-staff-form input,
.hl-bulk-assign-form select,
.hl-assign-select,
.hl-status-select {
    margin-right: 10px;
    padding: 8px; /* Slightly taller inputs */
    line-height: 1.2;
    background-color: var(--nv-site-bg, #ffffff);
    border: 1px solid rgba(var(--nv-text-color, 50, 50, 50), 0.2);
    border-radius: 4px;
    color: var(--nv-text-color, #323232);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07); /* Subtle inset for depth */
}


/* Tab Navigation */
.hl-tab-nav {
    border-bottom: 2px solid rgba(var(--nv-text-color, 50, 50, 50), 0.1);
    margin-bottom: 20px;
    display: flex;
}

.hl-tab-button {
    padding: 10px 15px;
    margin-right: 5px;
    border: 1px solid transparent;
    border-bottom: none;
    background: var(--nv-light-bg, #f4f4f4);
    color: var(--nv-text-color, #323232);
    border-radius: 4px 4px 0 0;
}

.hl-tab-button.active {
    border-color: rgba(var(--nv-text-color, 50, 50, 50), 0.1);
    border-bottom: 2px solid var(--nv-site-bg, #ffffff);
    background: var(--nv-site-bg, #ffffff);
    color: var(--nv-primary-accent, #c7ae6a);
    font-weight: 600;
}


/* ------------------------------------ */
/* 🔑 V6: COLLAPSIBLE CARD STYLES */
/* ------------------------------------ */

.hl-card-header {
    padding: 1.2em 1.5em; /* Padding for the header */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.15s ease;
    /* CRITICAL: This is the separator when the card is OPEN */
    border-bottom: 1px solid rgba(var(--nv-text-color, 50, 50, 50), 0.1);
}

.hl-card-header:hover {
    background-color: rgba(var(--nv-text-color, 50, 50, 50), 0.03);
}

.hl-card-header.collapsed {
    border-bottom: none;
    border-radius: 8px; /* Full border radius when collapsed */
}

.hl-card-title {
    margin: 0;
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1.4;
    flex-grow: 1;
}

.hl-card-meta {
    font-size: 0.9em;
    color: rgba(var(--nv-text-color, 50, 50, 50), 0.7);
    margin: 0 15px;
}

.hl-card-toggle-icon {
    font-size: 1.2em;
    transition: transform 0.2s ease;
    padding-left: 10px;
}

/* Rotate icon when active (open) */
.hl-card-header:not(.collapsed) .hl-card-toggle-icon {
    transform: rotate(180deg);
}

.hl-card-content {
    padding: 1.5em; /* Content padding */
}


/* 🔑 V6: STATUS BADGE STYLES */
.hl-status-badge {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 10px;
    font-size: 0.8em;
    font-weight: 700;
    line-height: 1;
    border-radius: 4px;
    text-transform: uppercase;
    color: #fff !important; /* White text for high contrast */
}

/* Define colors for common statuses */
.hl-status-new { background-color: #3498db; } /* Blue */
.hl-status-awaiting_client_docs { background-color: #e74c3c; } /* Red (Action Required) */
.hl-status-in_progress { background-color: #f39c12; } /* Orange */
.hl-status-awaiting_client_review { background-color: #2ecc71; } /* Green (Ready for Review) */
.hl-status-complete { background-color: #1abc9c; } /* Turquoise (Completed) */
.hl-status-cancelled { background-color: #95a5a6; } /* Grey */


/* 🔑 V6: PAGINATION STYLES */
.hl-pagination {
    margin-top: 25px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.hl-pagination a {
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid rgba(var(--nv-text-color, 50, 50, 50), 0.15);
    border-radius: 4px;
    color: var(--nv-text-color, #323232);
    background: var(--nv-site-bg, #ffffff);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.hl-pagination a:hover {
    background: var(--nv-light-bg, #f4f4f4);
    color: var(--nv-primary-accent, #c7ae6a);
    text-decoration: none;
}

.hl-pagination a.current {
    font-weight: 700;
    background: var(--nv-primary-accent, #c7ae6a);
    color: #ffffff;
    border-color: var(--nv-primary-accent, #c7ae6a);
}


/* ------------------------------------ */
/* 🌙 DARK MODE OVERRIDES (The True Adaptive FIX) */
/* ------------------------------------ */
@media (prefers-color-scheme: dark) {

/* This targets all portal content to ensure text color is correct */
.hl-filter-form *,
.hl-submission *,
.hl-modal-content * {
    color: var(--nv-text-color, #ffffff) !important;
}

/* 1. Filter Forms (Secondary Background: #2a2a2a) */
.hl-filter-form,
.hl-bulk-assign-form,
.hl-create-staff-form,
.hl-hidden-form-container,
.hl-tab-button {
    background: var(--nv-light-bg, #2a2a2a);
    border-color: rgba(var(--nv-text-color, 255, 255, 255), 0.25);
}

/* 2. Submission Cards / Inputs (Primary Background: #232323) */
.hl-submission,
.hl-modal-content,
.hl-filter-form select,
.hl-filter-form input[type="date"],
.hl-create-staff-form input,
.hl-bulk-assign-form select,
.hl-assign-select,
.hl-status-select {
    background-color: var(--nv-site-bg, #232323);
    border-color: rgba(var(--nv-text-color, 255, 255, 255), 0.3);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4); /* Darker inset shadow */
}

/* Active Tab */
.hl-tab-button.active {
    border-bottom: 2px solid var(--nv-site-bg, #232323);
    box-shadow: none; /* Remove shadow on active tab */
}

/* Modal Styling for dark mode */
.hl-modal-content {
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1); /* Lighter shadow for dark mode */
}

    /* 🔑 V6 Dark Mode: Card Header */
    .hl-card-header {
        border-bottom-color: rgba(var(--nv-text-color, 255, 255, 255), 0.25);
    }
    .hl-card-header:hover {
        background-color: rgba(var(--nv-text-color, 255, 255, 255), 0.05);
    }
    .hl-card-meta {
        color: rgba(var(--nv-text-color, 255, 255, 255), 0.6);
    }

    /* 🔑 V6 Dark Mode: Pagination */
    .hl-pagination a {
        background: var(--nv-site-bg, #232323);
        border-color: rgba(var(--nv-text-color, 255, 255, 255), 0.25);
    }
    .hl-pagination a:hover {
        background: var(--nv-light-bg, #2a2a2a);
    }

}

/* ------------------------------------ */
/* Standard Styles (Non-Color Related/High Contrast) */
/* ------------------------------------ */

.hl-submissions-wrapper {
    display: block; /* 🔑 V6: Change from flex to block for full-width cards */
    gap: 20px;
}
.hl-assign-dropdown {
    margin-top: 10px;
}
/* 🔑 V6: Updated Status Span selector for Staff/Client views */
.hl-assign-status,
.hl-status-message {
    margin-left: 10px;
    font-weight: bold;
    color: var(--nv-text-color, #323232); /* Use theme text color */
}
/* AJAX Status Colors (keep high contrast) */
.hl-success {
    color: green;
}
.hl-error {
    color: red;
}
.hl-tab-content {
    display: none;
}
.hl-tab-content.active {
    display: block;
}
.hl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.hl-modal-close {
    position: absolute;
    top: 10px;
    right: 15px; /* Adjust close button position */
    font-size: 28px; /* Slightly larger close button */
    font-weight: normal;
    color: var(--nv-text-color, #323232);
    cursor: pointer;
    line-height: 1;
    border: none;
    background: transparent;
    padding: 0;
}
/* 🖨️ Print view */
@media print {
/* Hide all non-data UI elements */
.hl-print-link,
.hl-back-link,
.hl-assign-dropdown,
.hl-bulk-assign-form,
.hl-create-staff-form,
.hl-filter-form,
.hl-tab-nav,
    .hl-document-actions, /* 🔑 V6: Hide staff action buttons */
    .hl-status-control, /* 🔑 V6: Hide status dropdown */
    .hl-card-header, /* 🔑 V6: Hide header (print only content) */
    .hl-pagination /* 🔑 V6: Hide pagination */
    {
    display: none !important;
}

.hl-submission {
    page-break-inside: avoid;
    border: none;
    background: none;
    box-shadow: none;
    margin-bottom: 1em;
}

    /* 🔑 V6: Ensure card content is visible and takes up space */
    .hl-card-content {
        display: block !important;
        padding: 0;
        border-radius: 0;
    }

/* Ensure print-view styles defined inline in PHP take precedence */
.hl-print-view {
    padding: 0;
}
}

/* ------------------------------------ */
/* V5 MODAL STYLES */
/* ------------------------------------ */

/* Hidden forms */
.hl-hidden-form-container {
    display: none; /* Hide forms that should be in a modal by default */
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
    margin-top: 15px;
}

/* Modal Overlay */
.hl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Modal Content Box */
.hl-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh; /* Prevent it from being taller than the screen */
    overflow-y: auto; /* Allow scrolling for long forms */
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

/* Close Button */
.hl-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    border: none;
    background: transparent;
    padding: 0;
}

.hl-modal-close:hover {
    color: #333;
}