/* ============================================
   PMS Hotel SaaS - Sidebar Layout
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #001F54;
    --secondary: #003087;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --accent: #FF6B35;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 0;
    height: 100%;
}

/* ============================================
   WRAPPER & LAYOUT
   ============================================ */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h3 {
    display: none;
}

.sidebar.collapsed .sidebar-menu li span {
    display: none;
}

.sidebar.collapsed .sidebar-footer .user-info {
    display: none;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header i {
    font-size: 32px;
    display: block;
    margin-bottom: 10px;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    gap: 15px;
}

.sidebar-menu li a:hover {
    background: rgba(255, 107, 53, 0.1);
    border-left: 3px solid var(--accent);
    padding-left: 17px;
    color: var(--accent);
}

.sidebar-menu li a i {
    font-size: 18px;
    width: 25px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-menu li a span {
    font-size: 14px;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.user-info i {
    font-size: 32px;
    margin-bottom: 10px;
}

.user-info span {
    font-weight: 600;
    font-size: 14px;
    text-align: center;
}

.user-info small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #e55a2b;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.main-content.expanded {
    margin-left: 70px;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--primary);
    transition: all 0.3s;
}

.btn-toggle-sidebar:hover {
    color: var(--accent);
}

.topbar h2 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 600;
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-time {
    color: #666;
    font-size: 14px;
}

/* ============================================
   CONTENT
   ============================================ */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: var(--success);
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: var(--danger);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: var(--warning);
}

.alert i {
    flex-shrink: 0;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Responsif untuk card header */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: stretch; /* Mengganti flex-start ke stretch agar elemen memanjang */
    }
    
    .card-header h4 {
        width: 100%;
        text-align: left; /* Memastikan judul tetap rata kiri */
    }
    
    .calendar-header-content,
    .booking-header-content {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .calendar-navigation {
        width: 100%;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .calendar-navigation button,
    .calendar-navigation a {
        flex: 1;
        margin: 2px;
    }
    
    /* Untuk elemen header lainnya */
    .card-header > div:last-child {
        width: 100%;
        display: flex;
        justify-content: flex-start; /* Mengganti ke flex-start agar tetap rata kiri */
    }
    
    /* Untuk halaman-halaman booking, pastikan tombol-tombol tetap di kanan di desktop tapi rapi di mobile */
    @media (min-width: 769px) {
        .booking-header-content {
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
        }
    }
}

.card-header h4 {
    margin: 0;
    font-size: 18px;
}

.card-body {
    padding: 20px;
}

/* ============================================
   DASHBOARD STATS
   ============================================ */
.dashboard-stats,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 4px solid;
}

.stat-card.blue {
    border-color: var(--primary);
}

.stat-card.green {
    border-color: var(--success);
}

.stat-card.orange {
    border-color: var(--accent);
}

.stat-card.purple {
    border-color: #6f42c1;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.stat-card.blue .stat-icon {
    background: rgba(0, 31, 84, 0.1);
    color: var(--primary);
}

.stat-card.green .stat-icon {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.stat-card.orange .stat-icon {
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent);
}

.stat-card.purple .stat-icon {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

.stat-content h3 {
    margin: 0;
    font-size: 28px;
    color: var(--primary);
}

.stat-content p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 14px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #e55a2b;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #333;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 5px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table thead {
    background: #f8f9fa;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    font-weight: 600;
    color: var(--primary);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #6c757d;
}

.text-danger {
    color: var(--danger);
}

.mt-4 {
    margin-top: 2rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.active {
        transform: translateX(0);
        position: fixed;
        height: 100%;
        z-index: 1001;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }

    .main-content {
        margin-left: 0;
    }
    
    /* Overlay untuk mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999; /* Harus lebih rendah dari sidebar tetapi lebih tinggi dari konten */
        display: none;
        pointer-events: auto;
    }
    
    .sidebar.active + .sidebar-overlay {
        display: block;
    }
    
    /* Jika sidebar aktif, tambahkan padding kiri agar tidak tertutup sidebar */
    body.sidebar-active {
        overflow: hidden;
    }

    .topbar {
        flex-direction: column;
        gap: 15px;
    }

    .topbar h2 {
        font-size: 18px;
    }

    .content {
        padding: 15px;
    }

    .dashboard-stats,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .card-header {
        flex-direction: column;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px;
    }
}
