/* 
 * Booking Chart Styling - Hotel Occupancy Scheduler
 * Tailored for high performance, smooth scroll, and rich modern aesthetics.
 */

:root {
    --grid-days: 15;
    --col-room-width: 90px;
    --col-cat-width: 160px;
    --col-date-width: 75px;
    --grid-border: #e2e8f0;
}

/* Scheduler Layout */
.scheduler-card {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    margin-bottom: 24px;
    position: relative;
}

.scheduler-scroll-container {
    overflow: auto;
    max-height: calc(100vh - 320px);
    min-height: 400px;
    position: relative;
}

/* Scrollbars styling */
.scheduler-scroll-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.scheduler-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.scheduler-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.scheduler-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* CSS Grid structure */
.scheduler-grid {
    display: grid;
    grid-template-columns: var(--col-room-width) var(--col-cat-width) repeat(var(--grid-days), var(--col-date-width));
    position: relative;
    background-color: #f8fafc;
}

/* Grid Cells */
.grid-cell {
    border-right: 1px solid var(--grid-border);
    border-bottom: 1px solid var(--grid-border);
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    font-size: 0.85rem;
    position: relative;
    user-select: none;
}

/* Sticky Headers */
.grid-header-cell {
    height: 52px;
    background-color: #1e3a8a; /* Deep blue header */
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 25;
    font-size: 0.8rem;
    line-height: 1.3;
}

.grid-header-cell .day-num {
    font-size: 1rem;
    font-weight: 700;
}

.grid-header-cell .day-name {
    opacity: 0.8;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Sticky Columns */
.col-room {
    position: sticky;
    left: 0;
    z-index: 10;
    font-weight: 700;
    color: var(--text-primary);
    background-color: #ffffff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.02);
}

.col-category {
    position: sticky;
    left: var(--col-room-width);
    z-index: 10;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    background-color: #ffffff;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.03);
    border-right: 2px solid var(--text-light) !important;
}

/* Corner Header intersection */
.grid-header-cell.col-room,
.grid-header-cell.col-category {
    background-color: #ffffff;
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    z-index: 30;
    border-bottom: 2px solid var(--grid-border);
    border-right: 1px solid var(--grid-border);
}

.grid-header-cell.col-category {
    border-right: 2px solid var(--text-light) !important;
}

/* Available Room Dots */
.cell-available-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #cbd5e1;
    opacity: 0.7;
}

/* Booking Blocks */
.booking-block {
    position: relative;
    margin: 4px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    user-select: none;
    z-index: 5;
    transition: transform 0.15s ease, box-shadow 0.15s ease, outline 0.15s ease;
    overflow: hidden;
    text-align: center;
    padding: 2px 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.booking-block .booking-agent {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.booking-block .booking-code {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.85;
    margin-top: 1px;
}

/* Hover highlights */
.booking-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 8;
}

.booking-block.highlighted {
    transform: scale(1.02);
    outline: 2.5px solid #2563eb;
    outline-offset: 1px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    z-index: 9;
}

/* Color palettes based on booking source (Base Theme) */
/* Make My Trip */
.source-mmt {
    background-color: #d1fae5;
    color: #065f46;
}

/* ICICI Direct */
.source-ic {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Flying Guest */
.source-fg {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* Agoda */
.source-ad {
    background-color: #ccfbf1;
    color: #115e59;
}

/* Corporate Sales */
.source-cs {
    background-color: #ffedd5;
    color: #9a3412;
}

/* Holiday Home */
.source-hh {
    background-color: #fef3c7;
    color: #92400e;
}

/* Railway */
.source-rail {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Maintenance style */
.source-maintenance {
    background-color: #fef9c3;
    color: #854d0e;
    background-image: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(234,179,8,0.1) 5px, rgba(234,179,8,0.1) 10px);
}

/* Blocked style */
.source-blocked {
    background-color: #e2e8f0;
    color: #475569;
    background-image: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(100,116,139,0.08) 5px, rgba(100,116,139,0.08) 10px);
}

/* Tooltip Hover Cards */
.scheduler-tooltip {
    position: absolute;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    z-index: 500;
    width: 250px;
    display: none;
    pointer-events: none;
    animation: tooltipFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.scheduler-tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.scheduler-tooltip-row:last-child {
    margin-bottom: 0;
}

.scheduler-tooltip-lbl {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 80px;
}

.scheduler-tooltip-val {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    flex-grow: 1;
    padding-left: 10px;
}

@keyframes tooltipFade {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Legend section */
.legend-bar {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.legend-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.legend-color-box {
    width: 28px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.05);
}

.legend-color-box.available {
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.legend-color-box.available::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #cbd5e1;
}

/* Skeleton Loading Layer */
.scheduler-skeleton {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.75);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.skeleton-spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid #e2e8f0;
    border-top: 3.5px solid var(--color-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Submenu layout overrides */
.placeholder-card {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    padding: 40px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    text-align: center;
    max-width: 600px;
    margin: 40px auto;
}

.placeholder-card svg {
    width: 64px;
    height: 64px;
    color: var(--color-blue);
    margin-bottom: 20px;
}

.placeholder-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.placeholder-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Stats grid for Booking Chart */
.chart-stats-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.chart-stat-card {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    padding: 12px 16px;
    border: 1px solid rgba(226, 232, 240, 0.7);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-stat-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chart-stat-info {
    display: flex;
    flex-direction: column;
}

.chart-stat-lbl {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.25px;
}

.chart-stat-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-stat-val span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 2px;
}

/* Header Date Range input custom container */
.date-picker-container {
    position: relative;
    display: flex;
    align-items: center;
}

.date-picker-container input[type="date"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* Mode toggles view button active styling */
.view-btn {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-speed);
}

.view-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.view-btn:nth-child(2) {
    border-left: none;
    border-right: none;
}

.view-btn:last-child {
    border-radius: 0 8px 8px 0;
}

.view-btn:hover {
    color: var(--text-primary);
    background-color: #f8fafc;
}

.view-btn.active {
    background-color: #1e293b;
    border-color: #1e293b;
    color: #ffffff;
}

/* Action button buttons */
.action-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
}

.action-icon-btn:hover {
    border-color: var(--text-light);
    background-color: #f8fafc;
}

.action-icon-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

/* Media Queries for occupancy chart stats grid */
@media (max-width: 1400px) {
    .chart-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .chart-stats-grid > .chart-stat-card:last-child {
        grid-column: span 2;
    }
}

@media (max-width: 992px) {
    .chart-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-stats-grid > .chart-stat-card:last-child {
        grid-column: span 2;
    }
}
