/* ============================================
   EnemIA - CSS Comum
   Estilos compartilhados entre as páginas
   ============================================ */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variáveis de Cores (Tema Dark) */
:root {
    --bg-primary: #343541;
    --bg-secondary: #202123;
    --bg-tertiary: #40414f;
    --bg-modal: #2d2d2d;
    --bg-input: #1a1a1a;
    --border-color: #565869;
    --border-light: #4d4d4f;
    --text-primary: #ececf1;
    --text-secondary: #8e8ea0;
    --color-primary: #19c37d;
    --color-primary-hover: #15a06a;
    --color-focus: #10a37f;
    --color-error: #ef4444;
    --color-button-blue: #2563eb;
    --color-button-blue-hover: #1d4ed8;
}

/* Tipografia Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-primary);
}

/* Scrollbar Customizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ============================================
   Modal de Autenticação (Comum)
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-modal);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal h2 {
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.codigo-container {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.codigo-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s;
}

.codigo-input:focus {
    border-color: var(--color-button-blue);
}

.codigo-input.filled {
    border-color: var(--color-focus);
}

.btn-autenticar {
    width: 100%;
    padding: 0.75rem;
    background: var(--color-button-blue);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-autenticar:hover {
    background: var(--color-button-blue-hover);
}

.btn-autenticar:disabled {
    background: var(--border-light);
    cursor: not-allowed;
}

.erro-msg {
    color: var(--color-error);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ============================================
   Botões Comuns
   ============================================ */
button {
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* ============================================
   Inputs e Textareas Comuns
   ============================================ */
input[type="text"],
input[type="password"],
textarea {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--color-focus);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
}

/* ============================================
   Blocos e Cards Comuns
   ============================================ */
.bloco {
    background-color: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* ============================================
   Media Queries - Responsividade
   ============================================ */

/* Smartphones (iPhone, Android) - até 480px */
@media (max-width: 480px) {
    .modal {
        padding: 1.5rem 1rem;
        max-width: 100%;
        border-radius: 8px;
    }

    .modal h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .codigo-container {
        gap: 0.35rem;
        flex-wrap: wrap;
        margin-bottom: 1rem;
    }

    .codigo-input {
        width: 42px;
        height: 50px;
        font-size: 1.25rem;
    }

    .btn-autenticar {
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    .erro-msg {
        font-size: 0.85rem;
    }
}

/* Tablets e iPad - 481px a 768px */
@media (min-width: 481px) and (max-width: 768px) {
    .modal {
        padding: 1.75rem;
        max-width: 450px;
    }

    .codigo-input {
        width: 48px;
        height: 56px;
    }
}

/* Notebooks - 769px a 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .modal {
        max-width: 480px;
    }
}

/* Smart TV e telas grandes - acima de 1440px */
@media (min-width: 1441px) {
    .modal {
        max-width: 600px;
        padding: 2.5rem;
    }

    .modal h2 {
        font-size: 1.75rem;
    }

    .codigo-input {
        width: 60px;
        height: 70px;
        font-size: 1.75rem;
    }

    .btn-autenticar {
        padding: 1rem;
        font-size: 1.1rem;
    }
}

/* Orientação landscape em dispositivos móveis */
@media (max-width: 768px) and (orientation: landscape) {
    .modal {
        padding: 1rem;
    }

    .modal h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .codigo-container {
        margin-bottom: 0.75rem;
    }

    .codigo-input {
        width: 40px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* Ajustes para touch devices */
@media (hover: none) and (pointer: coarse) {
    .codigo-input {
        font-size: 1.5rem;
    }

    .btn-autenticar {
        min-height: 48px;
    }

    button {
        min-height: 48px;
        touch-action: manipulation;
    }

    input[type="text"],
    input[type="password"],
    textarea {
        font-size: 16px; /* Previne zoom no iOS */
    }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

