/* CSS RESET & VARS */
:root {
    --bg-dark: #090d16;
    --bg-card: rgba(18, 24, 38, 0.85);
    --border-card: rgba(255, 255, 255, 0.1);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --emerald: #10b981;
    --emerald-bg: rgba(16, 185, 129, 0.15);
    --blue: #3b82f6;
    --purple: #a855f7;
    --amber: #f59e0b;
    --rose: #f43f5e;
    --pbi-header-bg: #4a004e;
    --pbi-header-text: #ffffff;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(168, 85, 247, 0.12) 0%, transparent 40%);
    background-attachment: fixed;
}

/* UTILS & GLASS */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-15 { margin-top: 15px; }

.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    animation: fadeInUp 0.5s ease-out;
}

.brand-logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin: 0 auto 15px auto;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.brand-logo h2 {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 700;
    color: #fff;
}

.brand-logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* FORM & SELECT DROPDOWN FIXES */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.input-group input, select {
    background: #1a2234 !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px;
    padding: 10px 14px;
    color: #ffffff !important;
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.input-group input:focus, select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3) !important;
    background: #222b42 !important;
}

select option {
    background-color: #121826 !important;
    color: #ffffff !important;
    padding: 12px !important;
    font-size: 14px !important;
}

select option:hover, select option:focus, select option:checked {
    background-color: #4f46e5 !important;
    color: #ffffff !important;
}

/* POWER BI STYLE SLIDER CARD */
.pbi-filter-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.pbi-slider-card {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #141c2c;
    border-radius: 10px;
}

.pbi-slider-card label {
    font-size: 12px;
    font-weight: 600;
    color: #d1d5db;
}

.pbi-slider-body {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pbi-range-slider {
    width: 130px;
    accent-color: #a855f7;
    cursor: pointer;
}

.input-pct-badge {
    display: flex;
    align-items: center;
    background: #0d131f;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 2px 6px;
}

.acai-num-input {
    width: 44px !important;
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    text-align: right;
    padding: 2px 0 !important;
}

.input-pct-badge span {
    font-weight: 700;
    color: #c084fc;
    font-size: 12px;
}

/* TABELA ESTILO POWER BI (ROXA / PURPLE THEME EXATO DA IMAGEM) */
.pbi-table-card {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 12px;
}

.pbi-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: #ffffff;
    background: #121826;
}

.pbi-header-row th {
    background-color: var(--pbi-header-bg) !important;
    color: var(--pbi-header-text) !important;
    font-weight: 700;
    font-size: 13px;
    padding: 12px 14px;
    border-bottom: 2px solid #6b1170;
    text-transform: none;
}

.pbi-header-row th i {
    font-size: 11px;
    margin-left: 4px;
}

.pbi-data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #e5e7eb;
}

.pbi-data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.pbi-data-table tbody tr:hover {
    background-color: rgba(168, 85, 247, 0.12);
}

.pbi-total-row td {
    background-color: #1a2234 !important;
    color: #ffffff !important;
    font-weight: 800;
    padding: 12px 14px;
    border-top: 2px solid var(--pbi-header-bg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-block { width: 100%; }

.login-error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    font-size: 12px;
    color: var(--text-muted);
}

/* NAVBAR */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    background: rgba(14, 20, 33, 0.9);
    border-bottom: 1px solid var(--border-card);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left, .navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 500;
    color: #fff;
}

.brand-badge i {
    color: var(--primary);
    font-size: 22px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--emerald);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--emerald);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--emerald);
    animation: pulse 2s infinite;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
    border: 1px solid var(--border-card);
}

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

.user-info span {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.user-info small {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-card);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--rose);
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
}

/* CONTENT CONTAINER */
.dashboard-content {
    padding: 32px;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* FILTER SECTION */
.filter-section {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border-card);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-primary-outline {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary-outline:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* KPI CARDS GRID */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.kpi-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-header span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--amber); }

.kpi-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: #fff;
}

.kpi-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-emerald { background: rgba(16, 185, 129, 0.2); color: var(--emerald); }
.badge-purple { background: rgba(168, 85, 247, 0.2); color: var(--purple); }
.badge-rose { background: rgba(244, 63, 94, 0.2); color: var(--rose); }
.badge-neutral { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }
.badge-info { background: rgba(59, 130, 246, 0.2); color: var(--blue); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--amber); }

.kpi-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

/* GOAL PROGRESS BAR */
.goal-progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--purple));
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

.goal-meta-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.goal-percent {
    color: var(--purple);
    font-weight: 700;
}

.goal-remain {
    color: var(--text-muted);
}

/* CHARTS GRID */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.chart-span-2 { grid-column: span 2; }
.chart-span-3 { grid-column: span 3; }

.chart-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.card-title i { color: var(--primary); }

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

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

/* TABLES */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.data-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
}

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

.data-table tbody tr {
    transition: background 0.2s ease;
}

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

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    width: 100%;
    max-width: 460px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-family: var(--font-heading);
    color: #fff;
    font-size: 20px;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.btn-close:hover { color: #fff; }

/* ANIMATIONS */
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chart-span-2, .chart-span-3 { grid-column: span 1; }
}

@media (max-width: 768px) {
    .dashboard-content { padding: 16px; }
    .navbar { padding: 14px 16px; }
    .filter-section { flex-direction: column; align-items: flex-start; }
}
