/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.loading-content {
    text-align: center;
    color: #0f172a;
}

.loading-content p {
    margin-top: 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

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

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 440px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.toast-out {
    animation: toastOut 0.25s ease forwards;
}

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-success .toast-icon { color: #059669; }
.toast-error .toast-icon   { color: #dc2626; }
.toast-warning .toast-icon { color: #d97706; }
.toast-info .toast-icon    { color: #2563eb; }

.toast-message { flex: 1; }
.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}
.toast-close:hover { color: #475569; }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s;
    backdrop-filter: blur(4px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: #fff;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    max-width: 480px;
    width: 92%;
    animation: modalIn 0.25s ease;
    overflow: hidden;
}

@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header i { font-size: 1.3rem; }

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.modal-header.modal-success { background: #ecfdf5; }
.modal-header.modal-success i { color: #059669; }

.modal-header.modal-error,
.modal-header.modal-danger { background: #fef2f2; }
.modal-header.modal-error i,
.modal-header.modal-danger i { color: #dc2626; }

.modal-header.modal-warning { background: #fffbeb; }
.modal-header.modal-warning i { color: #d97706; }

.modal-header.modal-info { background: #eff6ff; }
.modal-header.modal-info i { color: #2563eb; }

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-body p {
    color: #475569;
    line-height: 1.6;
    margin: 0;
    font-size: 0.9rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    background: #f8fafc;
}

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 999px;
    transition: width 0.3s;
}

.progress-bar-indeterminate {
    position: absolute;
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, transparent, #2563eb, transparent);
    animation: indeterminate 1.5s infinite;
}

@keyframes indeterminate {
    0%   { left: -30%; }
    100% { left: 100%; }
}

/* ===== Speed Test Results ===== */
.test-result {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1.5rem;
    margin-top: 1.25rem;
}

.test-result h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1rem;
}

.test-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}

.metric {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: 0.6rem;
    text-align: center;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2563eb;
    display: block;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}

.metric-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.metric.metric-good .metric-value { color: #059669; }
.metric.metric-warning .metric-value { color: #d97706; }
.metric.metric-bad .metric-value { color: #dc2626; }

/* ===== Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 0.35rem;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #94a3b8;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}
