/* ==================================================
   SISTEMA DE CONTROLE FINANCEIRO - OCEAN +
   Reset e Variáveis
   ================================================== */

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
}

/* ==================================================
   Container e Layout
   ================================================== */

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

.app-main {
    padding: 20px 0 80px;
    min-height: calc(100vh - 140px);
}

/* ==================================================
   Header
   ================================================== */

.app-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==================================================
   Footer
   ================================================== */

.app-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 40px;
}

/* ==================================================
   Login
   ================================================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-footer {
    margin-top: 24px;
}

.login-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.login-note svg {
    flex-shrink: 0;
    color: var(--info);
}

/* ==================================================
   Dashboard
   ================================================== */

.dashboard {
    margin-bottom: 40px;
}

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

.dashboard-header h2 {
    font-size: 28px;
    font-weight: 700;
}

.dashboard-period {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.dashboard-period span {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 140px;
    text-align: center;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==================================================
   Summary Cards
   ================================================== */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.summary-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-icon.balance {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.summary-icon.income {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.summary-icon.expense {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.summary-icon:not(.balance):not(.income):not(.expense) {
    background: var(--bg-secondary);
    color: var(--primary);
}

.summary-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-value.income {
    color: var(--success);
}

.summary-value.expense {
    color: var(--danger);
}

/* ==================================================
   Alertas
   ================================================== */

.alerts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.alert {
    background: var(--bg-primary);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert svg {
    flex-shrink: 0;
    color: var(--warning);
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.alert-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================================================
   Expense Breakdown
   ================================================== */

.expense-breakdown {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    margin-bottom: 32px;
}

.expense-breakdown h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.expense-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.expense-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.expense-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expense-category {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.expense-amount {
    font-weight: 600;
    color: var(--text-secondary);
}

.expense-bar-container {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.expense-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ==================================================
   Section
   ================================================== */

.section {
    margin-bottom: 40px;
}

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

.section-header h3 {
    font-size: 22px;
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

/* ==================================================
   Accounts
   ================================================== */

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.account-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
}

.account-card:hover {
    box-shadow: var(--shadow);
}

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

.account-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.account-actions {
    display: flex;
    gap: 4px;
}

.btn-action {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.account-balance {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

/* ==================================================
   Categories
   ================================================== */

.categories-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
}

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

.category-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-color-big {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
}

.category-type {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.category-type.income {
    background: #dcfce7;
    color: #166534;
}

.category-type.expense {
    background: #fee2e2;
    color: #991b1b;
}

.category-limit {
    margin-top: 12px;
}

.limit-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
}

.limit-spent {
    color: var(--text-secondary);
}

.limit-total {
    font-weight: 600;
    color: var(--text-primary);
}

.limit-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.limit-progress {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.limit-progress.normal {
    background: var(--success);
}

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

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

/* ==================================================
   Transactions
   ================================================== */

.transactions-list {
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.transaction-item:last-child {
    border-bottom: none;
}

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

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.transaction-icon.income {
    background: #dcfce7;
    color: #166534;
}

.transaction-icon.expense {
    background: #fee2e2;
    color: #991b1b;
}

.transaction-info {
    flex: 1;
    min-width: 0;
}

.transaction-description {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.transaction-amount {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.transaction-amount.income {
    color: var(--success);
}

.transaction-amount.expense {
    color: var(--danger);
}

.transaction-actions {
    display: flex;
    gap: 4px;
}

/* ==================================================
   Empty State
   ================================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ==================================================
   Forms
   ================================================== */

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

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-large {
    font-size: 24px !important;
    font-weight: 600;
    text-align: center;
}

.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.type-btn {
    padding: 12px;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.type-btn:hover {
    border-color: var(--primary);
}

.type-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

/* ==================================================
   Buttons
   ================================================== */

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

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

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

/* ==================================================
   FAB (Floating Action Button)
   ================================================== */

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 50;
}

.fab:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* ==================================================
   Modal
   ================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

.modal-small {
    max-width: 400px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
}

/* ==================================================
   Toast
   ================================================== */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

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

/* ==================================================
   Responsive
   ================================================== */

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .filters {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .accounts-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-list {
        grid-template-columns: 1fr;
    }
    
    .transaction-item {
        flex-wrap: wrap;
    }
    
    .transaction-amount {
        width: 100%;
        text-align: right;
        margin-top: 8px;
    }
    
    .login-card {
        padding: 32px 24px;
    }
    
    .modal-content {
        margin: auto;
    }
}

@media (max-width: 480px) {
    .summary-value {
        font-size: 20px;
    }
    
    .account-balance {
        font-size: 24px;
    }
    
    .transaction-meta {
        flex-direction: column;
        gap: 4px;
    }
}