/* ==================== GLOBAL STYLES ==================== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --navbar-height: 56px;
    --bg-body: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08);
}

* { font-family: 'Inter', sans-serif; }

html {
    overflow-x: hidden;
}

body {
    background: var(--bg-body);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    transition: width .2s ease;
    flex-shrink: 0;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: .6rem 1.2rem;
    color: #64748b;
    font-size: .875rem;
    font-weight: 500;
    border-radius: .5rem;
    margin: 2px .75rem;
    transition: all .15s ease;
    text-decoration: none;
}

.sidebar .nav-link i {
    font-size: 1.15rem;
    width: 24px;
    margin-right: .75rem;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: #eef2ff;
    color: var(--primary);
}

.sidebar .nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.35);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    min-height: calc(100vh - var(--navbar-height));
}

/* ==================== CARDS ==================== */
.stat-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.stat-card .icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

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

.stat-card .stat-label {
    font-size: .8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ==================== TABLE STYLES ==================== */
.card-custom {
    background: #fff;
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.card-custom .card-header-custom {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.table-custom {
    margin-bottom: 0;
}

.table-custom thead th {
    background: #f8fafc;
    border-top: none;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    font-weight: 600;
    padding: .75rem 1rem;
}

.table-custom tbody td {
    padding: .75rem 1rem;
    vertical-align: middle;
    font-size: .875rem;
}

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

/* ==================== BUTTONS ==================== */
.btn-primary-custom {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    border-radius: .5rem;
    font-weight: 500;
    padding: .5rem 1rem;
    font-size: .875rem;
}

.btn-primary-custom:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

/* ==================== FORM STYLES ==================== */
.form-control, .form-select {
    border-radius: .5rem;
    border-color: #e2e8f0;
    font-size: .875rem;
    padding: .5rem .75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.form-label {
    font-size: .8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: .25rem;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    border-radius: 1.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    overflow: hidden;
    width: 100%;
    max-width: 420px;
}

.login-card .login-header {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.login-card .login-body {
    padding: 2rem;
}

/* ==================== BADGES ==================== */
.badge {
    font-weight: 500;
    font-size: .75rem;
    padding: .35em .65em;
}

/* ==================== CALENDAR ==================== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e2e8f0;
    border-radius: .75rem;
    overflow: hidden;
}

.calendar-header-cell {
    background: var(--primary);
    color: #fff;
    padding: .5rem;
    text-align: center;
    font-weight: 600;
    font-size: .8rem;
}

.calendar-cell {
    background: #fff;
    min-height: 100px;
    padding: .5rem;
    position: relative;
}

.calendar-cell .date-num {
    font-weight: 600;
    font-size: .85rem;
    color: #475569;
}

.calendar-cell.other-month .date-num {
    color: #cbd5e1;
}

.calendar-cell.today {
    background: #eef2ff;
    scroll-margin-top: 70px;
}

.calendar-cell.today .date-num {
    color: var(--primary);
    font-weight: 700;
}

@keyframes today-flash {
    0%   { box-shadow: 0 0 0 4px rgba(13, 110, 253, .5); }
    50%  { box-shadow: 0 0 0 8px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

.calendar-cell.today.flash {
    animation: today-flash 1.2s ease-out 2;
}

.mobile-day-header.today.flash {
    animation: today-flash 1.2s ease-out 2;
}

.calendar-event {
    font-size: .7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile calendar (vertical list) - hidden on desktop */
.mobile-calendar-list {
    display: none;
}
.mobile-calendar-list .mobile-day-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    position: sticky;
    top: var(--navbar-height);
    z-index: 2;
}
.mobile-calendar-list .mobile-day-header:first-child {
    border-radius: .75rem .75rem 0 0;
}
.mobile-calendar-list .mobile-day-header .mobile-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    font-size: .9rem;
}
.mobile-calendar-list .mobile-day-header.today .mobile-day-num {
    background: #22c55e;
}
.mobile-calendar-list .mobile-day-header .mobile-day-name {
    font-weight: 600;
    font-size: .8rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.mobile-calendar-list .mobile-cal-event {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.mobile-calendar-list .mobile-cal-event:active {
    background: #f8fafc;
}

/* ==================== MOBILE BOTTOM NAV ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    display: flex;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 10px rgba(0,0,0,.08);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    color: #94a3b8;
    font-size: .65rem;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s;
}
.bottom-nav-item i {
    font-size: 1.25rem;
    line-height: 1;
}
.bottom-nav-item:active {
    color: var(--primary);
}
.bottom-nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .main-content {
        padding-bottom: 68px !important;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 1040;
        top: var(--navbar-height);
        height: calc(100vh - var(--navbar-height));
    }
    .sidebar.show {
        left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1039;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .card-custom {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    .calendar-grid-wrap {
        display: none;
    }
    .mobile-calendar-list {
        display: block;
    }
}

@media (max-width: 575.98px) {
    html, body {
        font-size: 16px;
    }
    .main-content {
        padding: .75rem !important;
    }
    .stat-card {
        padding: .9rem;
    }
    .stat-card .stat-value {
        font-size: 1.4rem;
    }
    .stat-card .stat-label {
        font-size: .7rem;
    }
    .btn {
        padding: .55rem .9rem;
        font-size: .95rem;
    }
    .btn-sm {
        padding: .45rem .7rem;
        font-size: .85rem;
    }
    .form-control, .form-select {
        font-size: 16px;
        padding: .6rem .8rem;
    }
    .form-label {
        font-size: .85rem;
    }
    .table-custom th {
        padding: .6rem .6rem;
        font-size: .65rem;
    }
    .table-custom td {
        padding: .6rem .6rem;
        font-size: .8rem;
    }
    .card-custom {
        border-radius: .8rem;
    }
    .page-title h4, h4.fw-bold {
        font-size: 1.15rem;
    }
    .calendar-cell {
        min-height: 60px;
    }
}

/* ==================== PRINT ==================== */
#printBookingsArea { display: none; }
@media print {
    body * {
        visibility: hidden !important;
    }
    #printArea, #printInvoice, #printQuote,
    #printArea *, #printInvoice *, #printQuote * {
        visibility: visible !important;
    }
    #printBookingsArea, #printBookingsArea * {
        visibility: visible !important;
    }
    #printBookingsArea {
        display: block !important;
    }
    #printArea, #printInvoice, #printQuote, #printBookingsArea {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
    }
    .no-print {
        display: none !important;
    }
}

/* ==================== MISC ==================== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* Print Styles */
@media print {
    .sidebar, .navbar, .no-print { display: none !important; }
    .main-content { margin: 0 !important; padding: 1rem !important; }
    .card-custom { box-shadow: none !important; border: 1px solid #ddd !important; }
}
