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

:root {
    /* Colors - Vibrant Dark Mode */
    --bg-base: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-surface-hover: rgba(51, 65, 85, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --blur-glass: blur(12px);
    
    /* Layout */
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Font */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Responsive spacing */
    --page-padding: 2rem;
    --section-gap: 1.5rem;
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(245, 158, 11, 0.15), transparent 25%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.5;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-size: 16px;
}

/* Scrollbar Customization */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #4B5563; border-radius: 4px; }


h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* ===== GLASSMORPHISM ===== */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
}

.glass-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ===== TYPOGRAPHY ===== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== INPUTS & BUTTONS ===== */
.input-group { margin-bottom: 1.2rem; }

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Nova Regra (Aprendizado Zenix): Padrão UI Dark Mode para inputs */
.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="password"],
.modal-content input[type="email"],
.modal-content select,
.modal-content textarea,
.input-glass {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus,
.input-glass:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background-color: rgba(15, 23, 42, 0.9);
}

/* select arrow fix on dark bg */
select.input-glass {
    appearance: auto;
    -webkit-appearance: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 32px);
}

.toast {
    padding: 0.9rem 1.4rem;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease forwards, fadeOut 0.3s ease 3s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 380px;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--info); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    width: 100%;
    max-width: 620px;
    padding: 10px;
    max-height: 92vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 1;
}

.modal-header h2 { font-size: 1.15rem; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.modal-close:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.modal-body  { padding: 1.5rem; }

.modal-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ===== FORM GRID ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-grid .full-width { grid-column: 1 / -1; }

/* ===== DATA TABLES ===== */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
}

.data-table thead tr {
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(255,255,255,0.04);
}

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ===== MARKUP CALCULATOR ===== */
.markup-calculator {
    background: linear-gradient(135deg, rgba(101, 84, 192, 0.12), rgba(0, 184, 217, 0.08));
    border: 1px solid rgba(101, 84, 192, 0.35);
    border-radius: var(--radius-sm);
    padding: 1.2rem 1.4rem;
    margin-top: 0.5rem;
}
.markup-calculator h4 {
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.markup-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.markup-row.two-col { grid-template-columns: 1fr 1fr; }
.markup-input-group label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 4px;
}
.markup-input-group input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: white;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    box-sizing: border-box;
}
.markup-input-group input:focus { outline: none; border-color: var(--primary); }
.markup-result-box {
    background: rgba(101, 84, 192, 0.2);
    border: 1px solid rgba(101, 84, 192, 0.5);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.markup-result-label { font-size: 0.78rem; color: var(--text-muted); }
.markup-result-value {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.markup-breakdown {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.7;
}
.markup-breakdown span { color: #fff; font-weight: 600; }
.btn-markup-apply {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.btn-markup-apply:hover { opacity: 0.85; }
.markup-toggle {
    background: none;
    border: 1px solid rgba(101,84,192,0.4);
    border-radius: 6px;
    color: var(--primary);
    font-size: 0.78rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    transition: background 0.2s;
}
.markup-toggle:hover { background: rgba(101,84,192,0.15); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn  { from { opacity: 0; }               to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* --- Tablet landscape + Desktop (>= 1024px) --- */
@media (min-width: 1024px) {
    :root { --page-padding: 2rem; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .markup-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* --- Mobile e Janela Pequena (<= 1024px) --- */
@media (max-width: 1024px) {
    :root {
        --page-padding: 0.9rem;
        --section-gap: 1rem;
        font-size: 14px;
    }

    /* Modals: center on mobile to avoid flex-end crop bugs */
    .modal-content {
        max-width: 100%;
        max-height: 85vh;
        border-radius: var(--radius-sm);
        margin: auto;
    }

    .modal-overlay {
        align-items: center;
        padding: 1rem;
    }

    .modal-body  { padding: 1rem; }
    .modal-header { padding: 1rem; }
    .modal-footer { padding: 1rem; gap: 0.5rem; }
    .modal-footer .btn { flex: 1; text-align: center; justify-content: center; }

    /* Form grid: 1 coluna no mobile */
    .form-grid { grid-template-columns: 1fr; }

    /* Markup: 1 col */
    .markup-row { grid-template-columns: 1fr; }
    .markup-row.two-col { grid-template-columns: 1fr; }

    /* Botões menores */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.88rem;
    }

    /* Stats grid: 1 col */
    .stats-grid { grid-template-columns: 1fr !important; }

    /* PDV: empilha */
    #view-pdv .stats-grid { grid-template-columns: 1fr !important; }

    /* Tabelas: scroll horizontal */
    table { font-size: 0.8rem; }
    table th, table td { padding: 0.6rem 0.5rem; }

    /* Kanban: scroll horizontal, cards menores */
    .kanban-board {
        height: auto !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
    }
    .kanban-column { flex: 0 0 260px; }

    /* Toast: full width no mobile */
    .toast-container { top: 8px; right: 8px; left: 8px; max-width: 100%; }
    .toast { max-width: 100%; font-size: 0.85rem; }

    /* Top header: compacto */
    .top-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }

    .top-header .header-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .top-header .header-actions .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.82rem;
    }

    /* Ícones: esconder texto em botões de ação pequenos */
    .btn-icon-only span.btn-label { display: none; }

    /* Inputs: tamanho mínimo ok no mobile */
    .input-glass { padding: 0.65rem 0.85rem; font-size: 0.9rem; }

    /* Glass panel padding reduzido */
    .glass-panel { border-radius: var(--radius-md); }

    /* Stat card value menor */
    .stat-card .value { font-size: 1.8rem !important; }
}

/* --- Mobile pequeno (≤ 380px) --- */
@media (max-width: 380px) {
    :root { font-size: 13px; }

    .btn { padding: 0.55rem 0.85rem; font-size: 0.82rem; }

    .modal-header h2 { font-size: 1rem; }

    .kanban-column { flex: 0 0 230px; }
}


/* MODO FLORESTA */
body.forest-mode {
    --bg-main: #0f1a15 !important;
    --surface: #14281d !important;
    --surface-hover: #1c3d2a !important;
    --primary: #10b981 !important;
    --primary-hover: #059669 !important;
    --secondary: #047857 !important;
    --text-main: #e2e8f0 !important;
    --text-muted: #94a3b8 !important;
    --glass-bg: rgba(20, 40, 29, 0.7) !important;
    --glass-border: rgba(16, 185, 129, 0.2) !important;
    background: linear-gradient(135deg, #0f1a15 0%, #14281d 100%) !important;
}
