/* ========================================
   LatePoint Advanced Filter - Column Visibility & Sorting
   shadcn UI Inspired - v4.3
   ======================================== */

/* shadcn/ui inspired color system */
:root {
    /* Primary colors - based on shadcn slate */
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    
    --radius: 0.5rem;
    
    /* Custom additions */
    --success: 142.1 76.2% 36.3%;
    --warning: 38 92% 50%;
    --info: 221.2 83.2% 53.3%;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* ========================================
   CONTAINER & LAYOUT - 1200px MAX WIDTH
   ======================================== */

.latepoint-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    padding-bottom: 5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========================================
   HIDDEN ELEMENTS - Bulk, Search, Stats, Export
   ======================================== */

.latepoint-stats,
.bulk-actions-bar,
.search-bar,
#export-csv-btn,
#toggle-stats {
    display: none !important;
}

/* ========================================
   FILTER FORM
   ======================================== */

.latepoint-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.5rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    align-items: center;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.latepoint-filter-form label {
    font-weight: 500;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.latepoint-filter-form input,
.latepoint-filter-form select {
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--input));
    font-size: 0.875rem;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: all 0.2s ease;
}

.latepoint-filter-form input:focus,
.latepoint-filter-form select:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsla(var(--ring), 0.2);
}

/* ========================================
   QUICK SEARCH BAR - Instant Lookup
   ======================================== */

.quick-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #38bdf8;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: 0 -4px 16px rgba(56, 189, 248, 0.25);
    transition: all 0.3s ease;
    position: fixed;
    bottom: 0;
    left: 30%;
    right: 0;
    z-index: 9999;
}

.quick-search-bar:focus-within {
    border-color: #0284c7;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
    background: linear-gradient(135deg, #f0f9ff 0%, #dbeafe 100%);
}

.quick-search-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.quick-search-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid #bae6fd;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.9375rem;
    background: #ffffff;
    color: #0c4a6e;
    transition: all 0.2s ease;
    font-weight: 500;
}

.quick-search-input::placeholder {
    color: #7dd3fc;
    font-weight: 400;
    font-size: 0.875rem;
}

.quick-search-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.quick-search-input.is-searching {
    background: #f0f9ff url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%230284c7" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>') no-repeat right 10px center;
    background-size: 18px;
    animation: search-pulse 1s ease-in-out infinite;
}

@keyframes search-pulse {
    0%, 100% { border-color: #38bdf8; }
    50% { border-color: #0284c7; }
}

.quick-search-status {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.quick-search-status.hint {
    color: #7dd3fc;
}

.quick-search-status.searching {
    color: #0284c7;
    animation: status-blink 1s ease-in-out infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.quick-search-status.found {
    color: #059669;
    background: rgba(5, 150, 105, 0.1);
}

.quick-search-status.not-found {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.quick-search-clear {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 0.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.quick-search-clear:hover {
    color: #dc2626;
    transform: scale(1.2);
}

/* Responsive quick search */
@media (max-width: 768px) {
    .quick-search-bar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
    }
    
    .quick-search-input {
        width: 100%;
        order: 1;
        font-size: 0.875rem;
    }
    
    .quick-search-icon {
        order: 0;
    }
    
    .quick-search-status {
        order: 2;
        min-width: auto;
    }
    
    .quick-search-clear {
        order: 3;
    }
}

/* ========================================
   COLUMN VISIBILITY PANEL - NEW
   ======================================== */

.column-visibility-panel {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.column-visibility-panel .panel-header {
    margin-bottom: 0.75rem;
}

.column-visibility-panel .panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.visibility-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.visibility-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #495057;
    user-select: none;
}

.visibility-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007bff;
}

.visibility-checkbox:hover {
    color: #212529;
}

.visibility-checkbox span {
    font-weight: 500;
}

/* ========================================
   BUTTONS - shadcn style
   ======================================== */

.filter-button,
.update-button,
.cancel-dob-btn,
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-button {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.filter-button:hover {
    background: hsl(var(--primary) / 0.9);
    box-shadow: var(--shadow);
}

.filter-button.active {
    background: hsl(var(--foreground));
    color: hsl(var(--background));
}

.cancel-dob-btn {
    background-color: hsl(var(--destructive));
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.cancel-dob-btn:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.action-btn {
    padding: 0.5rem;
    font-size: 1rem;
    background: transparent;
    color: hsl(var(--muted-foreground));
    border: 1px solid hsl(var(--border));
}

.action-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    border-color: hsl(var(--ring));
}

.gcal-btn:hover {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.gcal-btn.gcal-copied {
    background: #e8f5e9;
    border-color: #4caf50;
}

/* ========================================
   RESULTS HEADER
   ======================================== */

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 0.75rem;
}

.results-count {
    font-weight: 600;
    color: hsl(var(--foreground));
    font-size: 1rem;
}

/* ========================================
   TABLE - shadcn inspired with SORTABLE columns
   ======================================== */

.latepoint-table {
    width: 100%;
    border-collapse: collapse;
    background: hsl(var(--card));
    font-size: 0.875rem;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid hsl(var(--border));
}

.latepoint-table th,
.latepoint-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
}

.latepoint-table th {
    background: hsl(var(--muted));
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
    position: sticky;
    top: 0;
    z-index: 10;
}

/* SORTABLE column styles */
.latepoint-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2rem;
}

.latepoint-table th.sortable:hover {
    background: #e9ecef;
    color: #212529;
}

.latepoint-table th.sortable .sort-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    opacity: 0.4;
}

.latepoint-table th.sortable .sort-icon::before {
    content: '⇅';
}

.latepoint-table th.sortable.asc .sort-icon::before {
    content: '↑';
    opacity: 1;
    color: #007bff;
}

.latepoint-table th.sortable.desc .sort-icon::before {
    content: '↓';
    opacity: 1;
    color: #007bff;
}

.latepoint-table tbody tr {
    transition: all 0.15s ease;
}

.latepoint-table tbody tr:hover {
    background: hsl(var(--muted) / 0.5);
}

.latepoint-table tbody tr.highlight-row {
    background: hsl(var(--warning) / 0.1);
    animation: highlightFade 1.5s ease;
}

@keyframes highlightFade {
    0%, 100% { background: hsl(var(--warning) / 0.1); }
    50% { background: hsl(var(--warning) / 0.3); }
}

.latepoint-table tbody tr.has-duplicate {
    border-left: 3px solid hsl(var(--warning));
}

/* Table column specific */
.col-name {
    min-width: 150px;
}

.col-ws {
    min-width: 100px;
}

.col-availability {
    min-width: 150px;
}

.col-birth-details {
    min-width: 200px;
}

.actions-cell {
    white-space: nowrap;
}

/* ========================================
   BIRTH DETAILS - SINGLE LINE DISPLAY
   ======================================== */

.birth-details-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
}

.birth-details-cell .birth-date,
.birth-details-cell .birth-time,
.birth-details-cell .birth-place {
    display: inline;
    padding: 2px 4px;
    margin: 0;
}

.birth-separator {
    color: hsl(var(--muted-foreground));
    margin: 0 0.5rem;
    font-weight: 300;
    pointer-events: none;
}

.empty-value {
    color: hsl(var(--muted-foreground));
    font-style: italic;
}

/* ========================================
   EDITABLE FIELDS - ALL FIELDS NOW EDITABLE
   ======================================== */

.editable-field {
    position: relative;
    padding: 0.375rem 0.5rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: text;
    min-height: 1.5em;
}

.editable-field:hover {
    border-color: hsl(var(--border));
    background: hsl(var(--accent) / 0.3);
}

.editable-field:focus {
    outline: none;
    border-color: hsl(var(--ring));
    background: hsl(var(--background));
    box-shadow: 0 0 0 2px hsla(var(--ring), 0.1);
}

.editable-field:empty:before {
    content: attr(placeholder);
    color: hsl(var(--muted-foreground));
    font-style: italic;
    opacity: 0.6;
}

/* Editable field states */
.editable-field.saving {
    opacity: 0.6;
    pointer-events: none;
    background: hsl(var(--muted));
}

.editable-field.saving::after {
    content: " ⏳";
}

.editable-field.saved {
    background: hsl(var(--success) / 0.1);
    border-color: hsl(var(--success));
    animation: savedBlink 1s ease;
}

@keyframes savedBlink {
    0%, 100% { 
        background: hsl(var(--success) / 0.05);
        border-color: hsl(var(--border));
    }
    50% { 
        background: hsl(var(--success) / 0.2);
        border-color: hsl(var(--success));
    }
}

/* Specific cell styling */
.availability-cell {
    min-width: 120px;
}

.questions-cell,
.life-events-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   STATUS DROPDOWN
   ======================================== */

.status-update {
    padding: 0.375rem 0.5rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid hsl(var(--border));
    font-size: 0.875rem;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-update:hover {
    border-color: hsl(var(--ring));
}

.status-update:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsla(var(--ring), 0.1);
}

/* ========================================
   WHATSAPP LINK
   ======================================== */

.whatsapp-cell {
    padding: 8px !important;
}

.booking-id {
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.whatsapp-link {
    color: #25D366;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
}

.whatsapp-link:hover {
    color: #128C7E;
    text-decoration: underline;
    transform: translateX(2px);
}

/* ========================================
   DUPLICATES
   ======================================== */

.duplicate-warning {
    color: #fd7e14;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.duplicate-time {
    color: #6c757d;
    font-size: 0.75rem;
    margin: 0.25rem 0;
}

/* ========================================
   LOADING INDICATOR
   ======================================== */

.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    text-align: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid #dee2e6;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    margin: 0;
    color: #212529;
    font-weight: 500;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #ffffff;
    color: #212529;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid #6c757d;
    min-width: 250px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #28a745;
}

.toast-error {
    border-left-color: #dc3545;
}

.toast-warning {
    border-left-color: #ffc107;
}

.toast-info {
    border-left-color: #007bff;
}

/* ========================================
   MODAL
   ======================================== */

.modal {
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-top: 0;
    color: #212529;
    font-size: 1.25rem;
}

.modal-close {
    float: right;
    font-size: 1.75rem;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #212529;
}

#notes-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 1rem 0;
}

.note-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: calc(var(--radius) - 4px);
    margin-bottom: 0.75rem;
    border-left: 3px solid #007bff;
}

.note-meta {
    color: #6c757d;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.note-text {
    color: #212529;
    white-space: pre-wrap;
}

.no-notes {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
}

#new-note-text {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: calc(var(--radius) - 4px);
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 1rem;
}

#new-note-text:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ========================================
   NO RESULTS
   ======================================== */

.no-results {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #f8f9fa;
    border-radius: var(--radius);
    border: 1px dashed #dee2e6;
}

.no-results p {
    margin: 0;
    color: #6c757d;
    font-size: 1rem;
}

/* ========================================
   TABLE WRAPPER - HORIZONTAL SCROLL
   ======================================== */

.latepoint-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .latepoint-container {
        padding: 1rem;
    }
    
    .latepoint-filter-form {
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .latepoint-filter-form label {
        width: 100%;
    }
    
    .latepoint-filter-form input,
    .latepoint-filter-form select {
        width: 100%;
    }
    
    .column-visibility-panel {
        padding: 0.75rem 1rem;
    }
    
    .visibility-controls {
        gap: 1rem;
    }
    
    .latepoint-table {
        font-size: 0.75rem;
    }
    
    .latepoint-table th,
    .latepoint-table td {
        padding: 0.5rem;
    }
    
    .birth-details-cell {
        max-width: 250px;
    }
    
    .modal-content {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .latepoint-container {
        padding: 0.5rem;
    }
    
    .latepoint-filter-form {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .visibility-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .results-count {
        font-size: 0.875rem;
    }
    
    .latepoint-table {
        font-size: 0.7rem;
    }
    
    .birth-details-cell {
        max-width: 150px;
        white-space: normal;
    }
    
    /* Stack birth details on very small screens */
    .birth-details-cell .birth-date,
    .birth-details-cell .birth-time,
    .birth-details-cell .birth-place {
        display: block;
    }
    
    .birth-separator {
        display: none;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .latepoint-table {
        min-width: 900px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .latepoint-filter-form,
    .column-visibility-panel,
    .action-btn,
    .filter-button,
    #toast-container,
    .modal {
        display: none !important;
    }
    
    .latepoint-table {
        box-shadow: none;
        font-size: 10pt;
    }
    
    .latepoint-table tr {
        page-break-inside: avoid;
    }
    
    .extra-col,
    .col-questions,
    .col-events,
    .col-appointment,
    .col-actions {
        display: table-cell !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

*:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: 0 0% 20%;
    }
    
    .latepoint-table th,
    .latepoint-table td {
        border: 2px solid hsl(var(--border));
    }
}

/* ========================================
   LIGHT MODE IMPROVEMENTS
   Better visibility on light backgrounds
   ======================================== */

/* Force better contrast for light backgrounds */
.latepoint-container {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
}

/* Ensure text is always readable */
.latepoint-table {
    background: #ffffff;
    color: #1a1a1a;
}

.latepoint-table th {
    background: #f8f9fa;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.latepoint-table td {
    color: #212529;
    border-bottom: 1px solid #dee2e6;
}

.latepoint-table tbody tr:hover {
    background: #f8f9fa;
}

/* Filter form visibility */
.latepoint-filter-form {
    background: #ffffff;
    border: 1px solid #dee2e6;
    color: #212529;
}

.latepoint-filter-form label {
    color: #212529;
}

.latepoint-filter-form input,
.latepoint-filter-form select {
    background: #ffffff;
    color: #212529;
    border: 1px solid #ced4da;
}

.latepoint-filter-form input::placeholder {
    color: #6c757d;
}

/* Editable fields visibility */
.editable-field {
    color: #212529;
}

.editable-field:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.editable-field:focus {
    background: #ffffff;
    border-color: #80bdff;
}

.editable-field:empty:before {
    color: #6c757d;
}

/* Birth details visibility */
.birth-separator {
    color: #6c757d;
}

.empty-value {
    color: #6c757d;
}

/* Status dropdown */
.status-update {
    background: #ffffff;
    color: #212529;
    border: 1px solid #ced4da;
}

/* WhatsApp link - see main WHATSAPP LINK section above for all styles */

/* Buttons */
.action-btn {
    background: #ffffff;
    color: #495057;
    border: 1px solid #ced4da;
}

.action-btn:hover {
    background: #f8f9fa;
    color: #212529;
    border-color: #495057;
}

/* Duplicates */
.duplicate-warning {
    color: #fd7e14;
    font-weight: 600;
}

.duplicate-time {
    color: #6c757d;
}

/* Results count */
.results-count {
    color: #212529;
}

/* Modal */
.modal-content {
    background: #ffffff;
    color: #212529;
    border: 1px solid #dee2e6;
}

.modal-content h3 {
    color: #212529;
}

.note-item {
    background: #f8f9fa;
    border-left: 3px solid #007bff;
}

.note-text {
    color: #212529;
}

.note-meta {
    color: #6c757d;
}

#new-note-text {
    background: #ffffff;
    color: #212529;
    border: 1px solid #ced4da;
}

/* No results */
.no-results {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
}

.no-results p {
    color: #6c757d;
}

/* Loading indicator - ensure visibility on all backgrounds */
.loading-indicator {
    background: rgba(255, 255, 255, 0.95);
}

.loading-indicator p {
    color: #212529;
}

.spinner {
    border-color: #dee2e6;
    border-top-color: #007bff;
}

/* ========================================
   CONTRAST ENHANCEMENTS
   ======================================== */

/* High contrast for better readability */
.latepoint-table tbody tr.has-duplicate {
    border-left: 4px solid #fd7e14;
    background: rgba(253, 126, 20, 0.05);
}

.latepoint-table tbody tr.highlight-row {
    background: rgba(255, 193, 7, 0.15) !important;
    animation: highlightFadeBright 1.5s ease;
}

@keyframes highlightFadeBright {
    0%, 100% { background: rgba(255, 193, 7, 0.15); }
    50% { background: rgba(255, 193, 7, 0.3); }
}

/* Editable field states - high visibility */
.editable-field.saving {
    background: #e9ecef !important;
    opacity: 0.7;
}

.editable-field.saved {
    background: rgba(40, 167, 69, 0.15) !important;
    border-color: #28a745 !important;
}

/* Focus states - clear indication */
.latepoint-filter-form input:focus,
.latepoint-filter-form select:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

.editable-field:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15) !important;
}

/* Status dropdown - clear visibility */
.status-update:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

#new-note-text:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* Ensure all interactive elements have good contrast */
.filter-button {
    background: #007bff !important;
    color: #ffffff !important;
}

.filter-button:hover {
    background: #0056b3 !important;
}

.filter-button.active {
    background: #343a40 !important;
    color: #ffffff !important;
}

/* ========================================
   ENHANCED FRAUD DETECTION SYSTEM - V5
   ======================================== */

/* Fraud Detection Legend */
.fraud-detection-legend {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    color: white;
    box-shadow: var(--shadow-lg);
}

.fraud-detection-legend h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-icon {
    font-size: 1.25rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.legend-icon.fraud-risk {
    animation: pulse-alert 2s ease-in-out infinite;
}

@keyframes pulse-alert {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Row highlighting based on duplicate type */
.fraud-risk-row {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.08) 0%, transparent 100%) !important;
    border-left: 4px solid #dc2626 !important;
}

.fraud-risk-row:hover {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.12) 0%, transparent 100%) !important;
}

.rebooking-row {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%) !important;
    border-left: 4px solid #3b82f6 !important;
}

.rebooking-row:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, transparent 100%) !important;
}

/* Duplicate sections container */
.duplicates-cell {
    max-width: 400px;
    padding: 0.75rem !important;
}

.duplicate-section {
    margin-bottom: 0.75rem;
    border-radius: 6px;
    overflow: hidden;
}

.duplicate-section:last-child {
    margin-bottom: 0;
}

/* DOB Fraud Section - RED WARNING */
.dob-fraud-section {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #dc2626;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.15);
}

.duplicate-header {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.fraud-header {
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    color: white;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
}

/* DOB Duplicate Item */
.duplicate-dob-item {
    padding: 0.625rem 0.75rem;
    background: white;
    border-bottom: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    transition: all 0.2s ease;
}

.duplicate-dob-item:last-child {
    border-bottom: none;
}

.duplicate-dob-item:hover {
    background: #fff5f5;
    transform: translateX(2px);
}

.duplicate-dob-item.cancelled {
    opacity: 0.5;
    background: #fafafa;
    text-decoration: line-through;
}

.duplicate-dob-item.dob-time-mismatch {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    animation: warning-pulse 2s ease-in-out infinite;
}

@keyframes warning-pulse {
    0%, 100% { border-left-color: #f59e0b; }
    50% { border-left-color: #dc2626; }
}

.dupe-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #991b1b;
    background: rgba(220, 38, 38, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.dupe-name {
    font-weight: 500;
    color: #374151;
    font-size: 0.8125rem;
}

.dupe-status {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.dupe-status.status-approved {
    background: #fef3c7;
    color: #92400e;
}

.dupe-status.status-cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

.dupe-status.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.dupe-status.status-no_show {
    background: #fee2e2;
    color: #991b1b;
}

.time-mismatch-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    animation: badge-flash 1.5s ease-in-out infinite;
}

@keyframes badge-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.cancel-dob-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
    margin-left: auto;
}

.cancel-dob-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(220, 38, 38, 0.4);
}

.cancel-dob-btn:active {
    transform: scale(0.98);
}

.cancel-dob-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Customer Rebooking Section - BLUE INFO */
.customer-rebooking-section {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

.rebooking-header {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
}

.customer-duplicate-item {
    padding: 0.5rem 0.75rem;
    background: white;
    border-bottom: 1px solid #bfdbfe;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.customer-duplicate-item:last-child {
    border-bottom: none;
}

.customer-duplicate-item:hover {
    background: #eff6ff;
}

.dupe-date {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #1e40af;
    background: rgba(59, 130, 246, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.dupe-time {
    font-weight: 500;
    color: #374151;
    font-size: 0.75rem;
}

.time-gap {
    background: #f0f9ff;
    color: #0369a1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

/* No Duplicates - Clean Status */
.no-duplicates {
    color: #059669;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Responsive design for duplicate sections */
@media (max-width: 768px) {
    .duplicate-section {
        font-size: 0.75rem;
    }
    
    .duplicate-dob-item,
    .customer-duplicate-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cancel-dob-btn {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .time-gap {
        margin-left: 0;
    }
}

/* Print styles for fraud reports */
@media print {
    .fraud-risk-row {
        border-left: 4px solid #000 !important;
        background: #f3f4f6 !important;
    }
    
    .cancel-dob-btn {
        display: none;
    }
    
    .dob-fraud-section {
        border: 2px solid #000 !important;
        background: white !important;
    }
    
    .fraud-header {
        background: #000 !important;
        color: white !important;
    }
}
