/**
 * Shadowgraphy Studio CRM - Dark Luxury Studio UI Theme
 * Pure Vanilla CSS - Zero external CDNs
 */

:root {
    --bg-base: #0b0c10;
    --bg-surface: #14161d;
    --bg-elevated: #1b1e28;
    --bg-input: #232734;
    --border-color: #2a2e3f;
    --border-focus: #e2b144;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --gold-main: #e2b144;
    --gold-hover: #c99b33;
    --gold-dim: rgba(226, 177, 68, 0.15);

    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-amber: #f59e0b;

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Staging Gate & Auth Layout */
.gate-body {
    background: radial-gradient(circle at top right, #1f2332, #0b0c10 80%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card-wrapper {
    width: 100%;
    max-width: 440px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.brand-crest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--gold-main), #8d6b1d);
    color: #0b0c10;
    font-weight: 900;
    font-size: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(226, 177, 68, 0.25);
    letter-spacing: -1px;
}

.auth-brand h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}

.brand-sub {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.auth-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border-radius: var(--radius-lg);
}

.auth-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.auth-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

/* Main CRM Shell Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-crest-sm {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--gold-main), #8d6b1d);
    color: #0b0c10;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
}

.brand-sub-sm {
    color: var(--gold-main);
    font-size: 10px;
    letter-spacing: 0.8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    padding: 12px 12px 6px;
    font-weight: 700;
}

.nav-menu {
    list-style: none;
    margin-bottom: 12px;
}

.nav-item {
    margin-bottom: 3px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 500;
}

.nav-link:hover {
    color: #fff;
    background: var(--bg-elevated);
}

.nav-link.active {
    color: #0b0c10;
    background: var(--gold-main);
    font-weight: 600;
}

.nav-icon {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
}

.sidebar-badge-currency {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
}

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

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-muted);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-separator {
    color: var(--text-dim);
}

.breadcrumb-current {
    color: #fff;
    font-weight: 600;
}

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

.topbar-clock {
    font-family: monospace;
    font-size: 13px;
    color: var(--gold-main);
    background: var(--gold-dim);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(226, 177, 68, 0.3);
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gold-main);
    color: #0b0c10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.app-content {
    flex: 1;
    padding: 28px;
}

.app-footer {
    height: 48px;
    border-top: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--bg-surface);
}

/* Common UI Components */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.15);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control, .form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    color: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(226, 177, 68, 0.2);
}

.form-section-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gold-main);
    margin: 16px 0 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--gold-main);
    color: #0b0c10;
}
.btn-primary:hover {
    background: var(--gold-hover);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-main);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}

.btn-outline-danger {
    background: transparent;
    border-color: var(--accent-red);
    color: var(--accent-red);
}
.btn-outline-danger:hover {
    background: var(--accent-red);
    color: #fff;
}

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

.btn-lg {
    padding: 12px 20px;
    font-size: 15px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-gold {
    background: var(--gold-dim);
    color: var(--gold-main);
    border: 1px solid rgba(226, 177, 68, 0.4);
}

.badge-secondary {
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Alerts */
.flash-container {
    padding: 16px 28px 0;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
}

/* Grid & Utilities */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 10px; }
.col-8  { flex: 0 0 66.666667%; max-width: 66.666667%; padding: 0 10px; }
.col-6  { flex: 0 0 50%; max-width: 50%; padding: 0 10px; }
.col-4  { flex: 0 0 33.333333%; max-width: 33.333333%; padding: 0 10px; }
.col-3  { flex: 0 0 25%; max-width: 25%; padding: 0 10px; }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }
.w-100 { width: 100%; }
.text-start { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-white { color: #fff; }
.text-gold { color: var(--gold-main); }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.border-none { border: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 20px; }
.p-4 { padding: 24px; }
.pb-0 { padding-bottom: 0 !important; }
.pt-0 { padding-top: 0 !important; }

/* Responsive */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: flex;
    }
    .d-none-mobile {
        display: none !important;
    }
    .col-8, .col-6, .col-4, .col-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}