/* ═══════════════════════════════════════════════════════════════
   SISTEMA DE FLUXO DE CAIXA - CSS BASE
   ═══════════════════════════════════════════════════════════════ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Mode - Tons suaves */
    --bg: #9c9c9c;
    --bg-card: #9c9c9c;
    --text: #2d2d2d;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #BBAE7F;
    --primary-dark: #a89968;
    --secondary: #9ca3af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --gradient-primary: linear-gradient(135deg, #BBAE7F 0%, #d4c9a0 100%);
    --gradient-login: linear-gradient(135deg, #BBAE7F 0%, #8b7f5c 100%);
}

body.dark-mode {
    --bg: #1a1a1a;
    --bg-card: #2d2d2d;
    --text: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #404040;
    --primary: #BBAE7F;
    --primary-dark: #a89968;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, #BBAE7F 0%, #8b7f5c 100%);
    --gradient-login: linear-gradient(135deg, #8b7f5c 0%, #6b5f4c 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-logos {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.navbar-brand h1 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 600;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
    color: var(--text);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--border);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 73px;
    bottom: 0;
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    padding-top: 3.5rem; /* Espaço para o botão toggle */
    overflow-y: auto;
    transition: width 0.3s, transform 0.3s;
    z-index: 50;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-label {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: background 0.2s, transform 0.1s;
}

.sidebar-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.sidebar-item:hover {
    background: var(--border);
    transform: translateX(4px);
}

.sidebar-item-logout {
    margin-top: auto;
    color: var(--danger);
}

.sidebar-icon {
    font-size: 1.5rem;
    min-width: 24px;
}

/* Main Content */
.main-content {
    margin-left: 240px;
    padding: 2rem;
    min-height: calc(100vh - 73px);
    transition: margin-left 0.3s;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.875rem;
    color: var(--text);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
    transition: transform 0.18s, box-shadow 0.18s;
}

.card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 10px 20px var(--shadow-hover);
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card-text-dark {
    color: #000000 !important;
    font-weight: 500;
}

/* Gradientes */
.card-gradient-blue { background: var(--gradient-primary); color: white; }
.card-gradient-primary { background: var(--gradient-primary); color: white; }
.card-gradient-green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; }
.card-gradient-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); color: white; }
.card-gradient-orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; }
.card-gradient-teal { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); color: white; }
.card-gradient-red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: white; }
.card-gradient-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; }

/* Botões */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #6b7280; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-block { width: 100%; }

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Toggle Buttons - Botões de Ativar/Desativar */
.btn-toggle {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-toggle-active {
    background: var(--success);
    color: white;
}

.btn-toggle-active:hover {
    background: #059669;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.btn-toggle-inactive {
    background: var(--danger);
    color: white;
}

.btn-toggle-inactive:hover {
    background: #dc2626;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

.btn-toggle:active {
    transform: translateY(0);
}

.btn-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tabelas */
table {
    width: 100%;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

thead {
    background: var(--primary);
    color: white;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--border);
}

/* Formulários */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.form-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    transition: border 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-danger { background: #fee2e2; color: #991b1b; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-secondary { background: #e5e7eb; color: #374151; }

/* Toasts */
.toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    color: var(--text);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Filtros */
.filters-box {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px var(--shadow);
}

.filters-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gradient-login);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-box {
    background: #e8e8e8;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.login-logo {
    height: 70px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
}

.login-title {
    text-align: center;
    color: #000000;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0 0;
}

.login-box form {
    margin-top: 1.5rem;
}

.login-box label {
    color: #000000;
    font-weight: 500;
}

.login-box input {
    color: #000000;
    background-color: #ffffff !important;
    border: 1px solid #cccccc;
}

.login-box input:focus {
    background-color: #ffffff !important;
    border-color: var(--primary);
    outline: none;
}

.login-box input::placeholder {
    color: #666666;
}

.login-hint {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #d4d4d4;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #000000;
}

.login-hint p {
    color: #000000;
    margin: 0.25rem 0;
}

.login-hint strong {
    color: #000000;
}

.login-hint code {
    background: #ffffff;
    color: #000000;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: monospace;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    thead {
        display: none;
    }
    
    tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border);
        border-radius: 8px;
    }
    
    tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 1rem;
    }
    
    tbody td::before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 1rem;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-box {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.modal-box h2 {
    margin-top: 0;
}

.modal-box p {
    color: var(--text);
    line-height: 1.6;
}
