/**
 * NELLEUS - Sistema de Gestão Financeira
 * CSS Responsivo Mobile-First
 */

/* =============================================
   RESET E CONFIGURAÇÕES GERAIS
   ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores principais */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Cores de fundo */
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-dark: #1e293b;
    
    /* Cores de texto */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    /* Bordas */
    --border-color: #e2e8f0;
    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Espaçamentos */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Transições */
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================
   LAYOUT PRINCIPAL
   ============================================= */
.layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: var(--spacing-lg);
}

/* =============================================
   HEADER E NAVEGAÇÃO
   ============================================= */
.top-header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: var(--spacing-xs);
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.logout-btn {
    color: var(--danger);
    text-decoration: none;
    font-size: 1.25rem;
    padding: var(--spacing-xs);
}

.logout-btn:hover {
    opacity: 0.7;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: 280px;
    background-color: var(--bg-white);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.sidebar-menu {
    flex: 1;
    padding: var(--spacing-md) 0;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    margin: 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
    background-color: var(--bg-light);
    color: var(--primary);
}

.sidebar-nav-link i {
    margin-right: var(--spacing-sm);
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
    margin-bottom: var(--spacing-xl);
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* =============================================
   KPI CARDS
   ============================================= */
.kpi-grid {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    margin-bottom: var(--spacing-xl);
}

.kpi-card {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-lg);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-icon.blue {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.kpi-icon.green {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.kpi-icon.red {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.kpi-icon.yellow {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* =============================================
   PAYBACK WIDGET
   ============================================= */
.payback-widget {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.payback-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.payback-progress {
    height: 24px;
    background-color: var(--bg-light);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.payback-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    transition: width 0.5s ease;
}

.payback-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* =============================================
   CHARTS
   ============================================= */
.charts-grid {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    margin-bottom: var(--spacing-xl);
}

.chart-card {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-lg);
}

.chart-header {
    margin-bottom: var(--spacing-lg);
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    height: 300px;
}

/* =============================================
   TRANSAÇÕES RECENTES
   ============================================= */
.recent-transactions {
    background-color: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    padding: var(--spacing-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    flex: 1;
}

.transaction-desc {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.transaction-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.transaction-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.transaction-value.entrada {
    color: var(--success);
}

.transaction-value.saida {
    color: var(--danger);
}

/* =============================================
   BOTÕES
   ============================================= */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* =============================================
   FORMULÁRIOS
   ============================================= */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =============================================
   RESPONSIVIDADE
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: block;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .main-content {
        margin-left: 280px;
    }
}

/* ========================================
   USER MENU DROPDOWN
======================================== */

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-menu-toggle:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.user-role {
    font-size: 12px;
    color: #6b7280;
}

.user-menu-toggle i {
    color: #6b7280;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.user-menu-toggle.active i {
    transform: rotate(180deg);
}

/* Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.user-dropdown-header strong {
    display: block;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
}

.user-dropdown-header small {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.user-dropdown-body {
    padding: 8px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #374151;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.user-dropdown-item:hover {
    background: #f3f4f6;
    color: #2563eb;
}

.user-dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.user-dropdown-item.text-danger {
    color: #ef4444;
}

.user-dropdown-item.text-danger:hover {
    background: #fee;
    color: #dc2626;
}

.user-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

/* Responsivo */
@media (max-width: 768px) {
    .user-info {
        display: none;
    }
    
    .user-menu-toggle {
        padding: 8px 12px;
    }
    
    .user-dropdown {
        right: -10px;
    }
}

/* User Info Simple */
.user-info-simple {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}

.user-role {
    font-size: 12px;
    color: #64748b;
}

.logout-btn {
    padding: 8px;
    border-radius: 6px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}