/* ==========================================================================
   APOIO V2 - SISTEMA DE GESTÃO GERENCIAL
   Design System & Global Styles
   Criador: @erikhenriquesm
   ========================================================================== */

:root {
    /* Brand Colors */
    --pague-menos-blue: #0019ff;
    --pague-menos-red: #ff2131;

    /* Semantic Backgrounds */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-surface: #ffffff;
    --bg-accent: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.8);

    /* Semantic Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Semantic Borders & Dividers */
    --border-main: #e2e8f0;
    --border-soft: #f1f5f9;

    /* Functional Colors (Light) */
    --blue-light: #eff6ff;
    --blue-soft: #dbeafe;

    /* Global Accents */
    --success: var(--pague-menos-blue);
    --warning: #f59e0b;
    --danger: var(--pague-menos-red);
    --info: var(--pague-menos-blue);

    /* Effects & Shadows */
    --shadow-main: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --glass-border: var(--border-main);
    --glass-shadow: var(--shadow-main);
    --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Escuro (Dark Mode) - Master Tokens */
body.dark-mode {
    --bg-main: #0b0f1a;
    --bg-card: #111827;
    --bg-surface: #1a2235;
    --bg-accent: #1a2235;
    --bg-glass: rgba(11, 15, 26, 0.92);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    /* Bordas quase invisíveis para visual limpo e liso */
    --border-main: rgba(255, 255, 255, 0.04);
    --border-soft: rgba(255, 255, 255, 0.06);

    --blue-light: rgba(0, 25, 255, 0.12);
    --blue-soft: rgba(0, 25, 255, 0.2);

    /* Sombra do glass bem sutil */
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-main: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    scroll-behavior: smooth;
}

/* Tipografia */
h1,
h2,
h3,
h4,
.brand-font {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Utilitários Globais */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

.animate-fade {
    animation: fadeIn 0.5s ease forwards;
}

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

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

/* Animação de Vidro Brilhando (Shimmer) mais expressiva */
@keyframes glassShimmer {
    0% {
        transform: translateX(-150%) skewX(-25deg);
    }

    100% {
        transform: translateX(250%) skewX(-25deg);
    }
}

.skeleton-container {
    overflow: hidden;
    position: relative;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(255, 255, 255, 0.8) 50%,
            transparent 100%);
    animation: glassShimmer 1.2s infinite ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.skeleton-item {
    background: #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* Botões Customizados */
.btn-primary {
    background: linear-gradient(135deg, var(--pague-menos-blue), #1e40af);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 25, 255, 0.2);
}

/* Toasts Notificações */
.toast-notification {
    transition: var(--transition-smooth);
}

.toast-success {
    color: var(--success);
}

.toast-error {
    color: var(--danger);
}

.toast-info {
    color: var(--info);
}

.toast-warning {
    color: var(--warning);
}


/* ==========================================================================
   ESTILOS EXCLUSIVOS: DISPOSITIVOS MÓVEIS (MOBILE)
   ========================================================================== */

/* Blindagem de Segurança: Esconde o app até a autenticação ser validada */
#app-root {
    display: none;
}

html.auth-verified #app-root {
    display: block;
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    /* No topo de tudo */
    transition: opacity 0.5s ease;
}

/* Cabeçalho Fixo Mobile */
.mobile-header {
    background: var(--bg-surface);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.brand-title {
    color: var(--pague-menos-blue);
    font-size: 1.4rem;
    letter-spacing: 1px;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Barra de Navegação Inferior Mobile (Moderna/Floating) */
.mobile-nav {
    position: fixed;
    bottom: 25px;
    left: 20px;
    right: 20px;
    height: 70px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border-radius: 25px;
    box-shadow: var(--glass-shadow);
    padding: 0 10px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 700;
    transition: var(--transition-smooth);
    position: relative;
    height: 100%;
    flex: 1;
    gap: 4px;
}

.nav-item span {
    font-size: 0.6rem;
    font-weight: 700;
    margin-top: 4px;
    color: var(--text-muted);
}

.nav-item i {
    font-size: 1.2rem;
    transition: var(--transition-smooth);
}

.nav-item.active i,
.nav-item.active span {
    color: var(--pague-menos-blue);
}

.nav-item.active i {
    transform: translateY(-2px);
}

/* Cards de Módulo no Mobile (Estilo Vertical Premium) */
.mobile-module-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 75px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.mobile-module-card:active {
    transform: scale(0.97);
    background: var(--bg-accent);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.module-icon-box {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--blue-light);
    color: var(--pague-menos-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.module-indicator {
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.module-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    margin-top: 4px;
}

.module-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.module-subtitle {
    font-size: 0.52rem;
    font-weight: 400;
    color: var(--text-secondary);
    opacity: 0.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}



.module-status-text {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}

.module-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241, 245, 249, 0.7);
    backdrop-filter: grayscale(1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
}

.module-lock-overlay i {
    font-size: 1.1rem;
    color: #94a3b8;
    background: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.module-locked {
    opacity: 0.15;
    filter: grayscale(1);
    box-shadow: none !important;
    border-color: transparent !important;
}

.mobile-module-card:active {
    transform: scale(0.96);
    background: var(--bg-card);
}

.module-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.module-name {
    display: block;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.module-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pending {
    background: var(--bg-accent);
    color: var(--text-secondary);
}

.badge-success {
    background: var(--blue-light);
    color: var(--pague-menos-blue);
}

.badge-info {
    background: var(--pague-menos-blue);
    color: white;
}

.module-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.module-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
}

.module-desc {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.module-footer {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-status-text {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
}


/* ==========================================================================
   ESTILOS EXCLUSIVOS: COMPUTADORES (DESKTOP)
   ========================================================================== */

.desktop-sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-main);
    padding: 25px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

.desktop-main {
    flex: 1;
    padding: 10px 40px 40px 40px;
    background: var(--bg-main);
    max-width: 1600px;
    margin-left: 280px;
    /* Compensa a sidebar fixa */
}

/* Ajustes Específicos para Tablets (Desktop mode em telas médias) */
@media (max-width: 1024px) {
    .desktop-sidebar {
        width: 210px;
        padding: 20px 15px;
    }
    .desktop-main {
        margin-left: 210px;
        padding: 10px 20px 30px 20px;
    }
    .desktop-nav-btn {
        padding: 10px 12px !important;
        font-size: 0.8rem !important;
    }
}

.version-container {
    container-type: inline-size;
    width: 100%;
    margin-top: 5px;
}

.version-text {
    font-size: clamp(0.5rem, 5cqw, 0.75rem);
    white-space: nowrap;
    color: var(--text-muted);
    display: block;
}

.desktop-header {
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Menu de Navegação Desktop */
.desktop-nav-btn {
    width: 100%;
    justify-content: flex-start !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: 1px solid transparent !important;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desktop-nav-btn:hover {
    background: var(--bg-accent) !important;
    color: var(--pague-menos-blue) !important;
}

/* ==========================================================================
   SISTEMA DE BLINDAGEM DE TEMA (THEME SHIELD)
   Força a adaptação de todos os componentes de forma global e automática.
   ========================================================================== */

body.dark-mode {
    color-scheme: dark;
    /* Ajusta scrollbars e controles nativos */
}

/* Reset Global de Backgrounds para Modo Escuro — apenas os componentes-chave */
body.dark-mode .glass-card,
body.dark-mode .mobile-module-card {
    background-color: var(--bg-card);
    border-color: var(--glass-border);
    color: var(--text-primary);
}

body.dark-mode .checklist-item,
body.dark-mode .action-card,
body.dark-mode .stat-card,
body.dark-mode .history-item {
    background-color: var(--bg-surface);
    border-color: var(--glass-border);
    color: var(--text-primary);
}

body.dark-mode .form-control,
body.dark-mode input,
body.dark-mode textarea {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-soft);
}

body.dark-mode .modal-content {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

body.dark-mode .desktop-sidebar {
    background-color: var(--bg-card);
    /* Sem border-right visível — design liso */
    border-right-color: var(--glass-border);
}

/* Cabeçalhos e Navegação Mobile — fundo limpo sem bordas grossas */
body.dark-mode .mobile-header {
    background-color: var(--bg-card);
    border-bottom-color: var(--glass-border);
    box-shadow: none;
}

body.dark-mode .mobile-nav {
    background: rgba(17, 24, 39, 0.95);
    border-color: var(--glass-border);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode .mobile-module-title-bar {
    background-color: var(--bg-card);
    border-bottom-color: var(--glass-border);
}

/* Botões de destaque mantêm suas cores */
body.dark-mode .btn-toggle.active-yes,
body.dark-mode .btn-toggle.active-no,
body.dark-mode .badge-success,
body.dark-mode .badge-info,
body.dark-mode .score-circle {
    background-color: inherit;
    color: white;
}

/* Suavização de Imagens no Modo Escuro */
body.dark-mode img {
    filter: brightness(0.8) contrast(1.1);
}

/* Transição de Tema Suave (Aplicada em componentes chave para evitar conflitos) */
body,
.glass-card,
.mobile-module-card,
.mobile-nav,
.mobile-header,
.mobile-module-title-bar,
.nav-item i,
.nav-item span,
.desktop-sidebar,
.form-control {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* BLINDAGEM DE TERCEIRO NÍVEL (SHIELD V3)
   Captura cores residuais de cinza claro em backgrounds inline — sem adicionar bordas. */
body.dark-mode [style*="background: #f8fafc"],
body.dark-mode [style*="background: rgb(248, 250, 252)"],
body.dark-mode [style*="background: #f1f5f9"],
body.dark-mode [style*="background: rgb(241, 245, 249)"],
body.dark-mode [style*="background: white"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background: #ffffff"] {
    background-color: var(--bg-surface) !important;
}

.mobile-module-title-bar {
    position: fixed;
    top: 65px;
    /* Logo abaixo da mobile-header */
    left: 0;
    width: 100%;
    background: var(--bg-main);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 8px 0;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    z-index: 999;
    display: none;
    /* Escondido por padrão, mostrado via JS nos módulos */
}

.mobile-module-title-text {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Caixa de Busca Universal */
.search-box {
    position: relative;
    width: 100%;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    padding: 14px 15px 14px 45px !important;
    border-radius: 18px !important;
    background: #f8fafc !important;
    border: 1.5px solid var(--blue-soft) !important;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--pague-menos-blue) !important;
    background: white !important;
    box-shadow: 0 4px 15px rgba(0, 25, 255, 0.08) !important;
}

/* ==========================================================================
   SISTEMA DE BLINDAGEM DE MÓDULOS (SHIELD LOADER)
   ========================================================================== */

.module-shield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 150000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.module-shield.active {
    opacity: 1;
    visibility: visible;
}

.shield-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.shield-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 255, 0.1));
}

.shield-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    color: var(--pague-menos-blue);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

.shield-loader {
    width: 35px;
    height: 35px;
    border: 3.5px solid rgba(0, 25, 255, 0.1);
    border-top: 3.5px solid var(--pague-menos-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.shield-footer {
    position: absolute;
    bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
}

.shield-status {
    font-size: 0.8rem;
    color: var(--pague-menos-blue);
    opacity: 0.3;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

.shield-creator {
    font-size: 0.7rem;
    opacity: 0.4;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Animação Especial: Vidro Azul Brilhante para o Criador */
@keyframes glassBlueShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.creator-handle-shine {
    display: inline-block;
    font-weight: 800;
    color: var(--pague-menos-blue);
}

/* ==========================================================================
   TELA DE BLOQUEIO OFFLINE
   Z-index máximo para impedir qualquer ação do usuário sem conexão.
   ========================================================================== */
.offline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000000 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: all !important;
}

.offline-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.offline-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 24px !important;
    padding: 40px 30px !important;
    max-width: 400px !important;
    width: 90% !important;
    text-align: center !important;
    box-shadow: var(--glass-shadow) !important;
}

.offline-icon-box {
    width: 70px;
    height: 70px;
    background: #fee2e2 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 25px auto !important;
}

.offline-icon-box i {
    color: var(--pague-menos-red) !important;
    font-size: 1.8rem !important;
    animation: wifiSlashPulse 2s infinite ease-in-out !important;
}

.offline-title {
    font-size: 1.4rem !important;
    font-weight: 900 !important;
    color: var(--pague-menos-blue) !important;
    margin-bottom: 12px !important;
    letter-spacing: -0.5px !important;
}

.offline-text {
    font-size: 0.85rem !important;
    color: var(--text-secondary) !important;
    line-height: 1.5 !important;
    margin-bottom: 25px !important;
    font-weight: 500 !important;
}

.offline-retry-btn {
    width: 100% !important;
    padding: 16px !important;
    border-radius: 15px !important;
    border: none !important;
    background: var(--pague-menos-blue) !important;
    color: white !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    box-shadow: 0 10px 15px rgba(0, 25, 255, 0.2) !important;
    transition: var(--transition-smooth) !important;
}

.offline-retry-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 20px rgba(0, 25, 255, 0.3) !important;
}

@keyframes wifiSlashPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* Garante adaptação no dark mode */
body.dark-mode .offline-card {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
}
body.dark-mode .offline-icon-box {
    background: rgba(239, 68, 68, 0.15) !important;
}
body.dark-mode .offline-title {
    color: var(--text-primary) !important;
}
body.dark-mode .offline-text {
    color: var(--text-secondary) !important;
}

.creator-handle-shine {
    font-weight: 800;
    background: linear-gradient(to right, #0019ff, #ff2131, #0019ff);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shineText 3s linear infinite;
    display: inline-block;
}

@keyframes shineText {
    to { background-position: 200% center; }
}

body.dark-mode .creator-handle-shine {
    background: linear-gradient(to right, #3b82f6, #f43f5e, #3b82f6);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
}