/* ============================================
   ESTILOS GENERALES
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    font-size: 16px;
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */

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

.login-box {
    background: white;
    padding: 35px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
}

.logo-icon {
    text-align: center;
    font-size: 56px;
    margin-bottom: 10px;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 6px;
    font-size: 26px;
}

.subtitle {
    text-align: center;
    color: #777;
    margin-bottom: 28px;
    font-size: 15px;
}

/* ============================================
   FORMULARIOS
   ============================================ */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #444;
    font-weight: 600;
    font-size: 15px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 13px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s;
    background: #fafafa;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
}

/* ============================================
   BOTONES
   ============================================ */

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-logout {
    padding: 8px 18px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c0392b;
}

.error-message {
    color: #e74c3c;
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
    min-height: 20px;
}

.footer-text {
    text-align: center;
    color: #aaa;
    margin-top: 22px;
    font-size: 13px;
}

/* ============================================
   PÁGINA PRINCIPAL (APP)
   ============================================ */

.app-container {
    min-height: 100vh;
    background: #f0f2f5;
}

.app-header {
    background: white;
    padding: 14px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}

.app-header h1 {
    color: #667eea;
    font-size: 20px;
}

.welcome-user {
    color: #888;
    font-size: 14px;
}

.main-content {
    max-width: 750px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* ============================================
   TARJETAS (SECCIONES)
   ============================================ */

.card {
    background: white;
    padding: 25px 20px;
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.card h2 {
    color: #333;
    margin-bottom: 18px;
    font-size: 19px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* ============================================
   BOTONES DE TIPO DE TV
   ============================================ */

.tv-type-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn-tv-type {
    padding: 20px 15px;
    background: #f8f9fa;
    border: 3px solid #e0e0e0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-family: inherit;
}

.btn-tv-type:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.btn-tv-type.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.35);
}

.btn-tv-type .icon {
    font-size: 42px;
    display: block;
    margin-bottom: 8px;
}

.btn-tv-type .label {
    font-size: 17px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.btn-tv-type .desc {
    font-size: 12px;
    opacity: 0.8;
}

.selection-info {
    text-align: center;
    color: #667eea;
    font-weight: 600;
    margin-top: 12px;
    font-size: 15px;
    min-height: 22px;
}

/* ============================================
   RESULTADOS
   ============================================ */

.result-content {
    background: #f8f9fc;
    padding: 22px 18px;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    line-height: 1.7;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-content h3 {
    color: #667eea;
    margin: 18px 0 10px 0;
    font-size: 17px;
}

.result-content h3:first-child {
    margin-top: 0;
}

.result-content p {
    margin-bottom: 10px;
    color: #444;
}

.result-content ol,
.result-content ul {
    margin: 10px 0 14px 22px;
}

.result-content li {
    margin-bottom: 8px;
    color: #444;
}

.result-content strong {
    color: #222;
}

.result-content em {
    color: #667eea;
}

/* Animación de carga */
.loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 5px solid #e0e0e0;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 18px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #888;
    font-size: 16px;
}

/* ============================================
   FOOTER
   ============================================ */

.app-footer {
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-size: 12px;
}

/* ============================================
   RESPONSIVE (MÓVILES)
   ============================================ */

@media (max-width: 500px) {
    .login-box {
        padding: 28px 20px;
    }

    .login-box h1 {
        font-size: 22px;
    }

    .app-header {
        padding: 12px 14px;
    }

    .app-header h1 {
        font-size: 17px;
    }

    .welcome-user {
        display: none;
    }

    .main-content {
        padding: 14px 10px;
    }

    .card {
        padding: 20px 15px;
    }

    .card h2 {
        font-size: 17px;
    }

    .tv-type-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .btn-tv-type {
        padding: 15px 10px;
    }

    .btn-tv-type .icon {
        font-size: 34px;
    }

    .btn-tv-type .label {
        font-size: 15px;
    }

    .btn-primary {
        font-size: 16px;
        padding: 14px;
    }

    .result-content {
        padding: 16px 14px;
        font-size: 14px;
    }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}
/* ============================================
   LOGO
   ============================================ */

.logo-container {
    text-align: center;
    margin-bottom: 15px;
}

.logo-login {
    max-width: 150px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-header {
    height: 40px;
    width: auto;
    display: block;
}

/* Ajuste responsive para móviles */
@media (max-width: 500px) {
    .logo-login {
        max-width: 120px;
    }
    
    .logo-header {
        height: 32px;
    }
    
    .header-brand h1 {
        font-size: 16px;
    }
}