/* ==========================================================================
   NEUMORPH DESIGN SYSTEM — Mobile-First, Responsivo, com Gráficos SVG
   ========================================================================== */

:root {
    --bg: #e0e5ec;
    --text: #2d3436;
    --text-light: #636e72;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --shadow-light: #ffffff;
    --shadow-dark: #a3b1c6;
    
    --neu-flat: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    --neu-pressed: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    --neu-convex: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ========== BOTÕES ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    background: var(--bg);
    color: var(--text);
    box-shadow: var(--neu-flat);
    white-space: nowrap;
}

.btn:hover { transform: translateY(-2px); box-shadow: var(--neu-convex); }
.btn:active { transform: translateY(0); box-shadow: var(--neu-pressed); }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.btn-outline:hover { background: var(--primary); color: white; }

.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

.btn-icon {
    background: var(--bg);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    box-shadow: var(--neu-flat);
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-icon:hover { box-shadow: var(--neu-convex); transform: translateY(-2px); }

/* ========== FORMULÁRIOS ========== */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.neu-input, .neu-select, .neu-textarea {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--neu-pressed);
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.neu-input:focus, .neu-select:focus, .neu-textarea:focus {
    box-shadow: var(--neu-pressed), 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.neu-textarea { resize: vertical; min-height: 100px; }

/* ========== ALERTAS ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    box-shadow: var(--neu-flat);
}

.alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }

/* ========== CARDS NEUMÓRFICOS ========== */
.neu-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--neu-flat);
    transition: var(--transition);
}

.neu-card:hover { box-shadow: var(--neu-convex); }

/* ========== LANDING PAGE ========== */
.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg);
    box-shadow: var(--neu-flat);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}

.logo { font-size: 1.3rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }

.landing-header nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.landing-header nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.95rem; }

.hero {
    padding: 60px 24px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.hero h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    line-height: 1.2;
    margin-bottom: 20px;
    font-weight: 800;
}

.highlight { color: var(--primary); }

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.features {
    padding: 60px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 48px;
    font-weight: 800;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.features-grid .icon { font-size: 2.8rem; margin-bottom: 16px; }
.features-grid h3 { margin-bottom: 12px; font-size: 1.2rem; }
.features-grid p { color: var(--text-light); font-size: 0.95rem; }

.landing-footer {
    text-align: center;
    padding: 30px 24px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ========== AUTH (LOGIN) ========== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--bg);
    padding: 36px 28px;
    border-radius: var(--radius);
    box-shadow: var(--neu-flat);
    text-align: center;
}

.auth-logo {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.auth-card h1 { margin-bottom: 8px; font-size: 1.6rem; }
.auth-subtitle { color: var(--text-light); margin-bottom: 28px; font-size: 0.95rem; }

.auth-form { text-align: left; }

.auth-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ========== APP LAYOUT ========== */
.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.app-sidebar {
    background: var(--bg);
    padding: 20px 16px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 150;
    transition: transform 0.3s ease;
}

.sidebar-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.sidebar-header .logo { font-size: 1.2rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-item:hover { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; box-shadow: var(--neu-convex); }

.app-main { display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }

.app-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-wrap: wrap;
}

.sidebar-toggle { display: none; }

.page-title { font-size: 1.3rem; flex: 1; font-weight: 700; }

.header-actions { display: flex; gap: 10px; align-items: center; }

.user-menu { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 8px 16px; 
    border-radius: var(--radius); 
    box-shadow: var(--neu-flat);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info strong { display: block; font-size: 0.85rem; line-height: 1.2; }
.user-info small { color: var(--text-light); font-size: 0.72rem; }

.app-content {
    padding: 24px;
    flex: 1;
    max-width: 100%;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
}

/* ========== DASHBOARD STATS ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    box-shadow: var(--neu-convex);
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.stat-icon.green { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); color: white; }
.stat-icon.orange { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; }
.stat-icon.purple { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white; }
.stat-icon.red { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); color: white; }
.stat-icon.teal { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); color: white; }

.stat-content { flex: 1; min-width: 0; }
.stat-label { color: var(--text-light); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.stat-change { font-size: 0.8rem; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ========== GRÁFICOS SVG ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.chart-card {
    padding: 24px;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-title .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 600;
}

/* Gráfico de Barras */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 180px;
    padding: 10px 0;
    border-bottom: 2px solid rgba(0,0,0,0.05);
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 8px 8px 0 0;
    transition: var(--transition);
    box-shadow: 2px 2px 6px var(--shadow-dark);
    min-height: 4px;
}

.bar:hover { opacity: 0.8; transform: scaleY(1.05); transform-origin: bottom; }

.bar-label {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 600;
    text-align: center;
}

/* Gráfico de Pizza (Donut) */
.donut-chart {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.donut-svg {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}

.donut-legend {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-label { flex: 1; color: var(--text); }
.legend-value { font-weight: 700; color: var(--text); }

/* ========== TABELAS ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.data-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0,0,0,0.02);
}

.data-table tr:hover { background: rgba(99, 102, 241, 0.04); }

.data-table .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== FORM GRID ========== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid .full-width { grid-column: 1 / -1; }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

/* ========== FOOTER ========== */
.app-footer {
    text-align: center;
    padding: 20px 24px;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: auto;
}

/* ========== OVERLAY MOBILE ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 140;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========== RESPONSIVO MOBILE ========== */
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 150;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    
    .app-sidebar.open { transform: translateX(0); }
    
    .sidebar-toggle { display: inline-flex; }
    
    .app-header { padding: 12px 16px; }
    .app-content { padding: 16px; }
    
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header h2 { font-size: 1.4rem; }
    
    .user-info { display: none; }
    
    .dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
    
    .stat-card { padding: 18px; }
    .stat-icon { width: 48px; height: 48px; font-size: 1.5rem; }
    .stat-value { font-size: 1.5rem; }
    
    .charts-grid { grid-template-columns: 1fr; }
    
    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 10px 8px; }
}

@media (max-width: 600px) {
    .landing-header { padding: 12px 16px; }
    .landing-header nav { gap: 10px; }
    .landing-header nav a { font-size: 0.85rem; }
    
    .hero { padding: 40px 16px; }
    .features { padding: 40px 16px; }
    
    .auth-card { padding: 28px 20px; }
    
    .form-grid { grid-template-columns: 1fr; }
    
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    
    .stat-card { flex-direction: column; text-align: center; align-items: center; }
    .stat-icon { margin-bottom: 8px; }
    
    .bar-chart { height: 140px; gap: 8px; }
    
    .donut-chart { flex-direction: column; align-items: center; }
    
    .header-actions { gap: 6px; }
    .btn-icon { width: 38px; height: 38px; font-size: 1rem; }
}

@media (max-width: 400px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .hero-actions { flex-direction: column; width: 100%; }
    .hero-actions .btn { width: 100%; }
}

/* ========== SCROLLBAR CUSTOM ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--shadow-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }