/* ============================================
   DECOR PREMIUM CRM — Base Styles v2.0
   Glassmorphism + Animated Background
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ── Animated Mesh Background ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--z-bg);
    background:
        radial-gradient(ellipse 600px 400px at 15% 20%, rgba(198, 169, 108, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 85% 80%, rgba(96, 165, 250, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 50% 50%, rgba(167, 139, 250, 0.03) 0%, transparent 70%);
    animation: gradientShift 20s ease-in-out infinite;
    background-size: 200% 200%;
    pointer-events: none;
}

/* ── App Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ── Sidebar (Glassmorphism) ── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--glass-bg-heavy);
    backdrop-filter: var(--glass-blur-heavy);
    -webkit-backdrop-filter: var(--glass-blur-heavy);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: var(--z-sidebar);
    transition: width var(--transition-base), min-width var(--transition-base);
    overflow-y: auto;
}

.sidebar-brand {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow-sm);
    transition: box-shadow var(--transition-base);
}

.sidebar-brand:hover .brand-icon {
    box-shadow: var(--shadow-glow);
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand .brand-name {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    letter-spacing: 0.5px;
}

.sidebar-brand .brand-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ── Navigation ── */
.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.nav-section-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-muted);
    padding: var(--space-3) var(--space-3) var(--space-1);
    font-weight: var(--font-weight-semibold);
    margin-top: var(--space-2);
}

.nav-section-label:first-child {
    margin-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    position: relative;
    user-select: none;
    overflow: hidden;
}

/* Hover glow effect */
.nav-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-base);
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(198, 169, 108, 0.08), transparent 60%);
    pointer-events: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
}

.nav-item:hover::after {
    opacity: 1;
}

.nav-item.active {
    background: var(--color-gold-glow);
    color: var(--color-gold);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--color-gold), var(--color-gold-dark));
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    box-shadow: 0 0 8px rgba(198, 169, 108, 0.4);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item .nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--transition-fast);
}

.nav-item:hover .nav-icon svg {
    transform: scale(1.1);
}

.nav-item .nav-badge {
    margin-left: auto;
    background: linear-gradient(135deg, var(--color-danger), #E85D5D);
    color: white;
    font-size: var(--text-xs);
    font-weight: var(--font-weight-bold);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
    animation: pulseBadge 2s infinite;
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.3);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-footer .stats-mini {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.sidebar-footer .stats-mini .stat-value {
    color: var(--color-gold);
    font-weight: var(--font-weight-bold);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    min-width: 0;
    box-sizing: border-box !important;
    padding: var(--space-6) var(--space-6) var(--space-6) var(--space-6) !important;
    min-height: 100vh;
    overflow-x: auto;
    overflow-y: auto;
    height: 100vh;
    animation: fadeIn 0.4s ease;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.page-header .page-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

/* ── Links ── */
a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-gold-light);
}

/* ── Selection ── */
::selection {
    background: var(--color-gold);
    color: var(--color-text-inverse);
}

/* ── Scrollbar (Premium) ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(198, 169, 108, 0.15);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(198, 169, 108, 0.3);
}

/* ── Hidden utility ── */
.hidden {
    display: none !important;
}

/* ── Page sections ── */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-collapsed);
        min-width: var(--sidebar-collapsed);
    }

    .sidebar .brand-text,
    .sidebar .nav-item span:not(.nav-badge),
    .sidebar .nav-section-label,
    .sidebar-footer .stats-mini span:first-child {
        display: none;
    }

    .main-content {
        padding: var(--space-4);
    }
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        height: 100vh;
        transition: transform var(--transition-smooth);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .main-content {
        padding: var(--space-4);
        height: auto;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
}