:root {
    --primary-color: #00d1b2;
    --secondary-color: #ff3860;
    --bg-color: #0a0b10;
    --sidebar-bg: #11121a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-color: #f5f5f5;
    --text-muted: #888;
    --input-bg: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-glow: rgba(0, 209, 178, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 40px;
    background: linear-gradient(to right, #00d1b2, #00b89c);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
}

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

.nav-link i {
    margin-right: 12px;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-image: radial-gradient(circle at 50% -20%, #1a1c2e, #0a0b10);
}

.container {
    width: 100%;
    max-width: 700px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.5s ease-out;
    transition: max-width 0.3s ease;
}

.container.wide {
    max-width: 1600px;
    padding: 30px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

p.subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

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

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        gap: 15px;
    }
}

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

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: #ccc;
}

input,
select,
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

/* Ajuste para as opções do dropdown */
select option {
    background-color: #1a1c2e;
    color: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.12);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.type-toggle {
    display: flex;
    background: var(--input-bg);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.type-option {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    user-select: none;
}

.type-option.active.entrada {
    background: var(--primary-color);
    color: #000;
}

.type-option.active.saida {
    background: var(--secondary-color);
    color: white;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00d1b2 0%, #00b89c 100%);
    color: #000;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent-glow);
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(0, 209, 178, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(0, 209, 178, 0.3);
}

.alert-error {
    background: rgba(255, 56, 96, 0.15);
    color: var(--secondary-color);
    border: 1px solid rgba(255, 56, 96, 0.3);
}

/* Dashboard Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.card-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.card.receita .card-value {
    color: var(--primary-color);
}

.card.despesa .card-value {
    color: var(--secondary-color);
}

.card.saldo .card-value {
    color: #fff;
}

/* Filter Bar */
.filter-bar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: flex-end;
}

.filter-group label {
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.filter-btn {
    background: var(--primary-color);
    color: #000;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Finance Table */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-entrada {
    background: rgba(0, 209, 178, 0.15);
    color: var(--primary-color);
}

.badge-saida {
    background: rgba(255, 56, 96, 0.15);
    color: var(--secondary-color);
}

.badge-pago {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.badge-pendente {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.val-entrada {
    color: var(--primary-color);
    font-weight: 600;
}

.val-saida {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(17, 18, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-header .logo {
    margin-bottom: 0;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.menu-toggle,
.back-button {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1.2rem;
}

.menu-toggle:active,
.back-button:active {
    transform: scale(0.9);
    background: var(--primary-color);
    color: #000;
}

.menu-toggle i,
.back-button i {
    color: var(--primary-color);
}


/* Fallback for icon if FontAwesome fails */
.fa-bars::before,
.fa-solid.fa-bars::before {
    content: "\f0c9";
    min-width: 20px;
    display: inline-block;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 992px) {
    .container.wide {
        max-width: 100%;
    }
}

.mobile-actions {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.action-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 15px 10px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    text-align: center;
}

.action-card i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.action-card span {
    font-size: 0.75rem;
    font-weight: 600;
}

.action-card:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 1024px) {
    .mobile-actions {
        display: grid;
    }
}

@media (max-width: 1024px) {
    body {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
        background: #11121a;
        border-bottom: 2px solid var(--primary-color);
    }

    .sidebar {
        left: -280px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 15px 40px 15px;
        /* Top padding to clear fixed header */
    }

    .container {
        padding: 24px 20px;
        border-radius: 20px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .grid-items {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        padding: 20px;
    }

    .card-value {
        font-size: 1.3rem;
    }

    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-btn {
        grid-column: span 2;
    }

    /* Responsive Table */
    .table-container {
        margin: 0 -5px;
        border-radius: 12px;
    }

    table {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
        /* Hide headers on very small screens or use a card-based layout */
    }

    tr {
        display: block;
        border-bottom: 2px solid var(--border-color);
        padding: 15px 5px;
        position: relative;
    }

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 8px 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
        margin-right: 15px;
        text-align: left;
    }

    td:last-child {
        border-bottom: none;
    }

    .nav-link i {
        margin-right: 12px;
        /* Keep icons visible in mobile sidebar */
    }

    .nav-link span {
        display: inline;
        /* Keep text visible in mobile sidebar */
    }
}

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

    .filter-btn {
        grid-column: span 1;
    }

    h1 {
        font-size: 1.5rem;
    }
}