:root {
    /* DARK MODE (Padrão) */
    --bg-dark: #0a0c10;
    --bg-panel: #161a22;
    --bg-card: #21262d;
    --accent-red: #da3633;
    --accent-red-hover: #f85149;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --border-color: #30363d;
    --success-green: #2ea043;
}

body.light-mode {
    /* LIGHT MODE */
    --bg-dark: #f0f2f5;
    --bg-panel: #ffffff;
    --bg-card: #f8f9fa;
    --accent-red: #da3633;
    --accent-red-hover: #b82b29;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --success-green: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.logo-container {
    display: flex;
    align-items: center;
    padding: 0 24px 30px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.brand-icon {
    font-size: 28px;
    color: var(--accent-red);
    margin-right: 12px;
}

.brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 20px;
    line-height: 1.1;
    letter-spacing: 1px;
}

.brand-text span {
    color: var(--accent-red);
    font-size: 14px;
    letter-spacing: 2px;
}

.nav-menu {
    flex: 1;
    padding: 0 16px;
}

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

.nav-item i {
    width: 24px;
    font-size: 18px;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(218, 54, 51, 0.1);
    color: var(--accent-red);
    border-left: 3px solid var(--accent-red);
}

.status-panel {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success-green);
    box-shadow: 0 0 8px var(--success-green);
    margin-right: 12px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(46, 160, 67, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 160, 67, 0); }
}

.status-text {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-time {
    font-size: 14px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

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

.title-area h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.custom-select, .custom-input {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s;
}

.custom-select:focus, .custom-input:focus {
    border-color: var(--accent-red);
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.kpi-card.highlight {
    background: linear-gradient(135deg, rgba(218, 54, 51, 0.1) 0%, var(--bg-panel) 100%);
    border-color: rgba(218, 54, 51, 0.3);
}

#sortable-kpis .kpi-card.highlight {
    grid-column: span 2;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent-red);
    margin-right: 16px;
}

.kpi-card.highlight .kpi-icon {
    background-color: var(--accent-red);
    color: white;
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
}

/* Card de Receita: fonte maior e responsiva */
.kpi-card.highlight .kpi-value {
    font-size: clamp(18px, 2vw, 26px);
    white-space: nowrap;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.full-width {
    grid-column: 1 / -1;
}

.chart-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.chart-card h3 {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-muted);
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Tables */
.table-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.table-header h3 {
    font-size: 16px;
    color: var(--text-muted);
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    background-color: var(--bg-card);
}

.data-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
}

.participant-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.participant-filters,
.export-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.participant-summary {
    color: var(--text-muted);
    font-weight: 600;
}

.export-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.export-group {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.export-group h3 {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.export-btn {
    width: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.participants-table-wrap {
    max-height: calc(100vh - 390px);
    overflow: auto;
}

.participants-table th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.participants-table td {
    vertical-align: top;
}

.participants-table td:nth-child(1) {
    font-weight: 600;
}

.participants-table td:nth-child(4),
.participants-table td:nth-child(6) {
    white-space: nowrap;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-panel);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.modal-content h2 { margin-bottom: 15px; font-family: 'Outfit'; }
.modal-content p { color: var(--text-muted); margin-bottom: 25px; font-size: 14px;}
.modal-content input { width: 100%; margin-bottom: 20px; }

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-bottom: 10px;
    transition: 0.3s;
}

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

.btn-secondary {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background-color: var(--bg-card); color: white; }

/* Responsive */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .export-section { grid-template-columns: 1fr; }
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); padding: 10px 0; flex-direction: row; align-items: center; justify-content: space-between; }
    .logo-container { border: none; padding: 0 15px; margin: 0; }
    .nav-menu, .status-panel { display: none; }
    #sortable-kpis .kpi-card.highlight { grid-column: span 1; }
}

/* Drag and Drop Styles */
.drag-handle {
    transition: color 0.2s;
    padding: 5px;
}
.drag-handle:hover {
    color: var(--accent-blue) !important;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: var(--bg-body);
    border: 2px dashed var(--border-color);
}

.sortable-drag {
    cursor: grabbing !important;
    opacity: 1 !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3) !important;
}

/* Sync Overlay Styles */
.sync-modal {
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}
.sync-content {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    text-align: center;
    padding: 40px;
    max-width: 400px;
}
.skull-pulse {
    animation: pulse-skull 1.5s infinite ease-in-out;
}
@keyframes pulse-skull {
    0% { transform: scale(1); opacity: 0.8; filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2)); }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.6)); }
    100% { transform: scale(1); opacity: 0.8; filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2)); }
}
.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.progress-bar-indeterminate {
    width: 50%;
    height: 100%;
    background-color: var(--accent-red);
    position: absolute;
    border-radius: 3px;
    animation: indeterminate-progress 1.5s infinite linear;
}
@keyframes indeterminate-progress {
    0% { left: -50%; }
    100% { left: 100%; }
}
