/* ============================================
   SAL - Design System
   Plaza Shopping - Sistema Premium
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================
   CSS Variables - Design Tokens
   ========================================== */
:root {
    /* Brand Colors - Synapx Identity */
    --brand-primary: #0052FF;
    --brand-primary-light: #3378FF;
    --brand-primary-dark: #003FCC;
    --brand-primary-50: rgba(0, 82, 255, 0.08);
    --brand-primary-100: rgba(0, 82, 255, 0.15);
    --brand-gradient: linear-gradient(135deg, #0052FF 0%, #0066FF 50%, #3378FF 100%);
    --brand-gradient-hover: linear-gradient(135deg, #003FCC 0%, #0052FF 50%, #0066FF 100%);

    /* Status Colors */
    --status-pendente: #f59e0b;
    --status-pendente-bg: rgba(245, 158, 11, 0.12);
    --status-aprovado: #10b981;
    --status-aprovado-bg: rgba(16, 185, 129, 0.12);
    --status-reprovado: #ef4444;
    --status-reprovado-bg: rgba(239, 68, 68, 0.12);
    --status-analise: #3b82f6;
    --status-analise-bg: rgba(59, 130, 246, 0.12);
    --status-resolvido: #8b5cf6;
    --status-resolvido-bg: rgba(139, 92, 246, 0.12);

    /* Priority Colors */
    --priority-baixa: #6b7280;
    --priority-media: #3b82f6;
    --priority-alta: #f59e0b;
    --priority-urgente: #ef4444;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(0, 82, 255, 0.15);
    --shadow-card-hover: 0 20px 40px -12px rgba(0, 82, 255, 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;
    --header-height: 68px;
    --content-max-width: 1400px;

    /* Z-Index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
}

/* ==========================================
   LIGHT THEME (Default)
   ========================================== */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-active: #e2e8f0;
    --bg-input: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.85);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;

    --border-primary: #e2e8f0;
    --border-secondary: #f1f5f9;
    --border-focus: var(--brand-primary);
    --border-input: #cbd5e1;

    --scrollbar-bg: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   DARK THEME
   ========================================== */
[data-theme="dark"] {
    --bg-primary: #0c0e14;
    --bg-secondary: #13161f;
    --bg-tertiary: #1a1d2b;
    --bg-elevated: #1e2235;
    --bg-hover: #1e2235;
    --bg-active: #262b3f;
    --bg-input: #1a1d2b;
    --bg-sidebar: #0f1119;
    --bg-header: rgba(12, 14, 20, 0.85);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;

    --border-primary: #1e293b;
    --border-secondary: #1a1d2b;
    --border-focus: var(--brand-primary);
    --border-input: #334155;

    --scrollbar-bg: #1a1d2b;
    --scrollbar-thumb: #334155;

    --glass-bg: rgba(19, 22, 31, 0.7);
    --glass-border: rgba(30, 41, 59, 0.5);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   BASE RESET
   ========================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--brand-primary-light);
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================
   LAYOUT
   ========================================== */
#app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-primary);
    z-index: var(--z-sticky);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-base), transform var(--transition-base);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 800;
    font-size: var(--text-lg);
    color: white;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-sub {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    user-select: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--brand-primary-50);
    color: var(--brand-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--brand-primary);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-item.active .nav-item-icon {
    opacity: 1;
}

.nav-item-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-badge.urgente {
    background: var(--priority-urgente);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.sidebar-footer {
    padding: var(--space-4) var(--space-3);
    border-top: 1px solid var(--border-primary);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--bg-hover);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: capitalize;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-base);
}

/* ---- Header ---- */
.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-primary);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.header-breadcrumb span {
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ---- Page Content ---- */
.page-content {
    flex: 1;
    padding: var(--space-8);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

/* ==========================================
   Login Page
   ========================================== */
.login-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: 
        radial-gradient(circle at 25% 25%, var(--brand-primary) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, var(--brand-primary) 1px, transparent 1px);
    background-size: 60px 60px;
}

.login-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: var(--brand-gradient);
    opacity: 0.06;
    filter: blur(120px);
    top: -200px;
    right: -200px;
    animation: float-glow 8s ease-in-out infinite;
}

@keyframes float-glow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-40px, 40px); }
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: var(--space-10);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s var(--transition-spring);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-8);
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    box-shadow: 0 8px 24px rgba(0, 82, 255, 0.3);
}

.login-logo-icon svg {
    width: 32px;
    height: 32px;
    color: white;
}

.login-title {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
}

.login-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    text-align: center;
    margin-top: var(--space-1);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.login-error {
    padding: var(--space-3) var(--space-4);
    background: var(--status-reprovado-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--status-reprovado);
    font-size: var(--text-sm);
    display: none;
    animation: shake 0.4s ease;
}

.login-error.show {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
