:root {
    --primary: #82B59C; /* Logo Sage Green */
    --primary-dark: #62947b;
    --secondary: #2C3E50;
    --bg-light: #F8FAFC;
    --text-main: #334155;
    --text-muted: #64748B;
    --white: #FFFFFF;
    --border: #E2E8F0;
    --corte: #EF4444; /* Red for CORTE/DNF */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: var(--white);
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom: 4px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container .logo {
    max-height: 80px;
    object-fit: contain;
}

.header-text h1 {
    font-weight: 800;
    color: var(--primary);
    margin-top: 10px;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

.header-text p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 300;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 40vh;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Filters Section */
.filters-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    transition: border-color 0.3s, box-shadow 0.3s;
    background-color: var(--bg-light);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(130, 181, 156, 0.2);
}

/* Summary Bar */
.summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.summary p {
    font-weight: 600;
    color: var(--secondary);
    font-size: 1.1rem;
}

.actions button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

#btn-clear {
    background: var(--bg-light);
    color: var(--text-muted);
    border: 1px solid var(--border);
    margin-right: 10px;
}

#btn-clear:hover {
    background: var(--border);
    color: var(--text-main);
}

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

#btn-print:hover {
    background: var(--primary-dark);
}

/* Table */
.table-responsive {
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.results-table th,
.results-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.results-table th {
    background-color: var(--secondary);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.results-table tbody tr {
    transition: background-color 0.2s;
}

.results-table tbody tr:hover {
    background-color: #F1F5F9;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge-status {
    background: var(--corte);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-right: 5px;
}

.cat-badge {
    background: rgba(130, 181, 156, 0.15);
    color: var(--primary-dark);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.pos-1 { color: #D4AF37; font-weight: 800; font-size: 1.1rem; }
.pos-2 { color: #C0C0C0; font-weight: 800; font-size: 1.1rem; }
.pos-3 { color: #CD7F32; font-weight: 800; font-size: 1.1rem; }

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results i {
    color: var(--primary);
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Footer */
footer {
    background: var(--secondary);
    color: var(--white);
    text-align: center;
    padding: 25px 20px;
    margin-top: auto;
}

footer p {
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Print Styles */
@media print {
    body { background: white; }
    .filters-section, .actions, footer { display: none !important; }
    .app-header { border-bottom: none; box-shadow: none; padding: 0 0 20px 0; }
    .container { max-width: 100%; padding: 0; box-shadow: none; }
    .table-responsive { box-shadow: none; border-radius: 0; }
    .results-table th { background-color: #000 !important; color: white !important; -webkit-print-color-adjust: exact; color-adjust: exact; }
}

@media (max-width: 768px) {
    .filters-section { grid-template-columns: 1fr; }
    .header-text h1 { font-size: 1.5rem; }
    .table-responsive { border-radius: 0; }
}
