:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #3b82f6;
    --accent: #4f46e5;
    --light: #f8fafc;
    --dark: #1e293b;
    --text: #334155;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --gray: #94a3b8;
    --card-bg: #ffffff;
    --transition: all 0.3s ease;
    --topoHeight: 75px;
    --rodapeHeight: 75px;
    --pageMainHeaderHeight: 75px;
}

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

@media only screen and (max-width: 500px) {
    :root {
        --rodapeHeight: 48px;
    }
}

body {
    margin: 0;
    height: 100%;
    width: 100%;
    font-family: 'Roboto', 'Google Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html {
    font-family: 'Roboto', 'Google Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ============================================================
   LOADING SCREEN INICIAL
   ============================================================ */
#loadingInitial {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #002644);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    perspective: 1000px;
}

.loading-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 40, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1;
    transform: translateZ(0);
}

.loading-screen-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
    width: 100%;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform;
    transform-style: preserve-3d;
}

/* ============================================================
   LOGO
   ============================================================ */
.loading-screen-logo-container {
    margin-bottom: 30px;
    position: relative;
    width: 180px;
    height: 180px;
}

.loading-screen-logo {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    position: absolute;
    overflow: hidden;
    border: 4px solid #002644;
    top: 0;
    left: 0;
}

.loading-screen-logo::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            rgba(0, 38, 68, 0) 0%,
            rgba(0, 38, 68, 0.8) 50%,
            rgba(0, 38, 68, 0) 100%);
    animation: loading-shine 4s infinite linear;
    z-index: 1;
}

.loading-screen-logo-inner {
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    z-index: 2;
    background: white;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loading-screen-logo-inner img {
    width: 80%;
    height: auto;
    transform: none !important;
}

/* ============================================================
   TÍTULO E SUBTÍTULOS
   ============================================================ */
.loading-screen-title {
    color: white;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
    background: linear-gradient(45deg, #009688, #002644);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    min-height: 3.5rem;
    width: 100%;
    text-align: center;
}

.loading-screen-subtitle {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.5rem;
}

/* ============================================================
   BARRA DE PROGRESSO
   ============================================================ */
.loading-screen-progress-container {
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    height: 32px;
    overflow: hidden;
    position: relative;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateZ(0);
}

.loading-screen-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #d2b1cb, #2e0018);
    width: 0%;
    border-radius: 50px;
    transition: width 0.4s ease;
    position: relative;
    will-change: width;
}

#progressText {
    overflow: hidden;
    width: 85%;
    max-width: 500px;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
    min-width: 0;
}

.loading-screen-progress-text {
    color: white;
    font-size: 1rem;
    margin-top: 15px;
    font-weight: 500;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.5rem;
}

/* ============================================================
   ESTATÍSTICAS (ARQUIVOS / CACHE / SERVIDOR / TEMPO)
   ============================================================ */
.loading-screen-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.8);
    width: 100%;
    max-width: 560px;
    min-height: 3.5rem;
    padding: 0 4px;
    box-sizing: border-box;
}

.loading-screen-stat-item {
    text-align: center;
    flex: 1 1 calc(25% - 12px);
    min-width: 72px;
    max-width: 130px;
    padding: 6px 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}

.loading-screen-stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.loading-screen-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #009688;
    margin-bottom: 4px;
    text-shadow: 0 0 10px rgba(0, 150, 136, 0.5);
    display: block;
    width: 100%;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.loading-screen-stat-label {
    font-size: 0.75rem;
    display: block;
    width: 100%;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* ============================================================
   ÍCONE DE CARREGAMENTO
   ============================================================ */
.loading-icon {
    display: inline-block;
    animation: spin-step 2.5s linear infinite;
    transform-origin: 50% 50%;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ============================================================
   ANIMAÇÕES
   ============================================================ */
@keyframes spin-step {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(100deg);
    }
    50% {
        transform: rotate(200deg);
    }
    75% {
        transform: rotate(300deg);
    }
    100% {
        transform: rotate(400deg);
    }
}

@keyframes loading-shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* ============================================================
   RESPONSIVO - TABLET (até 768px)
   ============================================================ */
@media (max-width: 768px) {
    .loading-screen-title {
        font-size: 2.2rem;
        min-height: 3rem;
    }

    .loading-screen-logo-container {
        width: 150px;
        height: 150px;
    }

    .loading-screen-logo-inner {
        width: 120px;
        height: 120px;
    }

    .loading-screen-stats {
        gap: 10px;
        min-height: 3rem;
        max-width: 480px;
    }

    .loading-screen-stat-item {
        flex: 1 1 calc(25% - 10px);
        min-width: 68px;
        padding: 5px 3px;
    }

    .loading-screen-stat-value {
        font-size: 1.25rem;
    }

    .loading-screen-stat-label {
        font-size: 0.7rem;
    }
}

/* ============================================================
   RESPONSIVO - MOBILE (até 520px) - GRID 2 COLUNAS FIXAS
   ============================================================ */
@media (max-width: 520px) {
    .loading-screen-content {
        padding: 0 10px;
    }

    .loading-screen-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-top: 20px;
        max-width: 100%;
        padding: 0;
        min-height: auto;
    }

    .loading-screen-stat-item {
        min-width: 0;
        max-width: none;
        padding: 6px 4px;
        border-radius: 6px;
        overflow: hidden;
    }

    .loading-screen-stat-value {
        font-size: 0.95rem;
        letter-spacing: -0.3px;
        margin-bottom: 2px;
    }

    .loading-screen-stat-label {
        font-size: 0.58rem;
        letter-spacing: 0.2px;
    }

    .loading-screen-progress-container {
        width: 100%;
        max-width: 280px;
        height: 24px;
    }

    .loading-screen-title {
        font-size: 1.7rem;
        min-height: 2.4rem;
    }

    .loading-screen-subtitle {
        font-size: 0.9rem;
    }
}

/* ============================================================
   RESPONSIVO - MOBILE PEQUENO (até 380px) - GRID 2 COLUNAS
   ============================================================ */
@media (max-width: 380px) {
    .loading-screen-stats {
        gap: 5px;
        margin-top: 16px;
    }

    .loading-screen-stat-item {
        padding: 5px 3px;
        border-radius: 5px;
    }

    .loading-screen-stat-value {
        font-size: 0.82rem;
        letter-spacing: -0.5px;
        margin-bottom: 1px;
    }

    .loading-screen-stat-label {
        font-size: 0.5rem;
        letter-spacing: 0;
    }

    .loading-screen-logo-container {
        width: 100px;
        height: 100px;
        margin-bottom: 14px;
    }

    .loading-screen-logo-inner {
        width: 80px;
        height: 80px;
    }

    .loading-screen-title {
        font-size: 1.35rem;
        min-height: 1.8rem;
    }

    .loading-screen-subtitle {
        font-size: 0.8rem;
        margin-bottom: 18px;
    }

    .loading-screen-progress-container {
        height: 18px;
        margin-bottom: 16px;
    }

    .loading-screen-progress-text {
        font-size: 0.8rem;
        margin-top: 10px;
    }
}

/* ============================================================
   RESPONSIVO - MOBILE MUITO PEQUENO (até 320px)
   ============================================================ */
@media (max-width: 320px) {
    .loading-screen-stat-value {
        font-size: 0.72rem;
        letter-spacing: -0.6px;
    }

    .loading-screen-stat-label {
        font-size: 0.45rem;
    }

    .loading-screen-stat-item {
        padding: 4px 2px;
    }

    .loading-screen-stats {
        gap: 4px;
    }
}