/* ===========================================
   VILLA ANDHITA DASHBOARD - COMPONENTS CSS
   Extracted from inline styles in index.html
   =========================================== */

/* FIX: Allow Main Content To Shrink Below Intrinsic Size */
main {
    min-width: 0;
    overflow-x: hidden;
}

/* Header Right Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Credit Box In Header - Subtle Blue/Gray Theme */
.header-credit {
    display: block;
    background-color: #f0f4f8;
    padding: 4px 0;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
    text-align: center;
}

.header-credit strong {
    color: #475569;
}

/* Text Utilities */
.text-danger {
    color: #ef4444 !important;
}

.text-success {
    color: #10b981 !important;
}

.font-bold {
    font-weight: 700 !important;
}

/* Employee Photo Container */
.employee-photo-container {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.employee-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   STAT CARD - Square Icons (Right Position)
======================================== */
.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.stat-card .card-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card .card-icon .material-icons-round {
    font-size: 24px;
}

.stat-card .card-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

/* ========================================
   CHART CONTAINERS
======================================== */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-container-donut {
    position: relative;
    height: 280px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

/* ========================================
   CHART TOGGLE BUTTONS (Divisi | Metode)
======================================== */
.chart-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.toggle-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    color: #3b82f6;
}

.toggle-btn.active {
    color: #3b82f6;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
}

.toggle-separator {
    color: #d1d5db;
}

/* ========================================
   ROOM OCCUPANCY PAGE STYLES
======================================== */
.date-picker-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--card-color);
    color: var(--text-color);
    cursor: pointer;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 16px;
}

.date-display .material-icons-round {
    font-size: 20px;
}

/* Room Summary Cards Grid */
.room-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.room-summary-card {
    background: var(--card-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border-left: 4px solid;
}

.room-summary-card.terisi {
    border-color: #10b981;
}

.room-summary-card.kosong {
    border-color: #3b82f6;
}

.room-summary-card.maintenance {
    border-color: #f59e0b;
}

.room-summary-card.rate {
    border-color: #8b5cf6;
}

.room-summary-card.cleaning {
    border-color: #eab308;
}

.room-summary-card.booked {
    border-color: #6366f1;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

.summary-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Room Type Sections */
.room-type-section {
    margin-bottom: 24px;
}

.room-type-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Room Cards */
.room-card {
    background: var(--card-color);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.room-card.status-terisi {
    border-top: 3px solid #10b981;
}

.room-card.status-waiting_checkin {
    border-top: 3px solid #8b5cf6;
}

.room-card.status-waiting_checkout {
    border-top: 3px solid #ef4444;
}

.room-card.status-booked {
    border-top: 3px solid #6366f1;
}

.room-card.status-kosong {
    border-top: 3px solid #3b82f6;
}

.room-card.status-maintenance {
    border-top: 3px solid #f59e0b;
}

.room-card.status-cleaning {
    border-top: 3px solid #eab308;
}

.room-card .room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    background: rgba(0, 0, 0, 0.02);
}

.room-card .room-number {
    font-weight: 700;
    font-size: 16px;
}

.room-status-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.room-status-badge.terisi {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.room-status-badge.waiting_checkin {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.room-status-badge.waiting_checkout {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.room-status-badge.booked {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.room-status-badge.kosong {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.room-status-badge.maintenance {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.room-status-badge.cleaning {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.room-card-body {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.room-guest {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex: 1;
}

.room-guest-avatar {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.guest-name {
    font-weight: 600;
    font-size: 14px;
}

.guest-checkout {
    font-size: 12px;
    color: var(--text-muted);
}

.room-maintenance,
.room-available,
.room-cleaning {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    justify-content: center;
    flex: 1;
}

.room-maintenance .material-icons-round {
    color: #f59e0b;
    font-size: 20px;
}

.room-available .material-icons-round {
    color: #3b82f6;
    font-size: 20px;
}

.room-cleaning .material-icons-round {
    color: #eab308;
    font-size: 20px;
}

/* Room Action Buttons */
.room-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
}

.room-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.room-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.room-action-btn .material-icons-round {
    font-size: 14px;
}

.room-action-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.room-action-btn.primary:hover {
    background: var(--primary-dark);
}

.room-action-btn.warning {
    color: #f59e0b;
    border-color: #f59e0b;
}

.room-action-btn.warning:hover {
    background: rgba(245, 158, 11, 0.1);
}

.room-action-btn.success {
    color: #10b981;
    border-color: #10b981;
}

.room-action-btn.success:hover {
    background: rgba(16, 185, 129, 0.1);
}

.room-action-btn.danger {
    color: #ef4444;
    border-color: #ef4444;
}

.room-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.room-action-btn.full-width {
    flex: 1;
    justify-content: center;
}

.room-card-body .room-guest,
.room-card-body .room-available,
.room-card-body .room-maintenance,
.room-card-body .room-cleaning {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-card-body .room-guest {
    justify-content: flex-start;
}

.room-card-body .room-actions {
    margin-top: auto;
    padding-top: 8px;
}

/* Button Extra Small */
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-xs .material-icons-round {
    font-size: 14px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-color);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: auto;
}

.modal-content.modal-lg {
    max-width: 600px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    color: var(--text-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-control {
    cursor: pointer;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.room-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.room-select-btn {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.room-select-btn:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.room-select-number {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-color);
}

.room-select-type {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========================================
   RESPONSIVE DESIGN - Mobile First
======================================== */

/* Desktop With Sidebar - Ensure Cards Fit */
@media (max-width: 1400px) {
    .stat-card .card-value {
        font-size: 1.25rem;
    }
}

@media (max-width: 1200px) {
    .stat-card .card-value {
        font-size: 1.1rem;
    }

    .stat-card .card-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .stat-card .card-icon .material-icons-round {
        font-size: 20px;
    }
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .card-value {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .btn-danger {
        padding: 8px;
    }

    .header-credit {
        font-size: 8px;
        padding: 3px 8px;
    }

    /* Smaller Cards On Tablet */
    .stat-card .card-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .stat-card .card-icon .material-icons-round {
        font-size: 20px;
    }

    .stat-card .card-value {
        font-size: 1.25rem;
    }

    .chart-container,
    .chart-container-donut {
        height: 240px;
    }
}

@media (max-width: 480px) {
    .header-credit {
        display: none;
    }

    /* Even Smaller On Mobile */
    .stat-card .card-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .stat-card .card-icon .material-icons-round {
        font-size: 18px;
    }

    .stat-card .card-value {
        font-size: 1.1rem;
    }

    .chart-container,
    .chart-container-donut {
        height: 200px;
    }

    /* Stack Cards In Single Column On Mobile */
    .cards-grid {
        grid-template-columns: 1fr !important;
    }
}

/* =========================================
   RUNNING TEXT / MARQUEE (Integrated in Header)
   ========================================= */
.marquee-wrapper {
    flex: 1;
    max-width: 600px;
    margin: 0 8px;
    border-radius: 8px;
    overflow: hidden;
    /* Mobile First: Visible, taking available space */
    display: block;
    flex: 1;
    max-width: 200px;
    /* Increased width */
}

/* Hide Subtitle on Tablet/Mobile to give space to Marquee */
@media (max-width: 1023px) {
    .header-title p {
        display: none !important;
    }
}

/* Tablet: More space */
@media (min-width: 768px) {
    .marquee-wrapper {
        margin: 0 16px;
        max-width: 400px;
        /* Significantly wider for tablet */
    }
}

/* Desktop: Full width */
@media (min-width: 1024px) {
    .marquee-wrapper {
        max-width: 600px;
        margin: 0 24px;
    }
}

.marquee-container {
    background: transparent;
    border-bottom: none;
    color: var(--text-primary);
    overflow: hidden;
    position: relative;
    height: 32px;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    /* Smaller font on mobile */
    font-weight: 500;
    white-space: nowrap;
    z-index: 90;
}

@media (min-width: 768px) {
    .marquee-container {
        font-size: 0.85rem;
        /* Regular size on larger screens */
    }
}

html.dark .marquee-container {
    background: rgba(255, 255, 255, 0.05);
}

/* Ensure header-right uses flex to align marquee and controls */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    /* Allow it to claim space */
    justify-content: flex-end;
    /* Push controls to right */
    min-width: 0;
    /* Critical for flex child truncation */
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 90s linear infinite;
    /* Even slower (1.5 min) */
    color: var(--text-color);
}

.marquee-content>span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 50px;
    /* Fixed space for separator */
    position: relative;
    margin-right: 0;
}

.marquee-content>span::after {
    content: '|';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    /* Match padding-right exactly */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 300;
    opacity: 0.5;
    transform: none;
}

.marquee-content>span:last-child::after {
    display: none;
}

.marquee-content .highlight {
    color: var(--primary);
    font-weight: 700;
}

.marquee-content .warning {
    color: #ef4444;
    /* Red */
    font-weight: 700;
}

.marquee-content .info {
    color: #3b82f6;
    /* Blue */
    font-weight: 700;
}

@keyframes marquee {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-100%, 0);
    }
}