/* ===========================
   PÁGINA DE LOGIN - 100% RESPONSIVO
   MOBILE FIRST COM DESIGN TOKENS
   =========================== */

/* ===========================
   1. DESIGN TOKENS
   =========================== */

:root {
    /* Cores do gradiente */
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --gradient-overlay: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);

    /* Cores principais */
    --color-primary: #667eea;
    --color-primary-dark: #5568d3;
    --color-white: #ffffff;
    --color-text: #212529;
    --color-text-muted: #6c757d;

    /* Cores de estado */
    --color-border: #dee2e6;
    --color-bg-light: #f8f9fa;
    --color-focus: rgba(102, 126, 234, 0.15);
    --color-shadow: rgba(0, 0, 0, 0.1);

    /* Tipografia fluida com clamp() */
    --font-size-sm: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);     /* 12-14px */
    --font-size-base: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);     /* 14-16px */
    --font-size-md: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);       /* 15-18px */
    --font-size-lg: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);           /* 18-21px */
    --font-size-xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);             /* 24-32px */
    --font-size-icon: clamp(1.75rem, 1.5rem + 1.25vw, 2.5rem);     /* 28-40px */

    /* Espaçamento fluido */
    --spacing-xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);       /* 4-6px */
    --spacing-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);          /* 8-12px */
    --spacing-md: clamp(0.75rem, 0.6rem + 0.75vw, 1rem);           /* 12-16px */
    --spacing-lg: clamp(1rem, 0.8rem + 1vw, 1.5rem);               /* 16-24px */
    --spacing-xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);             /* 24-32px */

    /* Border radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.9375rem;

    /* Sombras */
    --shadow-base: 0 0.625rem 2.5rem var(--color-shadow);
    --shadow-hover: 0 0.9375rem 3.75rem rgba(0, 0, 0, 0.15);
    --shadow-button: 0 0.3125rem 0.9375rem rgba(13, 110, 253, 0.3);

    /* Transições */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.4s ease;
}

/* ===========================
   2. CONFIGURAÇÕES GLOBAIS
   =========================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient-overlay);
    min-height: 100vh;
    font-size: var(--font-size-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

/* ===========================
   3. CONTAINER (FLEXBOX)
   =========================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
}

.login-container {
    width: 100%;
    max-width: 450px;
    display: block;
}

.login-container > .card {
    display: block;
    width: 100%;
    margin-bottom: 1.25rem;
}

.login-footer {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 1.25rem;
    padding: 0.75rem 0;
    clear: both;
}

.login-footer small {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

/* ===========================
   4. CARD (CONTAINER QUERY)
   =========================== */

.card {
    container-type: inline-size;
    border-radius: var(--radius-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--shadow-base);
    border: none;
    background-color: var(--color-white);
    display: block;
}

.card:hover {
    transform: translateY(-0.3125rem);
    box-shadow: var(--shadow-hover);
}

.card-body {
    padding: 2rem 1.5rem;
}

/* Card padding adaptativo com Container Query */
@container (min-width: 400px) {
    .card-body {
        padding: 2.5rem 2rem;
    }
}

/* ===========================
   5. HEADER DO CARD
   =========================== */

.text-center {
    text-align: center;
}

.text-center i {
    color: var(--color-primary);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: inline-block;
}

h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.text-center p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.empresa-nome {
    font-size: 0.95rem;
    color: var(--color-text);
    font-weight: 500;
    margin-bottom: 0;
}

/* ===========================
   6. FORMULÁRIOS
   =========================== */

.mb-3 {
    margin-bottom: 1.25rem;
}

.mb-4 {
    margin-bottom: 1.75rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--color-text);
}

.input-group {
    display: flex;
    width: 100%;
    position: relative;
}

.input-group-text {
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    padding: 0.625rem 1rem;
    display: flex;
    align-items: center;
    color: var(--color-text-muted);
    min-height: 42px;
}

.form-control {
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: all var(--transition-base);
    font-size: var(--font-size-base);
    width: 100%;
    line-height: 1.5;
    min-height: 42px;
}

.input-group .form-control {
    border-inline-start: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem var(--color-focus);
    outline: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--color-primary);
}

/* ===========================
   7. CHECKBOX E OPÇÕES
   =========================== */

.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.form-check-input {
    cursor: pointer;
    width: 1.125rem;
    height: 1.125rem;
}

.form-check-label {
    font-size: var(--font-size-sm);
    cursor: pointer;
    color: var(--color-text);
}

/* ===========================
   8. BOTÕES
   =========================== */

.btn-primary {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    background-color: var(--color-primary);
    color: var(--color-white);
    font-size: var(--font-size-base);
    cursor: pointer;
    min-height: 46px;
}

.btn-primary:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--shadow-button);
    background-color: var(--color-primary-dark);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-secondary {
    padding: 0.625rem 1rem;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    background-color: transparent;
    color: var(--color-text-muted);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-outline-secondary:hover {
    background-color: var(--color-bg-light);
    color: var(--color-text);
}

/* ===========================
   9. ALERTAS
   =========================== */

.alert {
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert i {
    flex-shrink: 0;
}

/* ===========================
   10. FOOTER DO CARD
   =========================== */

.mt-3 {
    margin-top: 1.25rem;
}

.login-container .text-center.mt-3 {
    padding: 0.75rem;
    text-align: center;
}

.login-container .text-center.mt-3 small {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

.text-muted {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* ===========================
   11. ANIMAÇÕES
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(1.25rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn var(--transition-slow);
}

/* ===========================
   12. MEDIA QUERIES - MOBILE FIRST
   =========================== */

/* Tablet pequeno (576px+) */
@media (min-width: 576px) {
    .login-container {
        max-width: 480px;
    }

    .card-body {
        padding: 2.5rem 2rem;
    }
}

/* Tablet médio (768px+) */
@media (min-width: 768px) {
    .login-container {
        max-width: 500px;
    }
}

/* Desktop (992px+) */
@media (min-width: 992px) {
    .login-container {
        max-width: 520px;
    }
}

/* ===========================
   13. ORIENTAÇÃO LANDSCAPE (DISPOSITIVOS PEQUENOS)
   =========================== */

@media (max-height: 500px) and (orientation: landscape) {
    .login-wrapper {
        min-height: auto;
        padding: 15px 10px;
    }

    .card-body {
        padding: 1.5rem 1.25rem;
    }

    .text-center i {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .mb-3 {
        margin-bottom: 0.75rem;
    }

    .mb-4 {
        margin-bottom: 1rem;
    }

    h3 {
        font-size: 1.35rem;
    }
}

/* ===========================
   14. MEDIA QUERIES MODERNAS
   =========================== */

/* Modo escuro (Dark Mode) */
@media (prefers-color-scheme: dark) {
    :root {
        --color-white: #1a1a1a;
        --color-text: #f8f9fa;
        --color-text-muted: #adb5bd;
        --color-border: #495057;
        --color-bg-light: #2d2d2d;
        --color-shadow: rgba(0, 0, 0, 0.3);
    }

    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }

    .card {
        background-color: #2d2d2d;
        color: var(--color-text);
    }

    .form-control {
        background-color: #1a1a1a;
        color: var(--color-text);
    }

    .input-group-text {
        background-color: #1a1a1a;
        color: var(--color-text-muted);
    }
}

/* Movimento reduzido (acessibilidade) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .card:hover,
    .btn-primary:hover {
        transform: none !important;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--color-text);
    }

    .form-control,
    .input-group-text {
        border-width: 2px;
    }

    .btn-primary {
        border: 2px solid var(--color-white);
    }
}

/* ===========================
   15. IMPRESSÃO
   =========================== */

@media print {
    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--color-border);
    }

    .btn-primary {
        display: none;
    }
}
