/* ============================================
   SAM - Style Sheet
   BBVA Brand Theme
   Fullscreen vertical touch kiosk
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f4f7fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #5e6b7a;
    --accent: #004481;
    --accent-hover: #003366;
    --accent-light: #1973b8;
    --color-pasivo: #d32f2f;
    --color-aliado: #f5a623;
    --color-activo: #2e7d32;
    --border-color: #d0d7de;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0, 68, 129, 0.08);
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* Container */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 20px;
    position: relative;
}

/* Header */
.header {
    text-align: center;
    padding: 20px 0 12px;
    flex-shrink: 0;
}

.logo {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--accent);
    line-height: 1.2;
}

.logo span {
    color: var(--accent-light);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 400;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.input-textarea {
    width: 100%;
    min-height: 120px;
    padding: 18px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.05rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
}

.input-textarea:focus {
    border-color: var(--accent);
}

.input-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-right: 4px;
}

/* Button */
.btn-submit {
    width: 100%;
    min-height: 56px;
    padding: 16px 32px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.btn-submit:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-submit:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loader */
.btn-loader {
    display: inline-flex;
    align-items: center;
}

.dot-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: pulse 1.2s ease-in-out infinite;
}

.dot-pulse::before,
.dot-pulse::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    animation: pulse 1.2s ease-in-out infinite;
}

.dot-pulse::before {
    right: 12px;
    animation-delay: -0.4s;
}

.dot-pulse::after {
    left: 12px;
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Result Section */
.result-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--accent);
    transition: border-color 0.5s ease, background 0.5s ease;
    background: var(--bg-primary);
}

.score-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    transition: color 0.5s ease;
    color: var(--accent);
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Score colors by category */
.score-circle.pasivo {
    border-color: var(--color-pasivo);
}
.score-circle.pasivo .score-number {
    color: var(--color-pasivo);
}

.score-circle.aliado {
    border-color: var(--color-aliado);
}
.score-circle.aliado .score-number {
    color: var(--color-aliado);
}

.score-circle.activo {
    border-color: var(--color-activo);
}
.score-circle.activo .score-number {
    color: var(--color-activo);
}

.categoria {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    transition: color 0.5s ease;
}

.categoria.pasivo { color: var(--color-pasivo); }
.categoria.aliado { color: var(--color-aliado); }
.categoria.activo { color: var(--color-activo); }

.mensaje {
    font-size: 1.05rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    max-width: 480px;
}

/* Reset / Retry Button */
.btn-reset {
    min-height: 48px;
    padding: 12px 32px;
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.btn-reset:active {
    background: var(--accent);
    color: #fff;
}

/* Error Section */
.error-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeInUp 0.3s ease;
}

.error-text {
    font-size: 1.05rem;
    color: var(--color-pasivo);
    text-align: center;
}

/* Footer */
.footer {
    text-align: center;
    padding: 12px 0;
    flex-shrink: 0;
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-height: 700px) {
    .container {
        padding: 12px 16px;
    }
    .logo {
        font-size: 2.2rem;
    }
    .subtitle {
        font-size: 0.95rem;
    }
    .input-section {
        padding: 16px;
    }
    .input-textarea {
        min-height: 90px;
        padding: 14px;
    }
    .score-circle {
        width: 110px;
        height: 110px;
    }
    .score-number {
        font-size: 2.4rem;
    }
    .categoria {
        font-size: 1.2rem;
    }
    .result-section {
        padding: 16px;
    }
}

@media (max-height: 500px) {
    .header {
        padding: 8px 0;
    }
    .logo {
        font-size: 1.8rem;
    }
    .subtitle {
        display: none;
    }
    .input-section {
        padding: 12px;
    }
    .input-textarea {
        min-height: 70px;
        font-size: 0.95rem;
    }
    .score-circle {
        width: 90px;
        height: 90px;
    }
    .score-number {
        font-size: 2rem;
    }
    .footer {
        display: none;
    }
}
