/* --- Base & Variables --- */
:root {
    --primary-color: #3b82f6; /* blue-500 */
    --sidebar-bg: #1f2937;    /* gray-800 */
    --main-bg: #f3f4f6;       /* gray-100 */
    --card-bg: #ffffff;
    --text-light: #f9fafb;    /* gray-50 */
    --text-dark: #111827;     /* gray-900 */
    --border-color: #e5e7eb;  /* gray-200 */
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: var(--main-bg);
    color: var(--text-dark);
    margin: 0;
    overflow-x: hidden;
}

/* --- Main Dashboard Layout --- */
.sidebar {
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    width: 256px;
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
}

/* --- Components --- */
.logo-img {
    width: 120px;
    height: auto;
    margin: 0 auto 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    color: #d1d5db; /* gray-300 */
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
    background-color: #374151; /* gray-700 */
    color: white;
}

.nav-item.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.page {
    animation: fadeIn 0.5s ease-in-out;
}

.card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Data Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
    margin-top: 1.5rem;
    background-color: white;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th {
    background-color: #f9fafb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table th.sortable {
    cursor: pointer;
    transition: background-color 0.2s;
}
.data-table th.sortable:hover {
    background-color: #f0f3f5;
}

.data-table tbody tr:nth-of-type(even) {
    background-color: #f9fafb;
}

.editable-cell {
    background-color: #fef9c3;
    cursor: text;
}

/* Row Action Buttons */
.action-buttons button {
    background: none; border: none; cursor: pointer; font-size: 1.2em;
    padding: 2px 5px; margin: 0 2px; border-radius: 4px; transition: background-color 0.2s;
}
.action-buttons button:hover { background-color: #e5e7eb; }
.btn-up { color: #16a34a; }
.btn-down { color: #f97316; }
.btn-delete { color: #dc2626; }

/* Status Indicators */
.status-indicator {
    padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem;
    font-weight: 600; display: inline-block; text-align: center; min-width: 70px;
}
.status-pending { background-color: #fef3c7; color: #92400e; }
.status-sent { background-color: #d1fae5; color: #065f46; }


/* --- Modals --- */
.modal {
    display: none; position: fixed; z-index: 50; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px); overflow: auto; padding-top: 5%;
    animation: fadeIn 0.3s ease;
}
.modal-content {
    background-color: var(--card-bg); margin: auto; padding: 2rem;
    border-radius: 0.5rem; width: 90%; max-width: 500px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* --- Animations & Utilities --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.hidden {
    display: none;
}

.loader {
    width: 16px; height: 16px; border: 2px solid #FFF;
    border-bottom-color: transparent; border-radius: 50%; display: inline-block;
    box-sizing: border-box; animation: rotation 1s linear infinite;
    margin-right: 8px; vertical-align: -3px;
}
@keyframes rotation { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


/* ========================================================================
   NEW: RESPONSIVE & MOBILE STYLES
   ======================================================================== */
@media (max-width: 767px) {
    /* --- Responsive Sidebar --- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
    }
    .sidebar-open {
        transform: translateX(0);
    }
    .main-content {
        transition: filter 0.3s ease-in-out;
    }
    .sidebar-open ~ .main-content {
        filter: brightness(0.5);
    }

    /* --- Responsive Table (Card View) --- */
    .data-table thead {
        display: none;
    }
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }
    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        overflow: hidden;
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        white-space: normal;
        padding: 0.5rem 1rem;
    }
    .data-table td:before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        margin-right: 1rem;
        color: #333;
    }
    .action-buttons, .send-btn-container {
        justify-content: center;
        padding: 0.75rem;
    }
    .action-buttons::before, .send-btn-container::before {
        display: none;
    }
}
/* ✨ NEW: Status Bulb Indicator */
.status-bulb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    background-color: #ef4444; /* red-500 for offline/error */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.status-bulb.live {
    background-color: #22c55e; /* green-500 for live */
    animation: blink-animation 1.5s infinite;
}

@keyframes blink-animation {
    0%, 100% {
        box-shadow: 0 0 5px #22c55e, 0 0 1px #22c55e;
    }
    50% {
        box-shadow: 0 0 2px #22c55e, 0 0 0px #22c55e;
    }
}
/* === ADD THIS TO THE END OF YOUR style.css FILE === */

/* --- Booking Text Parser Page --- */
#booking-parser .parser-container {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 1.5rem; /* 24px */
}

/* Two-column layout for larger screens */
@media (min-width: 1024px) { /* lg: */
    #booking-parser .parser-container {
        grid-template-columns: 1fr 1fr;
    }
}

#booking-parser .parser-textarea {
    width: 100%;
    min-height: 300px;
    padding: 0.75rem; /* 12px */
    border: 1px solid #D1D5DB; /* gray-300 */
    border-radius: 0.375rem; /* 6px */
    font-family: monospace;
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    background-color: #F9FAFB; /* gray-50 */
    color: #1F2937; /* gray-800 */
    box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#booking-parser .parser-textarea:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: #3B82F6; /* blue-500 */
    box-shadow: 0 0 0 2px #BFDBFE; /* blue-200 */
}

/* --- Table Styles for Parser --- */
#booking-parser .table-wrapper {
    overflow-x: auto;
    width: 100%;
}

#booking-parser .data-table {
    width: 100%;
    min-width: 800px; /* Ensure table is wide enough to scroll */
    border-collapse: collapse;
}

#booking-parser .data-table th,
#booking-parser .data-table td {
    padding: 0.75rem 1rem; /* 12px 16px */
    border: 1px solid #E5E7EB; /* gray-200 */
    text-align: left;
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem; /* 20px */
    white-space: nowrap;
}

#booking-parser .data-table th {
    background-color: #F9FAFB; /* gray-50 */
    font-weight: 600; /* semibold */
    color: #4B5563; /* gray-600 */
}

#booking-parser .data-table th[data-column-key] {
    cursor: pointer;
}

#booking-parser .data-table th[data-column-key]:hover {
    background-color: #F3F4F6; /* gray-100 */
}

#booking-parser .data-table tbody tr:nth-child(even) {
    background-color: #F9FAFB; /* gray-50 */
}

/* Row status styles */
#booking-parser .cancelled-row td {
    color: #EF4444; /* red-500 */
    text-decoration: line-through;
    opacity: 0.7;
}

#booking-parser .changed-date-row td {
    color: #3B82F6; /* blue-500 */
    font-style: italic;
}

/* Action buttons in table */
#booking-parser .move-row-btn {
    padding: 0.25rem 0.5rem; /* 4px 8px */
    font-size: 0.75rem; /* 12px */
    background-color: #F59E0B; /* yellow-500 */
    color: white;
    border: none;
    border-radius: 0.25rem; /* 4px */
    cursor: pointer;
}
#booking-parser .move-row-btn:hover {
    background-color: #D97706; /* yellow-600 */
}

#booking-parser .restore-row-btn {
    padding: 0.25rem 0.5rem; /* 4px 8px */
    font-size: 0.75rem; /* 12px */
    background-color: #10B981; /* green-500 */
    color: white;
    border: none;
    border-radius: 0.25rem; /* 4px */
    cursor: pointer;
}
#booking-parser .restore-row-btn:hover {
    background-color: #059669; /* green-600 */
}

#parserMovedTableContainer h3 {
    font-size: 1.125rem; /* 18px */
    font-weight: 600;
    color: #374151; /* gray-700 */
    margin-bottom: 0.5rem; /* 8px */
    border-bottom: 1px solid #E5E7EB; /* gray-200 */
    padding-bottom: 0.5rem; /* 8px */
}