:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
    --accent: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* Custom Premium Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

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

/* Glassmorphism & Animations */
.glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

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

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

/* Elite Dashboard Shell */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Mantém a altura fixa do viewport */
    overflow: hidden;
}

.top-nav {
    height: 70px;
    flex-shrink: 0; /* Impede que a nav encurte */
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0 2rem;
}

.top-nav .logo {
    font-size: 1.5rem;
    letter-spacing: 2px;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.layout-body {
    display: flex;
    flex: 1;
    overflow: hidden; /* O scroll será controlado pelo main-content */
}

.sidebar {
    width: 280px;
    height: 100%;
    flex-shrink: 0;
    background: #0b0f1a; /* Mais profundo para contraste */
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem; 
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    text-decoration: none;
    border-radius: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid transparent;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    opacity: 0.8;
    color: var(--primary);
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    color: #fff;
    transform: translateX(5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border-color: rgba(99, 102, 241, 0.3);
    color: #fff;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.3);
}

.nav-item.active i {
    color: #fff;
    opacity: 1;
}

.main-content {
    flex: 1;
    display: block; /* Mudança para block para permitir scroll natural */
    padding: 2.5rem;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    scroll-behavior: smooth;
    position: relative;
    min-width: 0;
}

/* Container de Centralização Mágica para TODAS as páginas */
.view-section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px); /* Garante espaço para centralização */
    justify-content: center; /* Centralização Vertical */
    align-items: center; /* Centralização Horizontal */
}

/* O conteúdo interno de cada seção ativa */
.view-section:not(.hidden) {
    display: flex;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    transform: translateX(5px);
}

.logout-btn i {
    color: #ef4444 !important;
}

/* Floating Cards */
.card {
    width: 100%;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 2rem;
    padding: 2.5rem;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.view-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}

.btn {
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    border: none;
    width: 100%;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.98);
}

/* Dashboard Elements */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.25rem;
    text-align: center;
}

.stat-val {
    font-size: 2rem;
    font-weight: 800;
    display: block;
    margin-top: 0.5rem;
}

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

/* Gamification (Badges) */
.badge-list {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin: 1rem 0;
    scrollbar-width: none;
}

.badge-item {
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.badge-item.active {
    opacity: 1;
}

.badge-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.badge-item.bronze .badge-icon {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
}

.badge-item.silver .badge-icon {
    background: linear-gradient(135deg, #c0c0c0, #808080);
}

.badge-item.gold .badge-icon {
    background: linear-gradient(135deg, #ffd700, #daa520);
}

.progress-container {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Alerts & Toast */
/* Table & Lists */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: left;
    padding: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-box {
    position: relative;
    margin: 1.5rem 0;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    padding-left: 2.5rem;
}

/* Modal */
#modal-list {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-content {
    width: 100%;
    max-width: 440px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Loader */
.loader {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

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

.btn-loading {
    pointer-events: none;
    opacity: 0.8;
    position: relative;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading .btn-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: block !important;
}

#toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 1rem 2rem;
    border-radius: 1rem;
    color: white;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        bottom: 0;
        opacity: 0;
    }

    to {
        bottom: 2rem;
        opacity: 1;
    }
}

/* CRÍTICO: Classe utilitária para esconder elementos via JS */
.hidden {
    display: none !important;
}

/* Seções de View (para painéis full-width fora do .card) */
.view-section {
    width: 100%;
    max-width: 1100px;
    padding: 1.5rem 0;
    margin: 0 auto;
}

/* Botões de tipo de mídia para Central de Disparos */
.media-type-btns-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.media-type-btn {
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.media-btn-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 0.5rem;
    border-radius: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    height: 85px;
    justify-content: center;
    white-space: nowrap;
}

.media-btn-content i {
    font-size: 1.4rem;
    transition: 0.3s;
}

.media-type-btn input:checked + .media-btn-content {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-3px);
}

.media-type-btn input:checked + .media-btn-content i {
    transform: scale(1.1);
}

/* Estilização para o Dashboard de BI (Charts) */
canvas {
    max-width: 100% !important;
}

/* Grid utilitário */
.grid {
    display: grid;
    gap: 2rem;
}

/* Botão primário (alternativo ao .btn) */
.btn-primary {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(0.98);
}
