@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Tema Padrão (ViverComPet Brand) */
    --primary-color: #C32675;
    /* Magenta */
    --primary-light: #F15642;
    /* Laranja */
    --primary-dark: #6D2E89;
    /* Roxo */
    --bg-gradient-start: #fcf9fa;
    --bg-gradient-end: #f4eff5;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

[data-theme="verde"] {
    --primary-color: #10b981;
    --primary-light: #34d399;
    --primary-dark: #059669;
    --bg-gradient-start: #ecfdf5;
    --bg-gradient-end: #d1fae5;
}

[data-theme="roxo"] {
    --primary-color: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-dark: #7c3aed;
    --bg-gradient-start: #f5f3ff;
    --bg-gradient-end: #ede9fe;
}

[data-theme="rosa"] {
    --primary-color: #ec4899;
    --primary-light: #f472b6;
    --primary-dark: #db2777;
    --bg-gradient-start: #fdf2f8;
    --bg-gradient-end: #fce7f3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Logo Dinâmica */
.dynamic-logo {
    background-color: var(--primary-light);
    -webkit-mask: url('../img/logo.png') no-repeat center / contain;
    mask: url('../img/logo.png') no-repeat center / contain;
    width: 100%;
    height: 40px;
    display: inline-block;
}

/* Utilitários Glassmorphism */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

/* Tipografia */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--primary-dark);
    font-weight: 700;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

.btn-google {
    background: white;
    color: #444;
    border: 1px solid #ddd;
}

.btn-google img {
    width: 20px;
}

.btn-google:hover {
    background: #f8f8f8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Layout de Login */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    text-align: center;
}

.login-card .logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.login-card .logo span {
    color: var(--primary-light);
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-muted);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #cbd5e1;
}

.divider:not(:empty)::before {
    margin-right: .25em;
}

.divider:not(:empty)::after {
    margin-left: .25em;
}

/* Dashboard Base */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    /* height: 100vh;
    max-height: 100vh; */
    position: sticky;
    top: 0;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 30px;
    color: var(--primary-dark);
    text-align: center;
}

.nav-link {
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-light);
    color: white;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-width: 0;
}

/* Gráficos */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Responsividade Mobile Avançada (Dashboard + Blog) */
@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .mobile-top-bar {
        display: flex !important;
    }

    .sidebar {
        width: 100% !important;
        height: auto !important;
        max-height: 0 !important;
        /* Começa fechado */
        padding: 0 20px !important;
        overflow: hidden !important;
        position: fixed !important;
        top: 65px !important;
        /* Altura exata da barra mobile */
        left: 0 !important;
        z-index: 1050 !important;
        background: var(--card-bg) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-radius: 0 !important;
        border-right: none !important;
        border-bottom: none !important; /* Sem borda quando fechada */
        box-shadow: none !important; /* Sem sombra quando fechada */
        visibility: hidden; /* Totalmente invisível para o leitor de tela e layout */
        transition: max-height 0.4s ease-in-out, padding 0.3s ease, visibility 0.4s ease !important;
    }

    .sidebar.active {
        max-height: calc(100vh - 65px) !important;
        /* Abre totalmente */
        padding: 20px !important;
        overflow-y: auto !important;
        border-bottom: 3px solid var(--primary-color) !important; /* Borda magenta ativa */
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important; /* Sombra ativa */
        visibility: visible;
    }

    .sidebar-brand {
        display: none !important;
        /* Esconde a marca interna no mobile */
    }

    .main-content {
        padding: 15px !important;
    }

    /* Converte todos os grids em colunas únicas automáticas */
    .dashboard-layout [style*="display: grid;"],
    .dashboard-layout [style*="display:grid;"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Força tabelas longas a terem scroll horizontal no celular */
    table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Melhora cards do blog quando estão empilhados no mobile */
    .glass-panel[style*="display: flex;"],
    .glass-panel[style*="display:flex;"] {
        flex-direction: column !important;
    }
}

/* Custom styles for finance page */
.finance-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1350px) {
    .finance-grid {
        grid-template-columns: 1fr;
    }
}

.finance-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.finance-charts-grid > div {
    min-width: 0;
}

.finance-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    display: table !important;
    overflow-x: visible !important;
}

.finance-table th,
.finance-table td {
    padding: 10px;
    font-size: 0.95rem;
}

.finance-table td.desc-cell {
    white-space: normal !important;
    word-break: break-word;
    min-width: 150px;
}

@media (max-width: 768px) {
    .finance-table th,
    .finance-table td {
        padding: 8px 5px !important;
        font-size: 0.85rem !important;
    }
}

.finance-total-amount {
    font-size: 3rem;
    color: white !important;
    margin: 0;
}

@media (max-width: 576px) {
    .finance-total-amount {
        font-size: 2.2rem !important;
    }
    .glass-panel {
        padding: 12px !important;
        border-radius: 12px !important;
    }
}