/* ========================================
   GLOBAL CSS - IFA SYSTEM
   ======================================== */

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variáveis CSS - Paleta Moderna Sofisticada */
:root {
    /* === CORES PRINCIPAIS === */
    --primary-dark: #0f172a;
    --primary-medium: #1e293b;
    --primary-light: #334155;

    /* === BACKGROUNDS === */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-hover: #f1f5f9;
    --bg-active: #e2e8f0;

    /* === BORDERS & DIVIDERS === */
    --border-color: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;
    --divider-color: #f1f5f9;

    /* === TEXT COLORS === */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    /* === RADIUS === */
    --radius-none: 0;
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;

    /* === SHADOWS === */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* === SPACING === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* === TRANSITIONS === */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* === STATUS COLORS === */
    --success-color: #10b981;
    --success-light: #ecfdf5;
    --success-border: #d1fae5;

    --warning-color: #f59e0b;
    --warning-light: #fffbeb;
    --warning-border: #fef3c7;

    --danger-color: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fee2e2;

    --info-color: #3b82f6;
    --info-light: #eff6ff;
    --info-border: #dbeafe;
}

/* Background Utility Colors */
.bg-primary-light {
    background-color: #dbeafe !important;
}

/* Using info color for light primary feel */
.bg-info-light {
    background-color: #eff6ff !important;
}

.bg-warning-light {
    background-color: #fffbeb !important;
}

.bg-success-light {
    background-color: #ecfdf5 !important;
}

.bg-danger-light {
    background-color: #fef2f2 !important;
}

/* Base HTML */
html {
    font-size: 16px;
    line-height: 1.6;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tipografia */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.875rem;
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--text-secondary);
}

/* ========================================
   LAYOUT ESTRUTURAL (PREMIUM)
   ======================================== */

.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: #f3f4f6;
    /* Light Gray/Blue tint */
    font-family: 'Inter', sans-serif;
}

/* === SIDEBAR (NAVBAR LATERAL) === */
.admin-sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #111827;
    /* Gray 900 */
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: width 0.3s ease;
}

/* Header da Sidebar (Logo) */
.sidebar-header {
    height: 72px;
    /* Fixed height for consistency */
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-badge {
    background: #374151;
    /* Gray 700 */
    color: #e5e7eb;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Navegação (Scrollável) */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Links do Menu */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    color: #9ca3af;
    /* Gray 400 */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-nav a i {
    width: 20px;
    height: 20px;
    opacity: 0.8;
    transition: all 0.2s;
}

/* Hover State */
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f3f4f6;
}

.sidebar-nav a:hover i {
    opacity: 1;
    transform: translateX(2px);
}

/* Active State (O "Algo Top") */
.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: #60a5fa;
    /* Blue 400 */
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}

.sidebar-nav a.active i {
    opacity: 1;
    color: #60a5fa;
}

/* Submenus */
.nav-item-submenu {
    margin-bottom: 4px;
    border-radius: 8px;
    transition: background 0.3s;
}

.nav-item-submenu.open {
    background: rgba(0, 0, 0, 0.15);
}

.submenu-arrow {
    margin-left: auto;
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.nav-item-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding-left: 0;
}

.nav-item-submenu.open .submenu {
    max-height: 500px;
    /* Expands */
}

.submenu li a {
    padding-left: 48px;
    /* Indent styled */
    font-size: 0.85rem;
    color: #6b7280;
}

.submenu li a:hover {
    color: #e5e7eb;
}

.submenu li a.active-sub {
    color: #60a5fa;
    background: transparent;
}

/* Footer da Sidebar */
.sidebar-footer {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-profile-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.sidebar-profile-link:hover {
    opacity: 0.9;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

.profile-level {
    color: #9ca3af;
    font-size: 0.7rem;
}

.sidebar-logout-link {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transition: all 0.2s;
}

.sidebar-logout-link:hover {
    background: #ef4444;
    color: #fff;
}

/* === MAIN CONTENT (ÁREA DIREITA) === */
.admin-main-content {
    margin-left: 260px;
    /* ALINHADO COM A SIDEBAR */
    width: calc(100% - 260px);
    padding: 32px;
    background-color: #f3f4f6;
    transition: margin-left 0.3s ease;
}

body.no-sidebar .admin-main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Sidebar Overlay removido daqui e consolidado no final do arquivo */

/* Responsividade */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

    .sidebar-mobile-open .admin-sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-open .sidebar-overlay {
        display: block;
    }
}


/* Componentes Base Modernos */
.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-8);
    line-height: 1.2;
    position: relative;
    animation: slideInDown 0.6s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
    animation: fadeInUp 0.5s ease-out;
}

/* Borda decorativa superior */
.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary-medium) 50%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.panel-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(145deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.panel-title i {
    color: var(--primary-dark);
    transition: all var(--transition-normal);
}

.panel:hover .panel-title i {
    transform: scale(1.1);
}

.panel-body {
    padding: var(--space-6);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botões Modernos */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    transition: left var(--transition-normal);
}

.btn:hover::before {
    left: 100%;
}

.btn:focus {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-medium) 100%);
    color: var(--text-inverse);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-medium) 0%, var(--primary-dark) 100%);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    background: var(--bg-panel);
    color: var(--text-secondary);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #b91c1c 100%);
    color: var(--text-inverse);
    border-color: var(--danger-color);
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, var(--danger-color) 100%);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}


/* ========================================
   ESTADO DESABILITADO PARA TODOS OS BOTÕES (VERSÃO MELHORADA)
   ======================================== */
.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    background: var(--bg-tertiary) !important;
    /* Fundo cinza claro padrão */
    color: var(--text-muted) !important;
    /* Texto cinza claro */
    border-color: var(--border-color) !important;
    /* Borda cinza claro */
    box-shadow: none !important;
    /* Remove qualquer sombra */
    transform: none !important;
    /* Remove efeito de clique/hover */

    /* Garante que nenhum efeito de gradiente ou brilho apareça */
    background-image: none !important;
}

/* Remove o brilho do hover especificamente para o botão primário */
.btn-primary:disabled::before,
.btn-primary[disabled]::before {
    display: none;
}

/* Estados de Loading dos Botões */
.btn.is-loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-inverse);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Formulários Modernos */
.form-group {
    margin-bottom: var(--space-6);
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--primary-dark);
    border-radius: var(--radius-sm);
}

.form-control {
    width: 100%;
    padding: var(--space-4) var(--space-5);
    font-size: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 4px rgba(10, 10, 10, 0.1);
    background: var(--bg-primary);
    transform: translateY(-1px);
}

.form-control:hover:not(:focus) {
    border-color: var(--border-medium);
    background: var(--bg-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--space-3) center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: var(--space-8);
    appearance: none;
}

/* Flash Messages Modernizadas */
.flash-message {
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-6);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid;
    position: relative;
    animation: slideInDown 0.4s ease-out;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.flash-message::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.alert-success {
    background: linear-gradient(135deg, var(--success-light) 0%, rgba(236, 253, 245, 0.8) 100%);
    color: var(--success-color);
    border-color: var(--success-border);
}

.alert-error {
    background: linear-gradient(135deg, var(--danger-light) 0%, rgba(254, 242, 242, 0.8) 100%);
    color: var(--danger-color);
    border-color: var(--danger-border);
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, rgba(255, 251, 235, 0.8) 100%);
    color: var(--warning-color);
    border-color: var(--warning-border);
}

.alert-info {
    background: linear-gradient(135deg, var(--info-light) 0%, rgba(239, 246, 255, 0.8) 100%);
    color: var(--info-color);
    border-color: var(--info-border);
}

/* Utilitários */
.page-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.6s ease-out;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

/* Estados de Loading Globais */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Progress Bars Modernas */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: var(--space-2) 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary-medium) 100%);
    border-radius: var(--radius-sm);
    transition: width 1s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.1) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.1) 75%,
            transparent 75%,
            transparent);
    background-size: 20px 20px;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 20px 0;
    }
}

/* Responsividade */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-main-content {
        margin-left: 0;
        padding: var(--space-6);
    }

    .page-header-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .admin-main-content {
        padding: var(--space-4);
    }

    .page-title {
        font-size: 1.5rem;
        margin-bottom: var(--space-6);
    }

    .panel-header,
    .panel-body {
        padding: var(--space-4);
    }

    .btn {
        padding: var(--space-3) var(--space-4);
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .admin-main-content {
        padding: var(--space-3);
    }

    .page-title {
        font-size: 1.25rem;
    }

    .panel-header,
    .panel-body {
        padding: var(--space-3);
    }
}

/* Scroll customizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--border-medium) 0%, var(--border-strong) 100%);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--border-strong) 0%, var(--text-muted) 100%);
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible moderno */
*:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* Seleção de texto */
::selection {
    background: var(--primary-dark);
    color: var(--text-inverse);
}

/* Ripple Effect Base */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 600ms linear;
    background-color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========================================
   PAINEL "EM CONSTRUÇÃO"
   ======================================== */
.construction-panel .panel-body {
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-hover);
}

.construction-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.construction-icon i {
    width: 40px;
    height: 40px;
}

.construction-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.construction-text {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 450px;
    line-height: 1.6;
}

/* ========================================
   COMPONENTES GLOBAIS PARA TESTES PSICOMÉTRICOS
   ======================================== */

/* Badges de Status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.badge-success {
    background: var(--success-light);
    color: var(--success-color);
    border-color: var(--success-border);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-color);
    border-color: var(--warning-border);
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border-medium);
}

/* Progress Rings para Testes */
.progress-ring {
    width: 120px;
    height: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 4;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--primary-dark);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.progress-ring-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Radar Chart Container */
.radar-chart-container {
    position: relative;
    display: inline-block;
    margin: var(--space-4);
}

.radar-chart-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Timeline Components */
.timeline {
    position: relative;
    padding: var(--space-4) 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: var(--space-4) 0 var(--space-4) var(--space-16);
    margin-bottom: var(--space-4);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 24px;
    top: var(--space-6);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-dark);
    border: 3px solid var(--bg-panel);
    box-shadow: 0 0 0 3px var(--border-color);
}

.timeline-item.completed::before {
    background: var(--success-color);
    box-shadow: 0 0 0 3px var(--success-border);
}

.timeline-content {
    background: var(--bg-panel);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.timeline-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.timeline-description {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Dashboard Widgets */
.dashboard-widget {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.dashboard-widget:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.dashboard-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary-medium) 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.widget-title i {
    color: var(--primary-dark);
}

.widget-action {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.widget-action:hover {
    color: var(--primary-dark);
}

.widget-content {
    color: var(--text-secondary);
}

.widget-metric {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.metric-change {
    font-size: 0.8rem;
    font-weight: 600;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.metric-change.positive {
    color: var(--success-color);
    background: var(--success-light);
}

.metric-change.negative {
    color: var(--danger-color);
    background: var(--danger-light);
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.online .status-dot {
    background: var(--success-color);
}

.status-indicator.offline .status-dot {
    background: var(--text-muted);
    animation: none;
}

.status-indicator.busy .status-dot {
    background: var(--warning-color);
}

/* Animated Counters */
.animated-counter {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Comparison Charts */
.comparison-chart {
    display: flex;
    align-items: end;
    gap: var(--space-2);
    height: 60px;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    background: var(--bg-hover);
}

.chart-bar {
    flex: 1;
    background: var(--primary-dark);
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    min-height: 5px;
    transition: all var(--transition-normal);
    position: relative;
}

.chart-bar:hover {
    background: var(--primary-medium);
    transform: translateY(-2px);
}

.chart-bar::after {
    content: attr(data-value);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--text-inverse);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.chart-bar:hover::after {
    opacity: 1;
}

/* Loading States Específicos para Testes */
.test-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.test-loading-content {
    text-align: center;
    max-width: 300px;
}

.test-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-4) auto;
}

.test-loading-text {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.test-loading-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Success Animations */
@keyframes celebration {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.celebrate {
    animation: celebration 0.6s ease-in-out;
}

/* Confetti Effect (CSS only) */
.confetti {
    position: relative;
    overflow: hidden;
}

.confetti::before,
.confetti::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 100px;
    background-image:
        radial-gradient(circle, #ff6b6b 2px, transparent 2px),
        radial-gradient(circle, #4ecdc4 2px, transparent 2px),
        radial-gradient(circle, #45b7d1 2px, transparent 2px),
        radial-gradient(circle, #f9ca24 2px, transparent 2px);
    background-size: 30px 30px, 40px 40px, 35px 35px, 25px 25px;
    background-position: 0 0, 15px 15px, 30px 5px, 10px 25px;
    animation: confetti-fall 3s linear infinite;
    opacity: 0;
}

.confetti.active::before,
.confetti.active::after {
    opacity: 1;
}

.confetti::after {
    animation-delay: 1.5s;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Tooltips para Gráficos */
.chart-tooltip {
    position: absolute;
    background: var(--text-primary);
    color: var(--text-inverse);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.chart-tooltip.active {
    opacity: 1;
}

/* Responsividade para Componentes */
@media (max-width: 768px) {
    .progress-ring {
        width: 80px;
        height: 80px;
    }

    .progress-ring-text {
        font-size: 1rem;
    }

    .radar-chart-legend {
        flex-direction: column;
        align-items: center;
    }

    .timeline::before {
        left: 15px;
    }

    .timeline-item {
        padding-left: var(--space-10);
    }

    .timeline-item::before {
        left: 9px;
    }

    .dashboard-widget {
        padding: var(--space-4);
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .animated-counter {
        font-size: 2rem;
    }
}



/* ========================================
   ESTILOS PARA SUBMENU
   ======================================== */
.sidebar-nav .nav-item-submenu .submenu {
    list-style: none;
    padding-left: 40px;
    /* Indentação */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.sidebar-nav .nav-item-submenu.open .submenu {
    max-height: 500px;
    /* Altura suficiente para os itens */
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

.sidebar-nav .submenu a {
    font-size: 0.85rem;
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    color: rgba(255, 255, 255, 0.6);
    position: relative;
}

.sidebar-nav .submenu a:hover {
    color: var(--text-inverse);
}

.sidebar-nav .submenu a.active-sub {
    color: var(--text-inverse);
    font-weight: 600;
}

.sidebar-nav .submenu a.active-sub::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-inverse);
}

.submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.submenu-arrow {
    transition: transform 0.3s ease;
}

.nav-item-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* Secondary elements logic restored or simplified */

/* ========================================
   COMPONENTES ADICIONAIS PARA O MVP
   Adicione no final do global.css
   ======================================== */

/* === BADGES DE PAPÉIS DE USUÁRIO (Sidebar/Header) === */
.role-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    margin-left: var(--space-2);
}

.role-badge.admin {
    background-color: var(--danger-light);
    color: var(--danger-color);
    border: 1px solid var(--danger-border);
}

.role-badge.success {
    background-color: var(--success-light);
    color: var(--success-color);
    border: 1px solid var(--success-border);
}

.role-badge.sdr {
    background-color: var(--info-light);
    color: var(--info-color);
    border: 1px solid var(--info-border);
}

.role-badge.closer {
    background-color: var(--warning-light);
    color: var(--warning-color);
    border: 1px solid var(--warning-border);
}

/* === ESTADOS DE DRAG-AND-DROP DO KANBAN === */
.kanban-card.is-dragging {
    opacity: 0.5;
    transform: rotate(4deg) scale(1.05);
    z-index: 1000;
    box-shadow: var(--shadow-2xl) !important;
}

.drop-zone.is-over {
    border-color: var(--success-color) !important;
    background: var(--success-light) !important;
}

/* === ESTILOS PARA MODAIS GLOBAIS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    /* Mantemos flex para o alinhamento */
    align-items: center;
    justify-content: center;
    padding: 2rem;

    /* CORREÇÃO PRINCIPAL: Controla a visibilidade com opacity e pointer-events */
    opacity: 0;
    pointer-events: none;
    /* Impede que o modal invisível bloqueie cliques */
    transition: opacity 0.3s ease;
}

.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
    /* Permite interação quando visível */
}

.modal-container {
    background: var(--bg-panel);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.is-visible .modal-container {
    transform: scale(1);
}

.modal-lg .modal-container {
    max-width: 900px;
}

.modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    line-height: 0;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-5);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    background-color: var(--bg-tertiary);
    flex-shrink: 0;
}

/* =============================================== */
/* === ESTILOS PARA O MENU MOBILE === */
/* =============================================== */

/* 1. O cabeçalho superior que contém o botão */
.admin-top-header {
    display: none;
    /* Escondido no desktop por padrão */
    align-items: center;
    gap: 1rem;
    padding: 0.75rem var(--space-4);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    margin: calc(-1 * var(--space-8)) calc(-1 * var(--space-8)) var(--space-6) calc(-1 * var(--space-8));
    /* A margem negativa faz ele ocupar a largura toda */
}

.mobile-menu-toggle,
.header-logo-mobile {
    display: none;
    /* Escondido por padrão no desktop */
}

.mobile-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-primary);
}

.header-logo-mobile .sidebar-logo {
    font-size: 1.1rem;
    color: var(--primary-dark) !important;
}

/* 2. A sobreposição escura que aparece atrás do menu */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1090;
    display: none;
    /* Força oculto por padrão */
    opacity: 0;
    pointer-events: none;
    /* Segurança total contra bloqueio de cliques */
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

body.sidebar-mobile-open .sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* 3. Lógica para mostrar/esconder em telas menores */
@media (max-width: 1024px) {
    .admin-top-header {
        display: flex;
        justify-content: space-between;
        /* Mantém spaçamento mobile */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 900;
        margin: 0;
        padding: 0.75rem var(--space-6);
        box-shadow: var(--shadow-sm);
    }

    .mobile-menu-toggle,
    .header-logo-mobile {
        display: flex;
        /* Garante visibilidade no mobile */
    }

    .admin-main-content {
        margin-left: 0;
        padding: var(--space-6);
        padding-top: 80px;
        position: relative;
    }

    body.sidebar-mobile-open .admin-sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-2xl);
    }

    .admin-sidebar {
        transform: translateX(-100%);
    }
}

/* Tablet/Mobile Adjustments handled in primary media query above */

/* ========================================
   OTIMIZAÇÃO DE SUBMENU (Lapidação Visual)
   Melhora o espaçamento e a ocupação lateral
   ======================================== */

/* --- ESTRUTURA BASE DO SUBMENU --- */
.sidebar-nav .nav-item-submenu .submenu {
    /* 1. Remove a indentação (padding-left) excessiva do contêiner 'ul' */
    padding-left: 0;

    /* 2. Garante que o contêiner 'ul' se alinhe ao item pai */
    margin-left: 0;

    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

/* --- ESTADO ABERTO --- */
.sidebar-nav .nav-item-submenu.open .submenu {
    /* Ajusta o padding para que o submenu aberto tenha respiro sem indentar */
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

/* --- ESTILO DOS ITENS FILHOS DO SUBMENU (o 'a' dentro do 'li') --- */
.sidebar-nav .submenu a {
    /* 3. Ajusta a indentação do item 'a' para simular a hierarquia, mas mantendo a largura */
    padding-left: var(--space-8);
    /* 2rem de indentação para clareza */
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);

    /* 4. Remove a margem extra que causava o encolhimento, pois o 'ul' já não tem margin/padding lateral */
    margin-bottom: 0;

    /* Efeito visual sutil para hierarquia */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- INDICADOR DE ATIVIDADE NO SUBMENU --- */
.sidebar-nav .submenu a.active-sub {
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.1);
    /* Destaca levemente o item ativo */
}

/* Ajusta o marcador de bolinha/barra para ficar mais visível com o novo padding-left */
.sidebar-nav .submenu a.active-sub::before {
    left: var(--space-5);
    /* Empurra o marcador para a nova posição (1.25rem) */
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--success-color);
    /* Cor da marca para destaque */
}

/* --- AJUSTE NO ITEM PAI --- */
/* Garante que o item pai também tenha uma aparência integrada */
.sidebar-nav .nav-item-submenu>a {
    margin-bottom: 0;
    /* Remove a margem inferior para grudar no submenu */
    border-radius: var(--radius-md);
}



/* ========================================
   CORREÇÃO DE ALINHAMENTO DO SUBMENU PAI
   Força o alinhamento do texto 'Comercial' para a esquerda
   ======================================== */

/* O alvo é o link (a) que tem a classe .submenu-toggle */
.sidebar-nav .nav-item-submenu .submenu-toggle {
    /* Alinha o conteúdo à esquerda por padrão (ícone e label) */
    justify-content: flex-start;

    /* Adiciona espaço flexível entre o texto e a seta de expansão */
    gap: var(--space-3);
    /* Reutiliza o gap do menu padrão */
}

/* Garante que o ícone da seta de expansão (.submenu-arrow) vá para a extrema direita, 
   usando a propriedade 'margin-left: auto' */
.sidebar-nav .nav-item-submenu .submenu-toggle .submenu-arrow {
    margin-left: auto;
    flex-shrink: 0;
    /* Impede que a seta encolha */
}

/* Opcional: Garante que o texto do item pai ocupe o espaço restante */
.sidebar-nav .nav-item-submenu .submenu-toggle span {
    flex-grow: 1;
}

/* AJUSTE FINAL: Garante que os itens simples (sem submenu) mantenham a integridade do alinhamento */
.sidebar-nav a:not(.submenu-toggle) {
    /* Mantém o alinhamento padrão (que já estava bom) */
    justify-content: flex-start;
}

/* ========================================
   SWEETALERT2 CUSTOMIZATIONS (SELEÇÃO DE TEXTO)
   ======================================== */
.swal2-container,
.swal2-popup,
.swal2-html-container,
.swal2-title,
[class^='swal2'] {
    user-select: text !important;
    -webkit-user-select: text !important;
    pointer-events: auto !important;
}