/* ===== PAGE LOADER (top progress bar) ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-accent));
    z-index: 9999;
    transition: none;
    pointer-events: none;
}

.page-loader.active {
    animation: pageLoad 12s cubic-bezier(0.1, 0.5, 0.3, 1) forwards;
}

.page-loader.done {
    width: 100%;
    transition: width 0.2s ease, opacity 0.4s ease 0.2s;
    opacity: 0;
}

@keyframes pageLoad {
    0%   { width: 0; }
    10%  { width: 25%; }
    30%  { width: 45%; }
    50%  { width: 60%; }
    70%  { width: 75%; }
    90%  { width: 88%; }
    100% { width: 92%; }
}

/* ===== SPINNER OVERLAY ===== */
.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 9998;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--spacing-md);
}

.spinner-overlay.active {
    display: flex;
}

.spinner-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-overlay .spinner-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    font-weight: 500;
}

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

/* ===== TOAST CONTAINER ===== */
.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - var(--spacing-2xl));
}

/* ===== TOAST ===== */
.toast-wc {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 0;
    background: var(--color-white);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.21, 1.02, 0.73, 1), opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.toast-wc.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-wc.hide {
    transform: translateX(120%);
    opacity: 0;
}

.toast-wc-icon {
    font-size: var(--font-size-lg);
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-wc-body {
    flex: 1;
    min-width: 0;
}

.toast-wc-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 2px;
}

.toast-wc-message {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    line-height: 1.4;
}

.toast-wc-close {
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-wc-close:hover {
    opacity: 1;
}

/* Progress bar at bottom of toast */
.toast-wc-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 var(--border-radius-md);
    transition: width linear;
}

/* ===== TOAST TYPES ===== */
.toast-wc--success {
    border-left-color: var(--color-success);
}
.toast-wc--success .toast-wc-icon { color: var(--color-success); }
.toast-wc--success .toast-wc-progress { background: var(--color-success); }

.toast-wc--error {
    border-left-color: var(--color-danger);
}
.toast-wc--error .toast-wc-icon { color: var(--color-danger); }
.toast-wc--error .toast-wc-progress { background: var(--color-danger); }

.toast-wc--warning {
    border-left-color: #e6a817;
}
.toast-wc--warning .toast-wc-icon { color: #e6a817; }
.toast-wc--warning .toast-wc-progress { background: #e6a817; }

.toast-wc--info {
    border-left-color: var(--color-primary-light);
}
.toast-wc--info .toast-wc-icon { color: var(--color-primary-light); }
.toast-wc--info .toast-wc-progress { background: var(--color-primary-light); }

/* ===== RESPONSIVE ===== */
@media (max-width: 576px) {
    .toast-container {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
        left: var(--spacing-sm);
        width: auto;
        max-width: none;
    }
}
