/* === VARIABLE DEFINITIONS === */
:root {
    color-scheme: light; /* Cegah browser force-invert warna ke dark mode */
    --background-primary: #f4f7f6;
    --background-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #555555;
    --header-bg: #2c3e50;
    --header-text: #ffffff;
    --border-color: #e0e0e0;
    --primary-color: #FF6B00;
    --primary-hover: #E66000;
    --accent-orange: #FF6B00;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --shadow-color: rgba(0,0,0,0.05);
}

/* === GLOBAL STYLES === */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--background-primary);
    color: var(--text-primary);
}

/* === MAIN LAYOUT === */
.main-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.main-content {
    padding: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px; /* Space between header and content */
}

#page-title {
    margin: 0; /* Remove default h1 margin */
}

.header-divider {
    border: none;
    height: 1px;
    background-color: var(--border-color);
    margin: 0 0 20px 0;
}

/* === HEADER & NAVIGATION === */
.header-left .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    line-height: 1;
}
.logo-wordmark {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: #FF6B00;
}
.logo-lines {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 4px;
    gap: 3px;
}
.logo-lines::before {
    content: '';
    display: block;
    width: 92px;
    height: 1px;
    background: #aaaaaa;
}
.logo-lines::after {
    content: '';
    display: block;
    width: 67px;
    height: 1px;
    background: #cccccc;
}

.main-nav {
    display: flex;
    align-items: center;
}

.nav-menu {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-menu > li {
    position: relative;
    margin: 0 10px;
}

.nav-menu a, .nav-menu .dropdown-toggle {
    color: var(--header-text);
    text-decoration: none;
    padding: 20px 10px;
    display: block;
    cursor: pointer;
}

.nav-menu a:hover, .nav-menu .dropdown-toggle:hover {
    color: var(--primary-color);
}

/* Dropdown styles */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        display: block;
    }
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 8px var(--shadow-color);
    list-style: none;
    padding: 5px 0;
    margin: 0;
    min-width: 180px;
    z-index: 1000;
}

.dropdown-menu a {
    color: var(--text-primary);
    padding: 10px 20px;
    display: block;
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background-color: var(--background-primary);
    color: var(--primary-color);
}

/* Mobile-only link, hidden by default */
.nav-menu-item-mobile {
    display: none;
}

.header-right .logout-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 20px;
}

.header-right .logout-btn:hover {
    background-color: var(--primary-hover);
}

/* === RESPONSIVE HEADER === */
.hamburger-btn {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 24px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .main-nav {
        display: none; /* Hide normal nav on mobile */
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--header-bg);
        flex-direction: column;
        z-index: 1000; /* Ensure nav is on top */
    }

    .main-nav.open {
        display: flex;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu > li {
        margin: 0;
        text-align: center;
    }

    .dropdown-menu {
        position: static;
        border: none;
        box-shadow: none;
        background-color: #00000020; /* Slightly darker background for submenu */
        display: none; /* Hide by default on mobile */
    }

    .dropdown.submenu-open > .dropdown-menu {
        display: block; /* Show when parent has the class */
    }

.hamburger-btn {
        display: block; /* Show hamburger on mobile */
    }

    .header-right .logout-btn {
        display: none !important; /* Force hide original logout button on mobile */
    }

    .nav-menu-item-mobile {
        display: block; /* Show mobile-only links */
    }

    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 999; /* Lower than the nav menu */
        display: none; /* Hidden by default */
    }

    .overlay.active {
        display: block;
    }
}

/* === LOGIN WRAPPER (for centering) === */
.login-page-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* === LOGIN FORM === */
.login-container {
    max-width: 400px;
    margin: 20px; /* Replaces fixed margin-top */
    padding: 30px;
    background-color: var(--background-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--shadow-color);
    text-align: center;
    width: 100%;
    transform: translateY(-20px); /* Shift up from center */
}

.login-container h2 { margin-bottom: 30px; }
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; }
.form-group input { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; }
.login-container button { background-color: var(--primary-color); color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; }
.login-container button:hover { background-color: var(--primary-hover); }
.error-message { color: var(--danger-color); margin-top: 10px; }

.text-center {
    text-align: center !important;
}

/* === MODAL STYLES === */
.modal {
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow-y: auto; /* Allow vertical scroll for tall modals */
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-content {
    background-color: var(--background-secondary);
    margin: 25vh auto; /* 25% of viewport height from top, centered horizontally */
    padding: 20px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px; 
    border-radius: 8px;
    position: relative;
}

.close-btn {
    color: var(--text-secondary);
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

/* === DATA TABLE STYLES === */
.table-toolbar {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically align items */
    gap: 15px; /* Add gap between items */
}

#table-filter {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
    max-width: 275px;
}

.action-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.action-btn:hover { background-color: var(--primary-hover); }

.action-btn.btn-secondary {
    background-color: #3498db; /* Blue */
}
.action-btn.btn-secondary:hover {
    background-color: #2980b9; /* Darker Blue */
}

.action-btn.btn-danger {
    background-color: var(--danger-color);
}
.action-btn.btn-danger:hover {
    background-color: var(--danger-hover);
}

.action-btn.btn-icon {
    padding: 8px;
    width: 38px;
    height: 38px;
}

.action-btn.dirty {
    background-color: #3498db; /* A blue color to indicate "unsaved changes" */
}
.action-btn.dirty:hover {
    background-color: #2980b9;
}

.table-container-scrollable {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--background-secondary);
    box-shadow: 0 1px 3px var(--shadow-color);
    border-radius: 8px;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table thead th {
    background-color: var(--background-primary);
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10; /* Ensure header is above the content */
    text-align: center;
    border-right: 1px solid var(--border-color);
}

.data-table thead th:last-child {
    border-right: none;
}

/* Only hide bottom border on last row on desktop — on mobile, td:last-child handles this per-card */
@media (min-width: 769px) {
    .data-table tbody tr:last-child td {
        border-bottom: none;
    }
}

.data-table tbody tr:hover {
    background-color: var(--background-primary);
}

/* Gentle width hints for specific columns - DESKTOP ONLY */
@media (min-width: 769px) {
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) { /* Client */
        width: 12%;
    }
    .data-table th:nth-child(7),
    .data-table td:nth-child(7) { /* Status */
        width: 8%;
    }
    .data-table th:nth-child(8),
    .data-table td:nth-child(8) { /* Sent At */
        width: 10%;
    }
    .data-table th:nth-child(9),
    .data-table td:nth-child(9) { /* Expiry Date */
        width: 10%;
    }

    /* User Management Specific Widths */
    .users-table th:nth-child(1), .users-table td:nth-child(1) { width: 25%; } /* Full Name */
    .users-table th:nth-child(2), .users-table td:nth-child(2) { width: 25%; } /* Email */
    .users-table th:nth-child(3), .users-table td:nth-child(3) { width: 10%; text-align: center; } /* Role */
    .users-table th:nth-child(4), .users-table td:nth-child(4) { width: 15%; text-align: center; } /* Created At */
    .users-table th:nth-child(5), .users-table td:nth-child(5) { width: 24%; text-align: center; white-space: nowrap; } /* Last Login */
}

#record-table-container {
    max-height: 65vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Keep the yellow background on hover for duplicate rows, but make it slightly darker */
.data-table tbody tr.duplicate-row:hover {
    background-color: #ffeeba; 
}

.actions-cell {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.actions-cell .action-btn {
    padding: 5px 10px;
}

.actions-cell .delete {
    background-color: var(--danger-color);
}
    .actions-cell .delete:hover { background-color: var(--danger-hover); }

/* Shrink last column (Actions) on desktop only */
@media (min-width: 769px) {
    .data-table th:last-child,
    .data-table td:last-child {
        width: 1%;
        white-space: nowrap;
    }
}

/* Responsive Stacking Table */
@media (max-width: 768px) {
    .data-table thead {
        display: none;
    }
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }
    .data-table {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        padding: 0 8px;
        box-sizing: border-box;
    }
    .data-table tr {
        margin-bottom: 24px;
        border: none;
        border-radius: 8px;
        overflow: hidden;
        background-color: var(--background-secondary);
        box-shadow: inset 0 0 0 1px var(--border-color);
    }
    /* Pastikan warna teks selalu terbaca di mode kartu */
    .data-table tr {
        color: var(--text-primary);
    }
    /* Pulihkan background kuning duplicate-row yang kalah spesifisitas */
    .data-table tr.duplicate-row {
        background-color: #fff3cd;
        color: #212529;
    }

    .data-table td {
        display: flex;
        /* justify-content: space-between; <--- REMOVED to fix alignment */
        align-items: center; /* Vertically centers them */
        padding: 10px 15px;
        border-bottom: 1px solid var(--border-color);
    }
    .data-table td:last-child {
        border-bottom: none;
    }
    .data-table td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        margin-right: 20px;
        flex-shrink: 0;
        min-width: 80px; /* Consistent minimum width for all labels */
    }

    /* Wrapper for simple text content */
    .cell-content {
        flex-grow: 1;
        text-align: right;
    }

    /* Special wrapper for Name + History */
    .name-history-wrapper {
        display: flex;
        flex-direction: column;
        align-items: flex-end; /* align-items for vertical flex */
        flex-grow: 1;
    }

    /* Special wrapper for Action Buttons */
    .actions-cell {
        display: flex;
        flex-grow: 1;
        justify-content: flex-end; /* justify-content for horizontal flex */
        gap: 10px;
    }

    /* Special wrapper for Radio Buttons */
    .duplicate-choice {
        display: flex;
        flex-grow: 1;
        justify-content: flex-end; /* justify-content for horizontal flex */
        gap: 15px;
    }

    /* Restore proper flex spacing for mobile table cells */
    .data-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100%; /* Natural flow, no !important needed */
        text-align: left;
    }

    /* Reset header widths just in case, though headers are hidden in mobile */
    .data-table th {
        width: 100%;
    }

    .data-table td::before {
        /* Ensure label stays on the left */
        flex-shrink: 0; 
        margin-right: 15px;
        text-align: left;
    }

    .data-table td .cell-content {
        /* Ensure content pushes to the right but wraps if needed */
        text-align: right;
        flex-grow: 1;
        justify-content: flex-end;
        display: flex; 
        flex-wrap: wrap;
    }
}

/* === SESSION FORM STYLES === */
.session-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.session-form .form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .session-form .form-grid-2col {
        grid-template-columns: 1fr;
    }
}

.session-form .form-actions {
    margin-top: 20px;
    text-align: right;
}

.form-warning {
    background-color: #fff3cd;
    color: #664d03;
    padding: 10px;
    border-radius: 4px;
    margin-top: 5px;
    font-size: 0.9em;
    border: 1px solid #ffecb5;
}

.form-container {
    max-width: 900px;
    margin: 0 auto; /* Center the container */
}

.form-group-date input[type="date"] {
    max-width: 250px;
}

/* === ALLOCATION PAGE STYLES === */
.allocation-container {
    display: flex;
    gap: 20px;
    height: 60vh; /* Reduced height for desktop to account for new header */
}
.client-list-panel, .package-list-panel {
    background-color: var(--background-secondary);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow-color);
    display: flex;
    flex-direction: column;
}
.client-list-panel {
    flex-basis: 30%;
    min-width: 250px;
}
.package-list-panel {
    flex-basis: 70%;
}
#client-filter {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.client-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}
.client-list-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}
.client-list-item:last-child {
    border-bottom: none;
}
.client-list-item:hover {
    background-color: var(--background-primary);
}
.client-list-item.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}
#package-checklist {
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}
.package-actions {
    text-align: right;
    margin-bottom: 10px;
}
.link-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: 0.9em;
}
.link-btn:hover {
    color: var(--primary-hover);
}
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

/* Styles for preview table */
.duplicate-row {
    background-color: #fff3cd; /* Light yellow to draw attention */
    color: #212529; /* Darker text for high contrast */
}

.history-info {
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
    margin-top: 4px;
}

.preview-container {
    max-width: 1200px;
    margin: 0 auto;
}

#assignment-area {
    margin-top: 30px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.duplicate-choice {
    display: flex;
    flex-direction: row; /* Align radio buttons horizontally */
    align-items: center;
    gap: 15px; /* Add space between radio buttons */
}

.duplicate-choice .radio-group {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}
.badge {
    display: inline-block;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge.new {
    background-color: #27ae60; /* Green */
}
.badge.duplicate {
    background-color: #e67e22; /* Orange */
}

/* Status Badges */
.badge.status-assigned {
    background-color: #3498db; /* Blue */
}
.badge.status-selfie_uploaded {
    background-color: #9b59b6; /* Purple */
}
.badge.status-in_progress {
    background-color: #f1c40f; /* Yellow */
    color: #333; /* Darker text for yellow badge */
}
.badge.status-completed {
    background-color: #2ecc71; /* Green */
}
.badge.status-cancelled {
    background-color: var(--danger-color); /* Red */
}
.badge.status-archived {
    background-color: #95a5a6; /* Gray */
}

/* Styles for assignment form */
.assignment-groups {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background-color: var(--background-color);
}
.assignment-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}
.assignment-group-row:last-child {
    border-bottom: none;
}
.position-label {
    flex-basis: 50%;
}
.package-selector {
    flex-basis: 50%;
}
.package-selector select {
    width: 100%;
}

@media (max-width: 768px) {
    .assignment-group-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .position-label, .package-selector {
        flex-basis: auto;
        width: 100%;
    }
}
.checkbox-group input {
    margin-right: 10px;
}

@media (max-width: 768px) {
    #page-title {
        font-size: 1.5rem; /* Reduce title font size on mobile */
        margin-top: 0; /* Adjust margin for tighter look */
    }
    .allocation-container {
        flex-direction: column;
        height: calc(100vh - 200px); /* Increased subtraction for mobile */
    }
    .client-list-panel {
        min-width: unset;
        flex-basis: 40%; /* 40% of the container height */
        display: flex;
        flex-direction: column;
    }
    .package-list-panel {
        min-height: unset;
        flex-basis: 60%; /* 60% of the container height */
        display: flex;
        flex-direction: column;
    }
    .client-list {
        overflow-y: auto; /* Make only the list scrollable */
    }
    #package-checklist {
        overflow-y: auto; /* Make only the checklist scrollable */
        flex-grow: 1;
    }
}

/* === RECORD PAGE STYLES === */

.record-page-container {

    max-width: 1600px; /* Give it a generous max-width */

    margin: 0 auto; /* Center the container */

}



/* === RECORD PAGE FILTERS === */
.record-filters {
    display: flex;
    width: 100%;
    gap: 15px; 
}

.record-filters select,
.record-filters input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-secondary);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .record-filters {
        flex-direction: column; /* Stack them vertically on mobile */
    }

    .record-filters select,
    .record-filters input,
    .record-filters button {
        width: 100%; /* Make each filter full-width on mobile */
        margin: 0;   /* Override browser-default margins that vary on disabled elements */
    }
}

/* Custom color for Resend button */
.actions-cell .action-btn.resend-email {
    background-color: #ffc107; /* Yellow */
    color: #333;
}

.actions-cell .action-btn.resend-email:hover {
    background-color: #e0a800; /* Darker Yellow */
}

/* === HYBRID STATUS DISPLAY (TOOLTIP + MULTI-BADGE) === */

/* The main container for the status cell content */
.status-container {
    position: relative; /* Crucial for positioning the tooltip */
    display: inline-block; /* Or 'block' depending on desired layout */
}

/* The detailed tooltip, hidden by default on all screen sizes */
.status-tooltip {
    display: none;
    position: absolute;
    bottom: 100%; /* Position it above the main badge */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 10px;
    border-radius: 6px;
    z-index: 10;
    width: max-content; /* Make it as wide as its content */
    margin-bottom: 5px; /* Space between badge and tooltip */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: left;
}

.status-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip-item {
    display: block;
    margin-bottom: 4px;
}
.tooltip-item:last-child {
    margin-bottom: 0;
}

/* The container for mobile badges, hidden by default on desktop */
.status-badges-mobile {
    display: none;
    flex-direction: column;
    align-items: flex-end; /* Align to the right in mobile view */
    gap: 5px;
}

/* --- Desktop-specific behavior --- */
@media (min-width: 769px) {
    /* Show the tooltip on hover */
    .status-container:hover .status-tooltip {
        display: block;
    }
}

/* --- Mobile-specific behavior --- */
@media (max-width: 768px) {
    /* Hide the main, single status badge */
    .status-container .badge-primary {
        display: none;
    }
        /* Show the container with multiple badges */
        .status-badges-mobile {
            display: flex;
        }
}
    
/* === MODAL STYLES (ENHANCED) === */
.modal {
    /* ... existing styles ... */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-content {
    /* ... existing styles ... */
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content form .form-group {
    margin-bottom: 20px;
}

.modal-content form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

/* Generic button styles for modals */
.modal-content .btn-primary,
.modal-content .btn-secondary,
.modal-content .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    width: 180px;
    text-align: center;
}

.modal-content .btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.modal-content .btn-primary:hover {
    background-color: var(--primary-hover);
}

.modal-content .btn-secondary {
    background-color: #bdc3c7; /* Light gray */
    color: var(--text-primary);
}
.modal-content .btn-secondary:hover {
    background-color: #95a5a6; /* Darker gray */
}

.modal-content .btn-danger {
    background-color: var(--danger-color);
    color: white;
}
    .modal-content .btn-danger:hover {
        background-color: var(--danger-hover);
    }
    
    /* Utility class for smaller modals */
    .modal-content.modal-sm {
        max-width: 380px;
    }
    
    /* Center specific table columns */
    .data-table td[data-label="Expiry Date"],
    .data-table td[data-label="Actions"] {    text-align: center;
}


@media (prefers-color-scheme: dark) {
    :root {
        --background-primary: #1a1a1a;
        --background-secondary: #252525;
        --text-primary: #e0e0e0;
        --text-secondary: #bbbbbb;
        --header-bg: #212121;
        --header-text: #e0e0e0;
        --border-color: #444444;
        --primary-color: #FF7A1A;
        --primary-hover: #FF6B00;
        --danger-color: #ff4444;
        --danger-hover: #cc0000;
        --shadow-color: rgba(255,255,255,0.05);
    }

    /* Fix for secondary button text color in dark mode */
    .modal-content .btn-secondary {
        background-color: var(--border-color); /* Darker gray background */
        color: var(--text-primary); /* Standard light text */
    }
}

/* --- Autocomplete Component --- */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    max-height: 150px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.autocomplete-suggestions div {
    padding: 10px;
    cursor: pointer;
    color: var(--text-primary);
}

.autocomplete-suggestions div:hover {
    background-color: var(--primary-color);
    color: white;
}

.autocomplete-suggestions .no-suggestions {
    padding: 10px;
    color: var(--text-secondary);
    cursor: default;
    font-style: italic;
}

.autocomplete-suggestions .no-suggestions:hover {
    background-color: transparent;
    color: var(--text-secondary);
}

.autocomplete-suggestions div.autocomplete-active {
    background-color: var(--primary-color);
    color: white;
}

/* Spacing for the checkmark icon in batch preview */
.suggestion-tick-icon {
    margin-left: 8px;
    color: #28a745; /* Green for success */
}

/* --- Batch Preview Suggestion Styles --- */
.position-status-suggest {
    display: flex;
    flex-direction: column; /* Mobile-first: stack vertically */
    align-items: flex-end; /* Align to the right to match other table cells on mobile */
    gap: 8px;
    width: 100%;
}

.original-pos {
    font-size: 0.9em;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.suggestion-text {
    font-weight: bold;
}

.suggestion-actions {
    display: flex;
    gap: 8px;
}

/* Use a more subtle color for the edit button */
.suggestion-actions .edit-suggestion {
    background-color: #7f8c8d; /* Asbestos */
}
.suggestion-actions .edit-suggestion:hover {
    background-color: #95a5a6; /* Wetasphalt */
}


/* On larger screens, switch to a horizontal layout */
@media (min-width: 769px) {
    .position-status-suggest {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* --- Final Polish for Batch Preview (V2) --- */

/* Helper class to fix autocomplete being clipped in a scrollable table */
.table-container-scrollable.overflow-visible {
    overflow-y: visible !important;
}

/* === MOBILE FIXED HEADER === */
@media (max-width: 768px) {
    .main-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1001; /* Higher than the nav and overlay */
    }

    .main-content {
        /* 60px header height + 20px original top padding */
        padding-top: 80px;
    }
}

/* === TAGIHAN PENDING — Badge Status === */
.billing-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
}

.billing-badge.telegram-waiting {
    background-color: #fff3cd;
    color: #856404;
}

.billing-badge.telegram-none {
    background-color: var(--border-color);
    color: var(--text-secondary);
}

.billing-badge.billing-paid {
    background-color: #d1fae5;
    color: #065f46;
}
