/* ═══════════════════════════════════════════════════════
   Precificador — Design System (Light Theme Premium)
   ═══════════════════════════════════════════════════════ */
:root {
    --bg: #F3F5F9;
    --surface: #FFFFFF;
    --primary: #2563EB;
    --primary-light: #EFF6FF;
    --secondary: #7C3AED;
    --accent: #059669;
    --danger: #EF4444;
    --text: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 20px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.06);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── Header ── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
}
.app-header h1 span { font-weight: 300; color: var(--text-secondary); }
.subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Botão Tutorial ── */
.btn-help {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-help:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

/* ── Modal Tutorial ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: modalIn 0.3s ease-out;
}

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

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }

.tutorial-steps { display: flex; flex-direction: column; gap: 20px; }
.tutorial-step { display: flex; gap: 16px; align-items: flex-start; }
.step-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}
.step-text h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.step-text p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4; }

.tutorial-highlight {
    background: #FFFBEB;
    border: 1px solid #FEF3C7;
    padding: 16px;
    border-radius: 12px;
}
.tutorial-highlight h3 { color: #92400E; }
.tutorial-highlight p { color: #B45309; }

.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border); }

/* ── Container ── */
.dashboard-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ── Tab Navigation ── */
.tab-nav {
    display: flex;
    gap: 4px;
    background: var(--surface);
    padding: 6px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    overflow-x: auto;
}

.tab-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-btn:hover { background: var(--primary-light); color: var(--primary); }
.tab-btn.active { background: var(--primary); color: white; }

/* ── Tab Panel ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Card ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.card-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 24px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 24px 0 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ── Forms ── */
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.full-width { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; }

.form-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input, select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: #FAFBFC;
    transition: all 0.15s;
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

/* ── Tables ── */
.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 0.85rem;
    vertical-align: middle;
}

tbody tr:hover { background: #F9FAFB; }

/* Inputs dentro de tabelas */
table input, table select {
    padding: 7px 10px;
    font-size: 0.83rem;
    border-color: transparent;
    background: transparent;
}
table input:focus, table select:focus {
    border-color: var(--primary);
    background: white;
}

/* Colunas numéricas (somente leitura, calculadas) */
.calc-cell {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.calc-cell.accent { color: var(--accent); }
.calc-cell.primary { color: var(--primary); font-weight: 700; }

/* ── Buttons ── */
.btn-add {
    padding: 8px 18px;
    border: 2px dashed var(--border);
    background: transparent;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.btn-add:hover { border-color: var(--primary); background: var(--primary-light); }

.btn-remove {
    background: transparent;
    border: none;
    color: #D1D5DB;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.btn-remove:hover { color: var(--danger); background: #FEE2E2; }

.btn-export {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

/* ── Total Bar ── */
.total-bar {
    margin-top: 16px;
    padding: 14px 20px;
    background: var(--primary-light);
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    text-align: right;
}

/* ── Result Grid ── */
.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.result-card {
    background: #F9FAFB;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.result-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}
.result-value.accent { color: var(--accent); }
.result-value.big { font-size: 1.6rem; }

.result-card.highlight {
    background: #ECFDF5;
    border-color: #A7F3D0;
}
.result-card.highlight .result-value { color: var(--accent); }

.result-card.highlight-primary {
    background: var(--primary-light);
    border-color: #93C5FD;
    grid-column: span 3;
    text-align: center;
}
.result-card.highlight-primary .result-value {
    color: var(--primary);
    font-size: 2.4rem;
    font-weight: 800;
}

/* ── Selector Improvements ── */
.selector-container {
    padding: 24px;
    margin-bottom: 24px;
}

.selector-row {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.selector-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selector-label-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-label-wrapper .icon {
    font-size: 1.2rem;
}

.selector-controls {
    display: flex;
    gap: 12px;
}

.premium-select {
    flex: 1;
    font-weight: 600;
    color: var(--primary);
    border-color: var(--primary-light);
    background: var(--primary-light);
}

.premium-select:focus {
    background: white;
}

.selector-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.selector-divider {
    width: 1px;
    background: var(--border);
    align-self: stretch;
}

/* Action Buttons */
.btn-action-primary, .btn-action-secondary, .btn-action-success {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    white-space: nowrap;
}

.btn-action-primary {
    background: var(--primary);
    color: white;
}
.btn-action-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-action-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-action-secondary:hover {
    background: var(--primary-light);
}

.btn-action-success {
    background: #10B981;
    color: white;
}
.btn-action-success:hover {
    background: #059669;
}

.button-group {
    display: flex;
    gap: 8px;
}

.btn-remove-alt {
    background: #FEE2E2;
    border: 1px solid #FECACA;
    color: #DC2626;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-remove-alt:hover:not(:disabled) {
    background: #FCA5A5;
}
.btn-remove-alt:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

@media (max-width: 900px) {
    .selector-row { flex-direction: column; gap: 24px; }
    .selector-divider { height: 1px; width: 100%; }
}

/* ── Premium Tutorial Styles ── */
.tutorial-premium {
    padding: 0 24px 24px;
}

.tutorial-hero {
    text-align: center;
    padding: 20px 0 32px;
}

.tutorial-hero .badget {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tutorial-hero h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 12px 0 8px;
    color: var(--text);
}

.tutorial-hero p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

.tutorial-section {
    margin-bottom: 24px;
    padding: 16px;
    border-radius: 12px;
    background: #F9FAFB;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.tutorial-section:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.section-badge {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: block;
}

.section-badge.success {
    color: var(--accent);
}

.tutorial-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.icon-box {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.text-box strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 4px;
}

.text-box p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.highlight-tip {
    background: #ECFDF5;
    border-color: #A7F3D0;
}

.tutorial-footer-info {
    margin-top: 32px;
    padding: 16px;
    background: #FFFBEB;
    border-radius: 12px;
    border: 1px solid #FEF3C7;
}

.tutorial-footer-info p {
    font-size: 0.85rem;
    color: #92400E;
    margin: 0;
}

/* ── Mobile First & Responsividade Real ── */
@media (max-width: 600px) {
    .dashboard-container { padding: 0 12px 100px; }
    
    .tab-nav { 
        gap: 2px; 
        padding: 4px; 
        border-radius: 8px;
        position: sticky;
        top: 10px;
        z-index: 100;
    }
    
    .tab-btn { 
        padding: 8px 12px; 
        font-size: 0.75rem; 
        flex: 1;
        text-align: center;
    }

    .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
    
    .app-header { 
        flex-direction: column; 
        text-align: center; 
        gap: 16px; 
        padding: 16px 0; 
    }

    .selector-row {
        flex-direction: column;
        gap: 24px;
    }

    .selector-divider {
        width: 100%;
        height: 1px;
    }

    .result-grid { grid-template-columns: 1fr; }
    .result-card.highlight-primary { grid-column: span 1; }
    .result-card.highlight-primary .result-value { font-size: 1.8rem; }
    
    .modal-content { 
        max-height: 95vh; 
        margin: 10px; 
    }

    /* Tabelas Mobile */
    .table-container {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    table { font-size: 0.8rem; }
    table input, table select { font-size: 0.8rem; }
}

/* ── Status Badge Mini ── */
.status-badge-mini {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    background: #DCFCE7;
    color: #166534;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 8px;
    display: inline-block;
}
