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

body {
    background: linear-gradient(135deg, #253D66 0%, #9EB2C8 100%);
    font-family: 'Arial', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 1.5rem;
}

/* ==================== BARRA DE ERROR PERSISTENTE ==================== */

.error-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.error-bar.error-critical {
    background: #7f1d1d;
    color: #ffffff;
    border-bottom: 3px solid #ff6b6b;
}

.error-bar.error-warning {
    background: #92400e;
    color: #ffffff;
    border-bottom: 3px solid #fbbf24;
}

.error-bar.error-info {
    background: #1e40af;
    color: #ffffff;
    border-bottom: 3px solid #60a5fa;
}

.error-bar-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.error-bar-message {
    flex: 1;
    font-weight: 500;
}

.error-bar-count {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
}

.error-bar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.error-bar-dismiss {
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    border-radius: 0.45rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.error-bar-dismiss:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.error-bar-dismiss:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.error-bar-details-toggle {
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    border-radius: 0.45rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.error-bar-details-toggle:hover {
    opacity: 1;
}

.error-bar-details {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 101;
}

/* ==================== ESTADOS DEGRADADOS ==================== */

.status-value[data-state="degraded"] {
    color: #f59e0b;
    animation: pulse-degraded 2s infinite;
}

@keyframes pulse-degraded {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==================== ALTO CONTRASTE MEJORADO ==================== */

body.high-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

body.high-contrast .title,
body.high-contrast .subtitle,
body.high-contrast .status-panel,
body.high-contrast .status-label,
body.high-contrast .status-hint,
body.high-contrast .privacy-toggle,
body.high-contrast .contrast-toggle,
body.high-contrast .privacy-card,
body.high-contrast .privacy-card p,
body.high-contrast .privacy-card li,
body.high-contrast .privacy-close,
body.high-contrast .error-bar-message,
body.high-contrast .error-bar-dismiss,
body.high-contrast .error-bar-details-toggle {
    color: #ffffff !important;
}

body.high-contrast .subtitle,
body.high-contrast .status-panel,
body.high-contrast .privacy-card {
    background: #000000 !important;
    border: 3px solid #ffffff !important;
    box-shadow: none !important;
}

body.high-contrast .status-value[data-state="ok"] {
    color: #00ff00 !important;
    text-shadow: 0 0 5px #00ff00;
}

body.high-contrast .status-value[data-state="warn"] {
    color: #ffff00 !important;
    text-shadow: 0 0 5px #ffff00;
}

body.high-contrast .status-value[data-state="error"] {
    color: #ff4d4d !important;
    text-shadow: 0 0 5px #ff4d4d;
}

body.high-contrast .status-value[data-state="degraded"] {
    color: #ffa500 !important;
    text-shadow: 0 0 5px #ffa500;
}

body.high-contrast .error-bar.error-critical {
    background: #600000 !important;
    border-bottom-color: #ff0000 !important;
}

body.high-contrast .error-bar.error-warning {
    background: #805300 !important;
    border-bottom-color: #ffcc00 !important;
}

body.high-contrast .error-bar.error-info {
    background: #003366 !important;
    border-bottom-color: #0099ff !important;
}

body.high-contrast .privacy-modal {
    background: rgba(0, 0, 0, 0.95) !important;
}

body.high-contrast .error-bar-details {
    background: #111111 !important;
    border-top: 2px solid #ffffff !important;
}

/* Mejoras de foco para alto contraste */
body.high-contrast button:focus,
body.high-contrast a:focus,
body.high-contrast input:focus,
body.high-contrast textarea:focus,
body.high-contrast select:focus {
    outline: 3px solid #ffff00 !important;
    outline-offset: 3px !important;
}

body.high-contrast .privacy-toggle:focus,
body.high-contrast .contrast-toggle:focus,
body.high-contrast .error-bar-dismiss:focus,
body.high-contrast .error-bar-details-toggle:focus,
body.high-contrast .privacy-close:focus {
    outline: 3px solid #ffff00 !important;
    outline-offset: 3px !important;
}

/* Reducción de movimiento en alto contraste */
body.high-contrast.reduce-motion .title,
body.high-contrast.reduce-motion .quantum-orb,
body.high-contrast.reduce-motion .subtitle {
    animation: none !important;
}

body.high-contrast.reduce-motion .status-value[data-state="degraded"] {
    animation: none !important;
    opacity: 1 !important;
}

/* ==================== ELEMENTOS INTERACTIVOS ==================== */

#quantum-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.main-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 3rem);
    text-align: center;
    padding: 2rem 1rem;
}

.title {
    font-size: 4rem;
    font-weight: bold;
    color: #D8E2ED;
    text-shadow: 
        0 0 10px rgba(216, 226, 237, 0.3),
        0 0 20px rgba(216, 226, 237, 0.2),
        0 0 30px rgba(216, 226, 237, 0.1);
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite alternate;
}

.subtitle {
    font-size: 1.2rem;
    color: #F6FBFF;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    opacity: 0.8;
    display: inline-flex;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(12, 22, 38, 0.45);
}

.hero-logo {
    display: block;
    margin: 2rem auto 0;
    max-width: 220px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.3));
}

.status-panel {
    margin: 2rem auto 0;
    padding: 1rem 1.5rem;
    max-width: 360px;
    border-radius: 1rem;
    background: rgba(10, 18, 30, 0.55);
    border: 1px solid rgba(216, 226, 237, 0.2);
    color: #d8e2ed;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.status-label {
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #9eb2c8;
}

.status-value {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.status-value[data-state="ok"] {
    color: #9ed6a7;
}

.status-value[data-state="warn"] {
    color: #f4d68b;
}

.status-value[data-state="error"] {
    color: #f4a1a1;
}

.status-hint {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #9eb2c8;
}

@keyframes pulse {
    from {
        text-shadow: 
            0 0 10px rgba(216, 226, 237, 0.3),
            0 0 20px rgba(216, 226, 237, 0.2),
            0 0 30px rgba(216, 226, 237, 0.1);
    }
    to {
        text-shadow: 
            0 0 20px rgba(216, 226, 237, 0.6),
            0 0 30px rgba(216, 226, 237, 0.4),
            0 0 40px rgba(216, 226, 237, 0.2);
    }
}

.quantum-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: float 6s ease-in-out infinite;
}

.orb-1 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(181, 44, 50, 0.3) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(158, 178, 200, 0.4) 0%, transparent 70%);
    top: 70%;
    right: 15%;
    animation-delay: 2s;
}

.orb-3 {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(37, 61, 102, 0.5) 0%, transparent 70%);
    bottom: 30%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(120deg); }
    66% { transform: translateY(10px) rotate(240deg); }
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    .subtitle {
        font-size: 1rem;
        letter-spacing: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .title,
    .quantum-orb,
    .subtitle {
        animation: none !important;
    }
    body {
        overflow: auto;
    }
}

.privacy-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 3;
    background: rgba(37, 61, 102, 0.85);
    color: #D8E2ED;
    border: 1px solid rgba(216, 226, 237, 0.4);
    border-radius: 999px;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.contrast-toggle {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    z-index: 3;
    background: rgba(16, 27, 43, 0.9);
    color: #D8E2ED;
    border: 1px solid rgba(216, 226, 237, 0.45);
    border-radius: 999px;
    padding: 0.65rem 1.2rem;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
}

.contrast-toggle:focus {
    outline: 2px solid #D8E2ED;
    outline-offset: 2px;
}

.contrast-toggle[aria-pressed="true"] {
    background: #111111;
    border-color: #ffffff;
    color: #ffffff;
}

.privacy-toggle:focus {
    outline: 2px solid #D8E2ED;
    outline-offset: 2px;
}

.privacy-toggle:hover {
    background: rgba(37, 61, 102, 0.95);
    transform: translateY(-1px);
}

.privacy-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.privacy-modal.open {
    opacity: 1;
    pointer-events: all;
}

.privacy-card {
    background: #101b2b;
    color: #d8e2ed;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 460px;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    position: relative;
}

.privacy-card h2 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.privacy-card p,
.privacy-card li {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #9eb2c8;
}

.privacy-card ul {
    margin: 0.5rem 0 1rem 1.2rem;
}

.privacy-close {
    background: transparent;
    border: none;
    color: #d8e2ed;
    font-size: 1.2rem;
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
}

.privacy-close:focus {
    outline: 2px solid #d8e2ed;
    outline-offset: 2px;
}
