/* =====================================================
   Imperial University College - Learning Platform
   Screens - Loading, Error, Success, Empty
   ===================================================== */

/* =====================================================
   Full Page Screen (Loading / Error)
   ===================================================== */

.screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    background-color: var(--c-bg);
    z-index: var(--z-modal);
    animation: fade-in var(--t-base) ease-out;
}

.screen--static {
    position: relative;
    min-height: 100vh;
    inset: auto;
}

.screen__content {
    max-width: 480px;
    width: 100%;
    text-align: center;
}

/* =====================================================
   Loader / Spinner Variants
   ===================================================== */

.screen__loader {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--sp-6);
}

/* ---- Classic Spinner ---- */

.loader-spinner {
    width: 100%;
    height: 100%;
    border: 3px solid var(--c-slate-200);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

/* ---- Dual Ring ---- */

.loader-dual-ring {
    display: inline-block;
    width: 64px;
    height: 64px;
    position: relative;
}

.loader-dual-ring::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--c-primary);
    border-color: var(--c-primary) transparent var(--c-primary) transparent;
    animation: dual-ring 1.15s linear infinite;
}

@keyframes dual-ring {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Dot Pulse ---- */

.loader-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    height: 64px;
}

.loader-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--c-primary);
    animation: dot-pulse 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---- Bouncing Bar ---- */

.loader-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 64px;
}

.loader-bars span {
    width: 6px;
    background-color: var(--c-primary);
    border-radius: var(--r-full);
    animation: bar-bounce 1.2s ease-in-out infinite;
}

.loader-bars span:nth-child(1) { height: 30%; animation-delay: 0s; }
.loader-bars span:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.loader-bars span:nth-child(3) { height: 90%; animation-delay: 0.2s; }
.loader-bars span:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.loader-bars span:nth-child(5) { height: 30%; animation-delay: 0.4s; }

@keyframes bar-bounce {
    0%, 100% { transform: scaleY(0.5); }
    50%      { transform: scaleY(1); }
}

/* =====================================================
   Screen Text
   ===================================================== */

.screen__title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-semibold);
    color: var(--c-text);
    margin-bottom: var(--sp-2);
    letter-spacing: -0.01em;
}

.screen__message {
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
    line-height: var(--lh-relaxed);
    margin-bottom: var(--sp-5);
}

.screen__actions {
    display: flex;
    gap: var(--sp-3);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--sp-5);
}

/* =====================================================
   Screen Icon (Error / Success)
   ===================================================== */

.screen__icon {
    width: 72px;
    height: 72px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-5);
}

.screen__icon svg {
    width: 32px;
    height: 32px;
    stroke-width: 1.75;
}

.screen__icon--error {
    background-color: var(--c-error-light);
    color: var(--c-error);
}

.screen__icon--success {
    background-color: var(--c-success-light);
    color: var(--c-success);
}

.screen__icon--warning {
    background-color: var(--c-warning-light);
    color: var(--c-warning);
}

.screen__icon--info {
    background-color: var(--c-primary-light);
    color: var(--c-primary);
}

/* =====================================================
   Inline Loader (for buttons, small sections)
   ===================================================== */

.inline-loader {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--c-text-secondary);
}

/* =====================================================
   Skeleton Loaders (Content)
   ===================================================== */

.skeleton-block {
    background: linear-gradient(
        90deg,
        var(--c-slate-100) 0%,
        var(--c-slate-200) 50%,
        var(--c-slate-100) 100%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--r-sm);
}

.skeleton-line {
    height: 14px;
    margin-bottom: var(--sp-3);
}

.skeleton-line--title {
    height: 24px;
    width: 50%;
    margin-bottom: var(--sp-4);
}

.skeleton-line--short {
    width: 30%;
}

.skeleton-line--medium {
    width: 70%;
}

.skeleton-card {
    padding: var(--sp-5);
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.skeleton-card__avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--r-full);
    flex-shrink: 0;
}

.skeleton-card__content {
    flex: 1;
}

/* =====================================================
   Progress Bar Screen (for uploads / long processes)
   ===================================================== */

.screen-progress {
    width: 100%;
    max-width: 360px;
    margin: var(--sp-6) auto 0;
}

.screen-progress__header {
    display: flex;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--c-text-secondary);
    margin-bottom: var(--sp-2);
    font-family: var(--font-en);
    font-weight: var(--fw-medium);
}

.screen-progress__track {
    height: 6px;
    background-color: var(--c-slate-200);
    border-radius: var(--r-full);
    overflow: hidden;
}

.screen-progress__fill {
    height: 100%;
    background-color: var(--c-primary);
    border-radius: var(--r-full);
    transition: width 200ms ease;
    width: 0%;
}

/* =====================================================
   Screen Sizes
   ===================================================== */

.screen--compact .screen__loader {
    width: 48px;
    height: 48px;
}

.screen--compact .screen__title {
    font-size: var(--fs-md);
}

.screen--compact .screen__icon {
    width: 56px;
    height: 56px;
}

.screen--compact .screen__icon svg {
    width: 24px;
    height: 24px;
}

/* =====================================================
   Toast Progress (bottom-right)
   ===================================================== */

.toast-progress {
    position: fixed;
    bottom: var(--sp-5);
    inset-inline-end: var(--sp-5);
    background-color: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-lg);
    padding: var(--sp-4);
    min-width: 280px;
    max-width: 400px;
    z-index: var(--z-toast);
    animation: fade-in-up var(--t-slower) ease-out;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.toast-progress__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    background-color: var(--c-primary-light);
    color: var(--c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-progress__icon svg {
    width: 18px;
    height: 18px;
}

.toast-progress__content {
    flex: 1;
    min-width: 0;
}

.toast-progress__title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--c-text);
    margin-bottom: 2px;
}

.toast-progress__track {
    height: 4px;
    background-color: var(--c-slate-200);
    border-radius: var(--r-full);
    overflow: hidden;
    margin-top: var(--sp-2);
}

.toast-progress__fill {
    height: 100%;
    background-color: var(--c-primary);
    transition: width 200ms ease;
    width: 0%;
}

.toast-progress__percent {
    font-size: var(--fs-xs);
    color: var(--c-text-tertiary);
    font-family: var(--font-en);
    margin-top: 4px;
}