/* General Styles & Variables */
:root {
    --apple-blue: #007AFF;
    --apple-green: #34C759;
    --apple-yellow: #FFCC00;
    --apple-orange: #FF9500;
    --warning-red: #FF3B30;
    --light-gray: #F2F2F7;
    --medium-gray: #E5E5EA;
    --dark-gray: #8A8A8E;
    --pure-black: #000000;
    --pure-white: #FFFFFF;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --highlight-blue: #F0F7FF;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light-gray);
    color: var(--pure-black);
}

.h1-gradient {
    background: linear-gradient(180deg, #333333 0%, #000000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

.card {
    background-color: white;
    border-radius: 1.25rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--medium-gray);
}

.filter-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(229, 229, 234, 0.8);
    border-radius: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    overflow-y: auto; 
    max-height: 70vh;
    transition: opacity 0.2s ease-in-out;
}

.table-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

.picks-table {
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #6B7280;
    min-width: 800px;
}

.picks-table.simple-view {
    min-width: initial;
}

.picks-table thead {
    position: sticky;
    top: 0; 
    z-index: 10;
}

.picks-table th,
.picks-table td {
    padding: 0.75rem 1rem;
    border-bottom-width: 1px;
    border-color: #E5E7EB;
}

.picks-table th {
    font-size: 0.75rem;
    line-height: 1rem;
    text-transform: uppercase;
    color: #374151;
    background-color: #F9FAFB;
    font-weight: 600;
    white-space: nowrap;
}

.picks-table thead th {
    background-color: white; 
    border-bottom-width: 2px;
    border-color: #E5E7EB;
}


.picks-table tbody tr:last-child td {
    border-bottom-width: 0;
}

.picks-table tbody tr {
    background-color: white;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);
    transition-duration: 150ms;
    /* Defer rendering of offscreen rows for large datasets */
    content-visibility: auto;
    contain-intrinsic-size: 53px; /* Approximate row height */
}

.picks-table tbody tr:hover {
    background-color: #F3F4F6;
}

/* Odds Color Coding */
.odds-positive {
    color: #047857;
    background-color: #D1FAE5;
    font-weight: 500;
    border-radius: 9999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    display: inline-block;
}
.odds-negative {
    color: #B91C1C;
    background-color: #FEE2E2;
    font-weight: 500;
    border-radius: 9999px;
    padding: 2px 8px;
    font-size: 0.8rem;
    display: inline-block;
}


/* Column Sorting Indicators */
.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.75rem !important;
}
.sortable:hover {
    color: var(--pure-black);
}
.sortable::after, .sortable::before {
    content: '';
    display: block;
    position: absolute;
    right: 0.75rem;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 4px 4px 4px;
    border-color: transparent transparent #cbd5e1 transparent;
}
.sortable::before {
    top: calc(50% - 7px);
    transform: rotate(180deg);
}
.sortable::after {
    top: calc(50% + 3px);
}
.sortable.sort-asc::before {
    border-color: transparent transparent #1f2937 transparent;
}
.sortable.sort-desc::after {
    border-color: transparent transparent #1f2937 transparent;
}


/* Pagination */
.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    width: 2.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #4B5563;
    background-color: white;
    border-width: 1px;
    border-color: #D1D5DB;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);
    transition-duration: 150ms;
}
.pagination-button:hover:not(:disabled) {
    background-color: #F9FAFB;
}
.pagination-button.active {
    background-color: var(--apple-blue);
    color: white;
    border-color: var(--apple-blue);
}
.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Simple/Advanced View Toggle */
.simple-view .advanced-col {
    display: none;
}

.view-toggle-btn {
    color: #6B7280;
    transition: all 0.2s ease-in-out;
}

.view-toggle-btn.active {
    background-color: white;
    color: #111827;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Modal & Dialog Styles */
dialog {
    border-radius: 1.25rem;
    border: 1px solid var(--medium-gray);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 42rem;
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Form & Input Styles */
.form-label {
    display: block;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #374151;
}

/* Custom Dropdown Styles */
.dropdown-menu {
    position: absolute;
    z-index: 50;
    top: 100%;
    margin-top: 0.25rem;
    max-height: 15rem;
    width: 100%;
    overflow: auto;
    border-radius: 0.75rem;
    background-color: #ffffff;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    line-height: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --tw-ring-color: rgba(0, 0, 0, 0.05);
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

.dropdown-option {
    color: #111827;
    position: relative;
    cursor: default;
    user-select: none;
    padding: 0.5rem 1rem;
}

.dropdown-option:hover {
    background-color: #F3F4F6;
}

/* CSV Import Specific Styles */
#csv-drop-zone.drag-over {
    border-color: var(--apple-blue);
    background-color: var(--highlight-blue);
}

#csv-preview-table-container td.cell-error {
    outline: 2px solid var(--warning-red);
    outline-offset: -1px;
}

/* --- NEW: TOAST NOTIFICATIONS --- */
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.toast {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    background-color: #333;
    color: white;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    animation: toast-in 0.3s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    min-width: 250px;
}

.toast.hiding {
    animation: toast-out 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.toast.toast-success { background-color: var(--apple-green); }
.toast.toast-error { background-color: var(--warning-red); }
.toast.toast-info { background-color: var(--apple-blue); }

.toast .material-symbols-outlined {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}
/* Mobile optimizations for tables */
@media (max-width: 1024px) {
    .picks-table {
        min-width: 700px;
        font-size: 0.8125rem;
    }
    .picks-table th,
    .picks-table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    .pagination-button {
        min-height: 44px;
        min-width: 44px;
    }
}

@media (max-width: 414px) {
    .picks-table {
        min-width: 600px;
        font-size: 0.75rem;
    }
    .picks-table th,
    .picks-table td {
        padding: 0.375rem 0.5rem;
    }
    button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Mobile-first responsive dialogs */
@media (max-width: 1024px) {
    dialog {
        width: calc(100vw - 2rem);
        max-width: none;
        margin: 1rem;
        border-radius: 1rem;
    }
}

@media (max-width: 414px) {
    dialog {
        width: 100vw;
        height: 100vh;
        max-width: none;
        margin: 0;
        border-radius: 0;
        border: none;
    }
    dialog::backdrop {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* Mobile Safe Popover */
@media (max-width: 640px) {
    .filter-popover {
        right: 0 !important;
        left: auto !important;
        transform: none !important;
        width: 300px;
        max-width: 92vw;
    }
}
