/* ============================================
   Barberfly - Modern Dashboard Theme
   ============================================ */

/* === BASE === */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent: #667eea;
    --accent-2: #764ba2;
    --body-bg: #f0f2f5;
    --card-radius: 12px;
    --transition: all 0.2s ease;
    --text-primary: #333;
    --text-secondary: #555;
    --text-muted: #8b8fa3;
    --text-heading: #1a1a2e;
    --card-bg: #fff;
    --navbar-bg: #fff;
    --navbar-border: #e5e7eb;
    --table-head-bg: #fafbfc;
    --table-border: #f0f0f0;
    --table-head-color: #6b7280;
    --input-border: #e0e3e8;
    --input-group-bg: #f8f9fa;
}

[data-theme="dark"] {
    --body-bg: #121218;
    --text-primary: #e0e0e6;
    --text-secondary: #b0b0bc;
    --text-muted: #7a7a8c;
    --text-heading: #f0f0f5;
    --card-bg: #1e1e2a;
    --navbar-bg: #1a1a26;
    --navbar-border: #2a2a3a;
    --table-head-bg: #1a1a26;
    --table-border: #2a2a3a;
    --table-head-color: #8b8fa3;
    --input-border: #3a3a4a;
    --input-group-bg: #1a1a26;
}

html { font-size: 14px; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
}

/* === SIDEBAR === */
#sidebar {
    background: var(--sidebar-bg) !important;
    min-width: var(--sidebar-width) !important;
    max-width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

#sidebar .sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

#sidebar .sidebar-brand h4 {
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    font-size: 1.4rem;
}

#sidebar .sidebar-brand h4 i {
    background: var(--sidebar-active);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 2px;
}

#sidebar .nav-section-label {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 0.75rem 1rem 0.4rem;
    font-weight: 600;
}

#sidebar .nav-link {
    color: rgba(255,255,255,0.7) !important;
    padding: 0.6rem 1rem !important;
    margin: 2px 0.5rem;
    border-radius: 8px !important;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

#sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

#sidebar .nav-link:hover {
    color: #fff !important;
    background: var(--sidebar-hover);
    transform: translateX(3px);
}

#sidebar .nav-link.active {
    color: #fff !important;
    background: var(--sidebar-active) !important;
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    font-weight: 600;
}

#sidebar .nav-link.nav-logout {
    color: rgba(255,100,100,0.8) !important;
}
#sidebar .nav-link.nav-logout:hover {
    color: #ff6b6b !important;
    background: rgba(255,100,100,0.1);
}

#sidebar .sidebar-divider {
    border-color: rgba(255,255,255,0.08);
    margin: 0.5rem 1rem;
}

/* === MAIN CONTENT WRAPPER === */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === TOP NAVBAR === */
.top-navbar {
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* === USER MENU BUTTON === */
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    padding: 0.35rem 0.5rem 0.35rem 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}
.user-menu-btn:hover {
    border-color: var(--accent);
    background: rgba(102,126,234,0.04);
}
.user-menu-btn::after { display: none; }
.user-menu-btn:focus { box-shadow: none; }

.user-menu-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === USER DROPDOWN === */
.user-dropdown {
    min-width: 260px;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    border: 1px solid var(--navbar-border);
    background: var(--card-bg);
}
.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
}
.user-dropdown .avatar-lg {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.user-dropdown .dropdown-divider {
    margin: 0;
    border-color: var(--navbar-border);
}
.user-dropdown .dropdown-item {
    padding: 0.65rem 1.2rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition);
}
.user-dropdown .dropdown-item i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
}
.user-dropdown .dropdown-item:hover {
    background: rgba(102,126,234,0.06);
    color: var(--accent);
}
.user-dropdown .dropdown-item:hover i {
    color: var(--accent);
}
.user-dropdown .dropdown-item-logout {
    color: #ff4757;
}
.user-dropdown .dropdown-item-logout i {
    color: #ff4757;
}
.user-dropdown .dropdown-item-logout:hover {
    background: rgba(255,71,87,0.08);
    color: #ff4757;
}

/* === THEME TOGGLE === */
.theme-toggle {
    background: none;
    border: 1.5px solid var(--input-border);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: var(--transition);
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(102,126,234,0.08);
}

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--sidebar-active);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-admin {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24) !important;
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

/* === CONTENT AREA === */
.content-area {
    padding: 1.5rem 2rem;
    flex: 1;
}

/* === CARDS === */
.card {
    border: none;
    border-radius: var(--card-radius);
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Stat / KPI Cards */
.stat-card {
    border: none;
    border-radius: var(--card-radius);
    overflow: hidden;
    position: relative;
}

.stat-card .card-body {
    padding: 1.2rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1;
}

.stat-card.stat-primary { background: linear-gradient(135deg, rgba(102,126,234,0.08), rgba(118,75,162,0.05)); }
.stat-card.stat-primary .stat-icon { background: rgba(102,126,234,0.15); color: #667eea; }

.stat-card.stat-success { background: linear-gradient(135deg, rgba(46,213,115,0.08), rgba(38,166,91,0.05)); }
.stat-card.stat-success .stat-icon { background: rgba(46,213,115,0.15); color: #2ed573; }

.stat-card.stat-warning { background: linear-gradient(135deg, rgba(255,165,2,0.08), rgba(255,140,0,0.05)); }
.stat-card.stat-warning .stat-icon { background: rgba(255,165,2,0.15); color: #ffa502; }

.stat-card.stat-danger { background: linear-gradient(135deg, rgba(255,71,87,0.08), rgba(238,90,36,0.05)); }
.stat-card.stat-danger .stat-icon { background: rgba(255,71,87,0.15); color: #ff4757; }

.stat-card.stat-info { background: linear-gradient(135deg, rgba(30,144,255,0.08), rgba(24,119,242,0.05)); }
.stat-card.stat-info .stat-icon { background: rgba(30,144,255,0.15); color: #1e90ff; }

.stat-card.stat-dark { background: linear-gradient(135deg, rgba(47,53,66,0.08), rgba(30,30,30,0.05)); }
.stat-card.stat-dark .stat-icon { background: rgba(47,53,66,0.15); color: #2f3542; }

/* === TABLES === */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--navbar-border);
    color: var(--table-head-color);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.9rem 1rem;
    background: var(--table-head-bg);
}

.table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--table-border);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.table-hover tbody tr:hover {
    background: rgba(102,126,234,0.04);
}

/* === BADGES === */
.badge {
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* === BUTTONS === */
.btn {
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4292 100%);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: #667eea;
    color: #667eea;
}
.btn-outline-primary:hover {
    background: #667eea;
    border-color: #667eea;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    border-radius: 6px;
}

/* === FORMS === */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid var(--input-border);
    padding: 0.6rem 0.9rem;
    transition: var(--transition);
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.input-group-text {
    border-radius: 8px 0 0 8px;
    border: 1.5px solid var(--input-border);
    background: var(--input-group-bg);
    color: var(--text-muted);
}

/* === ALERTS === */
.alert {
    border-radius: var(--card-radius);
    border: none;
    font-weight: 500;
}

.alert-success {
    background: rgba(46,213,115,0.12);
    color: #1a8a4a;
}

.alert-danger {
    background: rgba(255,71,87,0.12);
    color: #cc2936;
}

.alert-info {
    background: rgba(30,144,255,0.1);
    color: #1a6db5;
}

/* === PAGE HEADERS === */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-heading);
    margin: 0;
}

.page-header .page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

/* === LOGIN / AUTH PAGES === */
.auth-page {
    min-height: 100vh;
    display: flex;
}

/* Left branding panel */
.auth-branding {
    flex: 0 0 45%;
    background: linear-gradient(160deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}
.auth-branding::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102,126,234,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-branding::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(118,75,162,0.12) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-branding-content {
    position: relative;
    z-index: 1;
    color: #fff;
}
.auth-branding-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 30px rgba(102,126,234,0.4);
}
.auth-branding h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}
.auth-branding-tagline {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 2.5rem;
    max-width: 320px;
}
.auth-features {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.auth-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #667eea;
    flex-shrink: 0;
}
.auth-feature strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
}
.auth-feature span {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}
.auth-branding-footer {
    position: relative;
    z-index: 1;
    margin-top: 3rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
}

/* Right form panel */
.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--body-bg);
}
.auth-form-wrapper {
    width: 100%;
    max-width: 400px;
}
.auth-form-wrapper h3 {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-heading);
}

/* Auth inputs with icon */
.auth-input-wrapper {
    position: relative;
}
.auth-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    z-index: 2;
    pointer-events: none;
}
.auth-input {
    padding-left: 42px !important;
    height: 46px;
    border-radius: 10px !important;
    border: 1.5px solid var(--input-border) !important;
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    font-size: 0.92rem;
}
.auth-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12) !important;
}
.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-submit-btn {
    height: 46px;
    font-size: 1rem !important;
    font-weight: 600;
    border-radius: 10px !important;
    letter-spacing: 0.3px;
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--sidebar-active);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.6rem;
    color: #fff;
}

/* Auth responsive */
@media (max-width: 991.98px) {
    .auth-branding { display: none; }
    .auth-form-side { min-height: 100vh; }
}

/* === SCROLLBAR === */
#sidebar::-webkit-scrollbar {
    width: 4px;
}
#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

/* === DARK MODE OVERRIDES === */
[data-theme="dark"] .stat-card.stat-primary,
[data-theme="dark"] .stat-card.stat-success,
[data-theme="dark"] .stat-card.stat-warning,
[data-theme="dark"] .stat-card.stat-danger,
[data-theme="dark"] .stat-card.stat-info,
[data-theme="dark"] .stat-card.stat-dark {
    background: var(--card-bg);
}

[data-theme="dark"] .stat-card.stat-dark .stat-icon {
    background: rgba(255,255,255,0.1);
    color: #b0b0bc;
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background: rgba(102,126,234,0.08);
}

[data-theme="dark"] .alert-success { background: rgba(46,213,115,0.15); color: #5ae89a; }
[data-theme="dark"] .alert-danger { background: rgba(255,71,87,0.15); color: #ff7b86; }
[data-theme="dark"] .alert-info { background: rgba(30,144,255,0.15); color: #5eb3ff; }

[data-theme="dark"] .badge.bg-light {
    background: var(--card-bg) !important;
    color: var(--text-secondary) !important;
    border-color: var(--navbar-border) !important;
}

[data-theme="dark"] .user-dropdown {
    background: #1e1e2a;
    border-color: #2a2a3a;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    #sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
}
