/* ==========================================================================
   1. VARIABLES & RESET
   ========================================================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Inter, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* ==========================================================================
   2. CORE APPLICATION LAYOUT
   ========================================================================== */
.crm-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100%;
    background-color: #111c24; 
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.app-area {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg);
}

.topbar {
    height: 75px;
    min-height: 75px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    z-index: 10;
}

.content-area {
    flex-grow: 1;
    width: 100%;
    overflow-y: auto;
    padding: 30px;
}

/* ==========================================================================
   3. SIDEBAR COMPONENTS
   ========================================================================== */
.logo-area {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    color: white;
}

.logo-area h4 {
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 0;
    white-space: nowrap;
}

.menu-list {
    list-style: none;
    padding: 15px 0;
    overflow-y: auto;
    flex-grow: 1;
}

.menu-list li {
    margin-bottom: 5px;
}

.menu-list li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 25px;
    text-decoration: none;
    color: #cbd5e1;
    transition: .3s;
}

.menu-list li a span {
    white-space: nowrap;
}

.menu-list li a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.menu-list li a.active {
    background: var(--primary);
    color: white;
    border-left: 5px solid white;
}

.menu-list i {
    width: 20px;
    text-align: center;
}

/* ==========================================================================
   4. UI COMPONENTS (CARDS, TABLES, BADGES)
   ========================================================================== */
.topbar h3 {
    font-size: 24px;
    font-weight: 700;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-box img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.crm-card {
    background: white;
    border-radius: 18px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .05);
    border: 1px solid #f1f5f9;
    transition: .3s;
}

.crm-card:hover {
    transform: translateY(-2px);
}

.stat-card {
    background: white;
    border-radius: 18px;
    padding: 25px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .05);
    position: relative;
    overflow: hidden;
}

.stat-card h6 {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-card h2 {
    font-size: 34px;
    font-weight: 700;
}

.stat-icon {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
}

/* Color Classes */
.bg-blue { background: #2563eb; }
.bg-green { background: #16a34a; }
.bg-orange { background: #ea580c; }
.bg-purple { background: #7c3aed; }

/* Tables & Wrappers */
.table-wrapper {
    background: white;
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .05);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    border: none;
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
}

.table td {
    padding: 14px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-visit { background: #fef3c7; color: #92400e; }
.badge-booked { background: #dcfce7; color: #166534; }

/* Buttons & Charts */
.btn {
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 600;
}

.btn-primary { background: var(--primary); border: none; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { border: none; }
.btn-info { color: white; }

.chart-card {
    background: white;
    border-radius: 18px;
    padding: 25px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .05);
}

/* Forms */
.form-control, .form-select {
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    min-height: 48px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: none;
}

/* Global Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 20px;
}

/* ==========================================================================
   5. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media(max-width:992px) {
    .sidebar {
        width: 80px;
        min-width: 80px;
    }

    .logo-area h4 span, 
    .menu-list a span {
        display: none;
    }

    .logo-area {
        text-align: center;
        padding: 25px 0;
    }

    .menu-list a {
        justify-content: center;
        padding: 14px 0;
    }
}

@media(max-width:768px) {
    .topbar {
        padding: 0 15px;
    }

    .content-area {
        padding: 15px;
    }

    .stat-card h2 {
        font-size: 24px;
    }
}