/* ========================================
   CONTROLE DE ORÇAMENTOS - CSS PRINCIPAL
   ======================================== */

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

:root {
    --bg: #FAFAFA;
    --card: #FFFFFF;
    --text: #1A1A1A;
    --text-light: #6B6B6B;
    --border: #E5E5E5;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --accent: #3B82F6;
    --radius: 12px;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg: #0F0F0F;
    --card: #1A1A1A;
    --text: #FAFAFA;
    --text-light: #A0A0A0;
    --border: #2A2A2A;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --accent: #3B82F6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content {
    flex: 1;
}

h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-light);
    font-size: 16px;
}

/* Toggle Dark Mode */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.theme-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    transition: background 0.3s ease;
}

.theme-switch.active {
    background: var(--accent);
}

.theme-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.theme-switch.active .theme-slider {
    transform: translateX(24px);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s ease, border-color 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

.kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 36px;
    font-weight: 600;
    margin-bottom: 8px;
}

.kpi-change {
    font-size: 14px;
    font-weight: 500;
}

.kpi-change.positive { 
    color: var(--success); 
}

.kpi-change.negative { 
    color: var(--danger); 
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
}

/* Filtro de categorias */
.filtro-select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
    transition: all 0.2s;
    min-width: 200px;
}

.filtro-select:hover {
    border-color: var(--accent);
}

.filtro-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Grupo de ações (filtro + botão) */
.section-header > div {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: nowrap;
}

.section-header .btn {
    white-space: nowrap;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #2563EB;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

/* Blocos Grid */
.blocos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.bloco-card {
    background: var(--card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s ease, border-color 0.3s ease;
}

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

.bloco-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.bloco-meta {
    font-size: 14px;
    color: var(--text-light);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

.progress-fill.warning { 
    background: var(--warning); 
}

.progress-fill.danger { 
    background: var(--danger); 
}

.bloco-stats {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    display: block;
}

.stat-label {
    color: var(--text-light);
    font-size: 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.input-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.form-actions .btn {
    flex: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--text);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}