/* =============================================
   NUPTIAL FLIGHT TABLE STYLES
   ============================================= */

/* Table Wrapper & Rounded Borders */
.nuptial-table-wrapper {
    overflow-x: auto;
    position: relative;
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
}

.nuptial-flight-table {
    margin-bottom: 0;
    font-size: 0.88rem;
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    width: 100%;
}

/* Internal Cell Borders */
.nuptial-flight-table th,
.nuptial-flight-table td {
    border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}

.nuptial-flight-table th:last-child,
.nuptial-flight-table td:last-child {
    border-right: none;
}

.nuptial-flight-table tbody tr:last-child td {
    border-bottom: none;
}

/* Header Styling (Clean in both Light & Dark Mode) */
.nuptial-table-head th {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-heading-color);
    font-weight: 600;
    border-bottom: 2px solid var(--bs-border-color);
    vertical-align: middle;
}

[data-bs-theme="dark"] .nuptial-table-head th {
    background-color: #232b27;
    color: #d8e4de;
    border-color: #3a4f44;
}

/* Sticky First Column */
.nuptial-flight-table th.species-th,
.nuptial-flight-table td.name-column {
    position: sticky;
    left: 0;
    min-width: 180px;
    max-width: 250px;
}

.nuptial-flight-table th.species-th {
    z-index: 3;
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-heading-color);
    border-top-left-radius: 0.5rem;
}

[data-bs-theme="dark"] .nuptial-flight-table th.species-th {
    background-color: #232b27;
    color: #d8e4de;
}

.nuptial-flight-table td.name-column {
    z-index: 2;
    background-color: var(--bs-body-bg);
}

.nuptial-flight-table tr:hover td.name-column {
    background-color: var(--bs-secondary-bg);
}

/* Corner rounding on first/last cells */
.nuptial-flight-table thead tr th:last-child {
    border-top-right-radius: 0.5rem;
}
.nuptial-flight-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 0.5rem;
}
.nuptial-flight-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 0.5rem;
}

/* Subtle separator shadow on sticky column */
.nuptial-flight-table th.species-th::after,
.nuptial-flight-table td.name-column::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--bs-border-color);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.06);
}

/* Month Columns & Flight Badges */
.month-column {
    text-align: center;
    width: 44px;
    min-width: 42px;
    padding: 0.35rem 0.2rem !important;
}

.flight-pill {
    display: inline-block;
    padding: 0.2rem 0.38rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 0.35rem;
    background-color: #2d6a4f;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .flight-pill {
    background-color: #52b788;
    color: #0f211a;
}

.no-flight-dash {
    color: var(--bs-secondary-color);
    opacity: 0.35;
    font-size: 1.2rem;
    line-height: 1;
    display: inline-block;
    user-select: none;
}

/* Current Month Highlight */
.current-month-header,
.nuptial-flight-table th.current-month-header {
    background-color: rgba(45, 106, 79, 0.18) !important;
    color: #1b3a2d !important;
    font-weight: 700 !important;
    border-bottom: 2px solid var(--bs-primary) !important;
}

[data-bs-theme="dark"] .current-month-header,
[data-bs-theme="dark"] .nuptial-flight-table th.current-month-header {
    background-color: rgba(82, 183, 136, 0.22) !important;
    color: #74c69d !important;
    border-bottom: 2px solid #52b788 !important;
}

.current-month-cell,
.nuptial-flight-table td.current-month-cell {
    --bs-table-bg: rgba(45, 106, 79, 0.08);
    background-color: rgba(45, 106, 79, 0.08) !important;
}

.nuptial-flight-table tr:hover td.current-month-cell {
    background-color: rgba(45, 106, 79, 0.14) !important;
}

[data-bs-theme="dark"] .current-month-cell,
[data-bs-theme="dark"] .nuptial-flight-table td.current-month-cell {
    --bs-table-bg: rgba(82, 183, 136, 0.08);
    background-color: rgba(82, 183, 136, 0.08) !important;
}

[data-bs-theme="dark"] .nuptial-flight-table tr:hover td.current-month-cell {
    background-color: rgba(82, 183, 136, 0.14) !important;
}

.current-month-dot {
    font-size: 0.85rem;
    color: var(--bs-primary);
    vertical-align: middle;
    margin-left: 2px;
}

[data-bs-theme="dark"] .current-month-dot {
    color: #74c69d;
}

/* Time & Climate Columns */
.time-column,
.climate-column {
    white-space: nowrap;
    width: 85px;
    padding: 0.35rem 0.4rem !important;
}

/* Legend Styling */
.nuptial-legend {
    font-size: 0.8rem;
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
}

.legend-swatch.flight-swatch {
    background-color: #2d6a4f;
}

[data-bs-theme="dark"] .legend-swatch.flight-swatch {
    background-color: #52b788;
}

.legend-swatch.current-swatch {
    background-color: rgba(45, 106, 79, 0.25);
    border: 1px solid var(--bs-primary);
}

[data-bs-theme="dark"] .legend-swatch.current-swatch {
    background-color: rgba(82, 183, 136, 0.3);
    border-color: #52b788;
}

/* Filter Card */
.filter-card {
    background-color: var(--bs-body-bg);
}

/* Report Toast */
.report-toast-container {
    z-index: 1090;
}

/* Species autocomplete dropdown */
.species-suggestions-dropdown {
    z-index: 1055;
}

/* Print Styles */
#print-area {
    display: none;
}

@media print {
    header,
    #return-to-top,
    footer {
        display: none !important;
    }

    main.container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }

    #nuptial-flight-table > *:not(#print-area) {
        display: none !important;
    }

    #print-area {
        display: block !important;
    }

    .nuptial-print-area {
        width: 100%;
        background: white;
        font-size: 9pt;
        color: #000;
    }

    .nuptial-print-area h3 {
        margin-top: 0;
        margin-bottom: 6px;
        font-size: 14pt;
    }

    .nuptial-print-area .filter-summary {
        font-size: 8pt;
        color: #555;
        margin-bottom: 8px;
    }

    .nuptial-flight-table {
        width: 100%;
        border-collapse: collapse;
    }

    .nuptial-flight-table th,
    .nuptial-flight-table td {
        border: 1px solid #ccc;
        padding: 3px 5px;
        font-size: 8pt;
    }

    .nuptial-flight-table th {
        background-color: #f2f2f2;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .may-fly {
        background-color: #c8e8d5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .badge.bg-danger {
        background-color: #dc3545 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .may-not-fly {
        filter: none;
        opacity: 0.3;
    }

    .month-column {
        width: 28px;
        text-align: center;
    }

    .nuptial-print-area a {
        text-decoration: none;
        color: inherit;
    }

    .nuptial-print-area [title="AntWiki"] {
        display: none;
    }

    .print-legend {
        margin-top: 10px;
        font-size: 8pt;
        color: #333;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 14px;
        align-items: center;
        border-top: 1px solid #ccc;
        padding-top: 6px;
    }

    .legend-item {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        white-space: nowrap;
    }

    .print-footer {
        margin-top: 8px;
        font-size: 8pt;
        color: #777;
    }

    @page {
        margin: 1cm;
        size: landscape;
    }
}
