/**
 * Flight Status Table Styling
 * Location: /xsite/mod/dashboard/inc/css/flight-status.css
 * Purpose: Professional styling for flight status display
 */

/* Flight Container */
.flight-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.flight-section {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flight-section-title {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e3a8a;
    letter-spacing: 0.5px;
}

.flight-date-range {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #64748b;
    font-style: italic;
}

/* Flight Table */
.flight-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.flight-table thead {
    background: linear-gradient(135deg, #1e3a8a 0%, #2d5a8c 100%);
    color: white;
    font-weight: 600;
}

.flight-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: none;
}

.flight-table th.col-airline {
    width: 30%;
}

.flight-table th.col-departure {
    width: 20%;
}

.flight-table th.col-arrival {
    width: 25%;
}

.flight-table th.col-status {
    width: 25%;
}

.flight-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

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

.flight-table tbody tr:hover {
    background-color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.1);
}

.flight-table td {
    padding: 16px;
    font-size: 14px;
    color: #334155;
}

/* Flight Row Status Classes */
.flight-row.status-scheduled td {
    color: #334155;
}

.flight-row.status-delayed td {
    color: #d97706;
}

.flight-row.status-in-flight td {
    color: #0891b2;
}

.flight-row.status-landed td {
    color: #059669;
}

.flight-row.status-cancelled td {
    color: #dc2626;
}

/* Airline Column */
.airline-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 4px;
}

.flight-number {
    display: block;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Time Columns (Departure & Arrival) */
.time-text {
    font-size: 15px;
    font-weight: 500;
    color: #1e40af;
}

.col-departure .time-text,
.col-arrival .time-text {
    font-size: 15px;
    font-weight: 600;
}

/* Delayed Flight Time Styling - Original time with strikethrough */
.time-original {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: line-through;
    text-decoration-color: #dc2626;
    text-decoration-thickness: 2px;
    margin-bottom: 4px;
}

/* Updated time for delayed flights */
.time-updated {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #ea580c;
    animation: pulse-orange 2s ease-in-out infinite;
}

@keyframes pulse-orange {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.status-scheduled {
    background-color: #e0f2fe;
    color: #0369a1;
}

.status-in-flight {
    background-color: #cffafe;
    color: #0891b2;
}

.status-landed {
    background-color: #d1fae5;
    color: #059669;
}

.status-delayed {
    background-color: #fed7aa;
    color: #ea580c;
}

.status-cancelled {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Status Badge Hover */
.flight-row:hover .status-badge {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}


/* Retry Button (for errors) */
.btn-retry {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #1e3a8a 0%, #2d5a8c 100%);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-retry:hover {
    background: linear-gradient(135deg, #1e40af 0%, #3b63a8 100%);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
    transform: translateY(-1px);
}

.btn-retry:active {
    transform: translateY(0);
}

/* Loading State */
.flight-loading {
    display: block;
    padding: 40px;
    text-align: center;
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
}

.flight-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid #e2e8f0;
    border-top-color: #1e3a8a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.flight-error {
    padding: 20px;
    background-color: #fee2e2;
    border-left: 4px solid #dc2626;
    border-radius: 4px;
    text-align: center;
}

.error-message {
    margin: 0 0 12px 0;
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .flight-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .flight-table {
        font-size: 12px;
    }

    .flight-table th,
    .flight-table td {
        padding: 12px;
    }

    .flight-table th {
        font-size: 11px;
    }

    .flight-table th.col-airline {
        width: 30%;
    }

    .flight-table th.col-departure {
        width: 20%;
    }

    .flight-table th.col-arrival {
        width: 20%;
    }

    .flight-table th.col-status {
        width: 30%;
    }

    .airline-name {
        font-size: 14px;
    }

    .flight-number {
        font-size: 11px;
    }

    .time-text {
        font-size: 13px;
    }

    .status-badge {
        padding: 5px 10px;
        font-size: 11px;
    }

    .flight-section-title {
        font-size: 16px;
    }
}

/* Large Mobile Devices (480px to 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    .flight-section {
        padding: 12px;
        margin-bottom: 20px;
    }

    .flight-table {
        font-size: 13px;
    }

    .flight-table th,
    .flight-table td {
        padding: 10px;
    }

    .flight-table th {
        font-size: 11px;
    }

    .airline-name {
        font-size: 14px;
    }

    .flight-number {
        font-size: 11px;
    }

    .time-text {
        font-size: 13px;
    }

    .status-badge {
        padding: 4px 8px;
        font-size: 11px;
    }

    .flight-section-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .flight-date-range {
        font-size: 12px;
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    /* Mobile: Beautiful card layout */
    .flight-container {
        padding: 0 10px;
    }

    .flight-section {
        padding: 0;
        margin-bottom: 25px;
        background: transparent;
        box-shadow: none;
    }

    .flight-section-title {
        font-size: 17px;
        font-weight: 700;
        margin: 20px 0 8px 0;
        color: #1e3a8a;
        padding: 0 10px;
    }

    .flight-date-range {
        margin: 0 0 15px 0;
        font-size: 12px;
        color: #64748b;
        font-style: italic;
        padding: 0 10px;
    }

    /* Hide table structure, show as cards */
    .flight-table {
        border-collapse: separate;
        border-spacing: 0 0;
        background: transparent;
        width: 100%;
    }

    .flight-table thead {
        display: none;
    }

    .flight-table tbody {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Flight card */
    .flight-table tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        border: none;
        background: white;
        border-radius: 10px;
        padding: 14px;
        margin: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border-left: 5px solid #0369a1;
        transition: all 0.3s ease;
        gap: 0;
    }

    .flight-table tbody tr:active {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* Status colors - left border */
    .flight-table tbody tr.status-scheduled {
        border-left-color: #0369a1;
    }

    .flight-table tbody tr.status-delayed {
        border-left-color: #ea580c;
    }

    .flight-table tbody tr.status-in-flight {
        border-left-color: #0891b2;
    }

    .flight-table tbody tr.status-landed {
        border-left-color: #059669;
    }

    .flight-table tbody tr.status-cancelled {
        border-left-color: #dc2626;
    }

    /* Card rows - display on single line */
    .flight-table td {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        font-size: 13px;
        color: #334155;
    }

    .flight-table td:first-child {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 0 12px 0;
        border-bottom: 1px solid #e2e8f0;
        gap: 0;
        justify-content: flex-start;
    }

    .flight-table td:last-child {
        padding: 8px 0 0 0;
        border-bottom: none;
    }

    /* Row labels hidden by default, shown via ::before */
    .flight-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #64748b;
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex: 0 0 auto;
    }

    .col-airline {
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
    }

    .col-airline::before {
        content: '';
        display: none;
    }

    /* Flight info - airline and flight number */
    .airline-name {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        color: #1e3a8a;
        line-height: 1.2;
    }

    .flight-number {
        font-size: 12px;
        color: #64748b;
        font-weight: 600;
        margin-top: 4px;
        letter-spacing: 0.5px;
    }

    /* Departure Time - single line */
    .col-departure {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .col-departure::before {
        content: 'Departure';
        margin-right: 10px;
    }

    /* Arrival Time - single line */
    .col-arrival {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .col-arrival::before {
        content: 'Arrival';
        margin-right: 10px;
    }

    .time-text {
        text-align: right;
        font-size: 13px;
        font-weight: 600;
        color: #1e40af;
        white-space: nowrap;
    }

    /* Delayed time styling for mobile */
    .time-original {
        display: inline;
        font-size: 12px;
        color: #94a3b8;
        text-decoration: line-through;
        text-decoration-color: #dc2626;
        text-decoration-thickness: 1.5px;
        margin-right: 8px;
    }

    .time-updated {
        display: inline;
        font-size: 13px;
        font-weight: 700;
        color: #ea580c;
    }

    .col-departure,
    .col-arrival {
        flex-wrap: wrap;
    }

    /* Status - single line */
    .col-status {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .col-status::before {
        content: 'Status';
        margin-right: 10px;
    }

    .status-badge {
        text-align: right;
        font-size: 11px;
        font-weight: 700;
        padding: 6px 10px;
        border-radius: 16px;
        white-space: nowrap;
        display: inline-block;
    }


    /* Mobile loading state */
    .flight-loading {
        padding: 30px 20px;
        font-size: 14px;
    }

    .flight-loading::after {
        width: 18px;
        height: 18px;
        margin-left: 8px;
        border-width: 2px;
    }

    /* Mobile error state */
    .flight-error {
        padding: 16px;
        border-radius: 8px;
        margin: 10px 0;
    }

    .error-message {
        font-size: 13px;
        margin: 0 0 10px 0;
    }

    .btn-retry {
        width: 100%;
        padding: 10px;
        font-size: 12px;
        margin-top: 10px;
    }
}

/* Dark Mode Support - Keep White Background */
@media (prefers-color-scheme: dark) {
    .flight-section {
        background: white;
        color: #334155;
    }

    .flight-table {
        background: white;
    }

    .flight-table thead {
        background: linear-gradient(135deg, #1e3a8a 0%, #2d5a8c 100%);
    }

    .flight-table tbody tr {
        border-bottom-color: #e2e8f0;
    }

    .flight-table tbody tr:hover {
        background-color: #f8fafc;
    }

    .flight-table td {
        color: #334155;
    }

    .airline-name {
        color: #1e3a8a;
    }

    .flight-number {
        color: #64748b;
    }

    .time-text {
        color: #1e40af;
    }


    .flight-error {
        background-color: #fee2e2;
        border-left-color: #dc2626;
    }

    .error-message {
        color: #991b1b;
    }
}
