* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark: #1f2937;
    --light: #f9fafb;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.controls-section {
    padding: 30px 40px;
    background: var(--light);
    border-bottom: 2px solid var(--border);
}

.date-filters {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
}

.loading {
    text-align: center;
    padding: 60px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    margin: 20px 40px;
    padding: 15px 20px;
    background: #fee;
    border-left: 4px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
}

#resultsSection {
    padding: 40px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid var(--border);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
}

.total-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.total-card h3 {
    opacity: 1;
}

.card .value {
    font-size: 2rem;
    font-weight: 700;
    color: inherit;
}

#card-dinheiro { border-left: 5px solid #10b981; }
#card-debito { border-left: 5px solid #3b82f6; }
#card-credito { border-left: 5px solid #8b5cf6; }
#card-pix { border-left: 5px solid #ec4899; }
#card-transferencia { border-left: 5px solid #f59e0b; }

.table-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--border);
    margin-bottom: 40px;
}

.table-header {
    margin-bottom: 20px;
}

.table-header h2 {
    color: var(--dark);
    font-size: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
}

.data-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: var(--light);
}

.data-table td {
    color: var(--dark);
}

.data-table td.valor-cell {
    text-align: right;
    font-weight: 500;
}

.data-table td.quantidade-cell {
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}

.data-table tfoot {
    background: var(--light);
    font-weight: 700;
    border-top: 3px solid var(--primary-color);
}

.data-table tfoot td {
    padding: 15px;
    font-size: 1rem;
}

.mes-cell {
    font-weight: 600;
    color: var(--primary-color);
}

.total-cell {
    font-weight: 700;
    color: var(--primary-color);
    text-align: right;
    font-size: 1.05rem;
}

.subtotal-cell {
    text-align: right;
    font-weight: 700;
    color: #8b5cf6;
    font-size: 1rem;
    background-color: rgba(139, 92, 246, 0.05);
}

.chart-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--border);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.chart-header h2 {
    color: var(--dark);
    font-size: 1.5rem;
}

.chart-type-selector {
    display: flex;
    gap: 10px;
    background: var(--light);
    padding: 5px;
    border-radius: 10px;
}

.chart-type-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.chart-type-btn:hover {
    background: white;
}

.chart-type-btn.active {
    background: var(--primary-color);
    color: white;
}

#chartRecebimentos {
    max-height: 400px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .container {
        border-radius: 15px;
    }

    header {
        padding: 25px;
    }

    .controls-section {
        padding: 20px;
    }

    .date-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    #resultsSection {
        padding: 20px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        padding: 20px;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-type-selector {
        width: 100%;
        justify-content: space-between;
    }

    .card .value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .chart-type-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}
