@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

:root {
    --accent:        #667eea;
    --accent-dark:   #5a6fd6;
    --accent-light:  #eef0fd;
    --sidebar-bg:    #ffffff;
    --sidebar-border:#e5e7eb;
    --text-primary:  #111827;
    --text-secondary:#6b7280;
    --text-muted:    #9ca3af;
    --surface:       #f9fafb;
    --border:        #e5e7eb;
}

html, body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    overflow-x: hidden;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--accent);
}

.btn-primary {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
}

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

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(102, 126, 234, 0.35);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid #dc2626;
}

.validation-message {
    color: #dc2626;
    font-size: 0.85rem;
}

#blazor-error-ui {
    background: #fefce8;
    border-top: 1px solid #fde047;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #713f12;
    font-size: 0.875rem;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92Z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uODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ===== Modal de reconexión ===== */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

.components-messages {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem 2.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.components-reconnecting,
.components-failed,
.components-rejected {
    display: none;
}

.components-reconnect-show .components-reconnecting { display: block; }
.components-reconnect-failed .components-failed { display: block; }
.components-reconnect-rejected .components-rejected { display: block; }

.reconnect-matrix-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.reconnect-matrix-icon {
    font-size: 1.5rem;
    color: #f59e0b;
}

.components-failed .reconnect-matrix-icon,
.components-rejected .reconnect-matrix-icon {
    color: #dc2626;
}

.reconnect-matrix-glitch {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #111827;
}

.components-messages p {
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0.5rem 0 0;
}

.components-messages a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

.reconnect-matrix-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.reconnect-spinner-ring {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: reconnect-spin 0.9s linear infinite;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

.reconnect-matrix-chars {
    display: none;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    letter-spacing: 0.1em;
    min-width: 5ch;
    text-align: left;
}

/* ===== Modal reconexión — Modo Matrix ===== */
body.matrix-mode #components-reconnect-modal {
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(2px);
}

body.matrix-mode .components-messages {
    background: #080808;
    border: 1px solid #00ff41;
    border-radius: 4px;
    box-shadow: 0 0 40px #00ff4140, inset 0 0 30px #00ff410a;
    font-family: 'Courier New', Courier, monospace;
}

body.matrix-mode .reconnect-matrix-glitch {
    color: #00ff41;
    text-shadow: 0 0 8px #00ff41, 0 0 20px #00ff4188;
    animation: matrixGlitch 2.8s infinite;
    position: relative;
}

body.matrix-mode .reconnect-matrix-glitch::before,
body.matrix-mode .reconnect-matrix-glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    overflow: hidden;
}

body.matrix-mode .reconnect-matrix-glitch::before {
    color: #ff0040;
    text-shadow: none;
    clip-path: inset(0 0 60% 0);
    animation: matrixGlitchTop 2.8s infinite;
    opacity: 0.7;
}

body.matrix-mode .reconnect-matrix-glitch::after {
    color: #00eaff;
    text-shadow: none;
    clip-path: inset(60% 0 0 0);
    animation: matrixGlitchBottom 2.8s infinite;
    opacity: 0.7;
}

@keyframes matrixGlitch {
    0%, 90%, 100% { transform: translate(0); }
    91%  { transform: translate(-2px,  1px); }
    93%  { transform: translate( 2px, -1px); }
    95%  { transform: translate(-1px,  2px); }
    97%  { transform: translate( 1px, -2px); }
}

@keyframes matrixGlitchTop {
    0%, 90%, 100% { transform: translate(0); clip-path: inset(0 0 60% 0); }
    91%  { transform: translate(-3px, 0); clip-path: inset(5% 0 55% 0); }
    93%  { transform: translate( 3px, 0); clip-path: inset(0   0 65% 0); }
    95%  { transform: translate(0);      clip-path: inset(10% 0 50% 0); }
}

@keyframes matrixGlitchBottom {
    0%, 90%, 100% { transform: translate(0); clip-path: inset(60% 0 0 0); }
    92%  { transform: translate( 3px, 0); clip-path: inset(55% 0 5% 0); }
    94%  { transform: translate(-3px, 0); clip-path: inset(65% 0 0   0); }
    96%  { transform: translate(0);       clip-path: inset(50% 0 10% 0); }
}

body.matrix-mode .reconnect-matrix-icon {
    color: #ffcc00;
    text-shadow: 0 0 8px #ffcc00aa;
    animation: matrixIconPulse 1.2s ease-in-out infinite;
}

body.matrix-mode .components-failed .reconnect-matrix-icon,
body.matrix-mode .components-rejected .reconnect-matrix-icon {
    color: #ff0040;
    text-shadow: 0 0 8px #ff004088;
    animation: matrixIconPulse 0.6s ease-in-out infinite;
}

@keyframes matrixIconPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

body.matrix-mode .components-messages p {
    color: #4af26a;
    text-shadow: 0 0 4px #00ff4144;
}

body.matrix-mode .components-messages a {
    color: #00ff41;
    text-shadow: 0 0 6px #00ff41;
}

body.matrix-mode .reconnect-spinner-ring {
    border-color: #00ff4133;
    border-top-color: #00ff41;
    box-shadow: 0 0 8px #00ff41;
}

body.matrix-mode .reconnect-matrix-chars {
    display: inline;
    color: #00ff41;
    text-shadow: 0 0 4px #00ff41;
}
