/* ============================================================
   PRELOADER
   ============================================================ */

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/intro.jpeg');
    background-size: cover;
    background-position: center;
    background-color: var(--dc-c-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
}

#preloader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(20, 35, 45, 0.45);
    z-index: 0;
}

#preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Welcome screen is visible — let modals (z 2000+) and login (z 99999) appear above */
#preloader.welcome-mode {
    z-index: 1500;
}

.preloader-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 1;
}

/* Loading section — visible during preload, fades out after */
.preloader-loading {
    transition: opacity 0.3s ease;
}

.preloader-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

/* User button on welcome screen */
.intro-user-wrap {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 2;
}

.intro-user-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px 7px 10px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    color: var(--dc-n-0);
    font-size: var(--dc-text-md);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
    backdrop-filter: blur(4px);
}

.intro-user-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.7);
}

.intro-user-menu {
    right: 0;
    left: auto;
}

#introUserName:empty { display: none; }

/* Mode cards — hidden during preload, fades in after */
.preloader-mode-cards {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.preloader-mode-cards.visible {
    opacity: 1;
    pointer-events: all;
}

.preloader-logo {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--dc-c-accent);
}

.preloader-text {
    font-size: var(--dc-text-xl);
    margin-bottom: 30px;
    color: var(--dc-n-50);
}

.preloader-progress {
    width: 300px;
    height: 6px;
    background: #34495e;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.preloader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--dc-c-accent), #8fd4c1);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.preloader-status {
    font-size: var(--dc-text-md);
    color: var(--dc-n-500);
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #34495e;
    border-top: 4px solid var(--dc-c-accent);
    border-radius: 50%;
    /* dcSpin keyframes come from design-tokens.css (imported first) */
    animation: dcSpin 1s linear infinite;
    margin: 20px auto;
}
