/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Variables CSS para tema oscuro/claro */
:root {
    /* Tema claro (por defecto) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f6fa;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-primary: #2c3e50;
    --text-secondary: #666;
    --text-muted: #888;
    --border-color: #e1e8ed;
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(255, 107, 53, 0.3);
    --gradient-login: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-header: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    --primary-color: #ff6b35;
    --primary-hover: #ff8c5a;
    --max-width: 100%;
    --container-padding: 0;
}

/* Tema oscuro */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-card: rgba(45, 45, 45, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #404040;
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 25px rgba(255, 107, 53, 0.5);
    --gradient-login: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --gradient-header: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    overflow-x: hidden;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Pantallas principales */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    position: relative;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.screen.active {
    display: block;
}

/* ===== PANTALLA DE LOGIN ===== */
#loginScreen {
    background: var(--gradient-login);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: var(--shadow);
    text-align: center;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Toggle de tema oscuro en login */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Logo y título */
.logo-section {
    margin-bottom: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.logo {
    width: 60px;
    height: 60px;
}

.cloud-text {
    font-size: 14px;
    color: #3b82f6;
    font-weight: 500;
    font-style: italic;
}

.app-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Formulario de login */
.login-form {
    text-align: left;
}

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

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.input-icon {
    font-size: 16px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #6366f1;
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

/* Botón de login */
.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

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

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

.btn-icon {
    font-size: 18px;
}

.loader {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Sección de ayuda */
.help-section {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

.help-text, .contact-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.help-text strong {
    color: #374151;
    font-weight: 600;
}

.help-icon, .contact-icon {
    font-size: 14px;
}

/* Mensajes de error y éxito */
.error-message, .success-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.success-message {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ===== MODAL NUEVA CONTRASEÑA ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    position: relative;
    z-index: 1001;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    font-size: 22px;
    color: #1f2937;
    margin-bottom: 8px;
}

.modal-header p {
    color: #6b7280;
    font-size: 14px;
}

.password-requirements {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.password-requirements small {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #5b21b6;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* ===== PANTALLA DASHBOARD ===== */
#dashboardScreen {
    background: #f9fafb;
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    background: var(--gradient-header);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.user-info h2 {
    font-size: 20px;
    color: white;
    margin-bottom: 2px;
}

.user-role {
    background: #6366f1;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.logout-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logout-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.dashboard-main {
    padding: 40px 30px;
}

.success-card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.success-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.success-card h1 {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 10px;
}

.success-card p {
    color: #6b7280;
    font-size: 16px;
    margin-bottom: 30px;
}

.test-info {
    background: #f9fafb;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
}

.test-info h3 {
    color: #374151;
    margin-bottom: 15px;
    font-size: 18px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-item:last-child {
    border-bottom: none;
}

.label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.value {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.test-results {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.test-results h3 {
    color: #374151;
    margin-bottom: 15px;
}

.test-results pre {
    background: #f3f4f6;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-overlay p {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

/* ===== BANNER INSTALACIÓN ===== */
.install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    border: 1px solid #e5e7eb;
}

.install-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.install-icon {
    font-size: 24px;
}

.install-text {
    flex: 1;
}

.install-text strong {
    display: block;
    color: #1f2937;
    font-size: 15px;
    margin-bottom: 2px;
}

.install-text small {
    color: #6b7280;
    font-size: 13px;
}

.install-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.install-btn:hover {
    background: #5b21b6;
}

.dismiss-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.dismiss-btn:hover {
    background: #f3f4f6;
    color: #6b7280;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .login-card {
        padding: 35px 25px;
        margin: 20px;
        width: 90%;
        max-width: 400px;
    }
    
    .form-group input {
        padding: 15px;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .login-btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        margin: 10px;
    }
    
    .app-title {
        font-size: 20px;
    }
    
    .dashboard-header {
        padding: 12px 15px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }
    
    .header-left {
        flex: 1;
    }
    
    .dashboard-main {
        padding: 15px 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .success-card {
        padding: 20px 15px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .install-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .install-content {
        padding: 12px 16px;
    }
    
    .escala-option {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .encuesta-card {
        padding: 15px;
    }
    
    .encuesta-card .descripcion {
        display: none;
    }
    
    .encuesta-card h3 {
        font-size: 1rem;
    }
}

@media (max-width: 320px) {
    .login-card {
        padding: 25px 15px;
    }
    
    .form-group input {
        font-size: 14px;
    }
    
    .login-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* ===== DARK MODE (opcional) ===== */
@media (prefers-color-scheme: dark) {
    .login-card {
        background: rgba(31, 41, 55, 0.95);
        border: 1px solid rgba(75, 85, 99, 0.5);
    }
    
    .app-title {
        color: #f9fafb;
    }
    
    .app-subtitle {
        color: #d1d5db;
    }
    
    .form-group label {
        color: #e5e7eb;
    }
    
    .form-group input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-group input:focus {
        background: #4b5563;
        border-color: #6366f1;
    }
    
    .help-section {
        color: #9ca3af;
    }
    
    .help-text strong {
        color: #d1d5db;
    }
}

/* ===== ANIMACIONES ADICIONALES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-card {
    animation: fadeIn 0.6s ease-out;
}

.install-banner {
    animation: slideUp 0.4s ease-out;
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* ===== PRINT STYLES ===== */
@media print {
    .login-btn,
    .logout-btn,
    .install-banner,
    .loading-overlay {
        display: none !important;
    }
    
    .dashboard-container {
        box-shadow: none;
    }
}