/* ============================================================
   app.css — Base styles + Blazor error UI
   ============================================================ */

/* ── 1. GLOBAL RESET ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ── 2. HIDE UTILITY (Blazor dùng .hide để ẩn reconnect/error UI) ── */
.hide { display: none !important; }

/* ── 3. APP LOADING OVERLAY ── */
.app-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #07090f;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.app-loading.hide {
    display: none !important;
}

.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-card .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(34, 211, 238, 0.15);
    border-top-color: #22d3ee;
    border-radius: 50%;
    animation: appSpin 0.8s linear infinite;
}

.loading-text {
    color: #94a3b8;
    font-size: 0.9rem;
    font-family: 'Inter', system-ui, sans-serif;
}

@keyframes appSpin { to { transform: rotate(360deg); } }

/* ── 4. BLAZOR RECONNECT TOAST ── */
.bl-reconnect-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8000;
    background: #1a2332;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    padding: 14px 20px;
    min-width: 280px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.toast-icon svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fbbf24;
    font-family: 'Inter', system-ui, sans-serif;
}

.toast-sub {
    font-size: 0.78rem;
    color: #94a3b8;
    font-family: 'Inter', system-ui, sans-serif;
}

.toast-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #fbbf24, #fb923c);
    border-radius: 2px;
    animation: toastProgress 8s linear infinite;
    transform-origin: left;
}

@keyframes toastProgress {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

/* ── 5. BLAZOR ERROR OVERLAY ── */
.bl-error-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.bl-error-card {
    background: #111827;
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 16px;
    padding: 36px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.bl-error-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.bl-error-icon-wrap svg {
    width: 28px;
    height: 28px;
}

.bl-error-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 10px;
    font-family: 'Inter', system-ui, sans-serif;
}

.bl-error-desc {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 24px;
    line-height: 1.6;
    font-family: 'Inter', system-ui, sans-serif;
}

.bl-error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.bl-btn-reload {
    padding: 10px 24px;
    background: linear-gradient(135deg, #22d3ee, #0891b2);
    color: #0a0f1e;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    transition: all 0.2s ease;
}

.bl-btn-reload:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.4);
}

.bl-btn-dismiss {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    transition: all 0.2s ease;
}

.bl-btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

/* ── 6. BLAZOR BUILT-IN ERROR UI (override) ── */
#blazor-error-ui {
    display: none !important;
}

/* ── 7. SPINNER (shared) ── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(34, 211, 238, 0.15);
    border-top-color: #22d3ee;
    border-radius: 50%;
    animation: appSpin 0.8s linear infinite;
}
