// ==========================================================================
// PressZone Theme - Preloader Styles
// ==========================================================================
// Entry point - compiles to preloader.css
// Uses Sass variables with body.dark-mode & nesting pattern.
// ==========================================================================

@import 'abstracts/variables';
@import 'abstracts/mixins';

// --------------------------------------------------------------------------
// Preloader Container
// --------------------------------------------------------------------------
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: $light-bg-primary;
    transition: opacity 0.5s ease, visibility 0.5s ease;

    &.loaded {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    body.dark-mode & {
        background: #0f1419;
    }
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

// --------------------------------------------------------------------------
// Logo
// --------------------------------------------------------------------------
.preloader-logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: $light-bg-tertiary;
    border: 2px solid $light-border-color;
    border-radius: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow:
        0 0 30px rgba($color-primary, 0.2),
        0 0 60px rgba($color-primary, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: logoPulse 2s ease-in-out infinite;

    body.dark-mode & {
        background: linear-gradient(135deg, $dark-bg-tertiary 0%, $dark-bg-primary 100%);
        border-color: $dark-border-color;
    }
}

.logo-letter {
    font-size: 2.5rem;
    font-weight: 800;
    color: $color-primary;
    text-shadow: 0 0 20px rgba($color-primary, 0.5);
}

@keyframes logoPulse {
    0%, 100% {
        box-shadow:
            0 0 30px rgba($color-primary, 0.2),
            0 0 60px rgba($color-primary, 0.1);
    }
    50% {
        box-shadow:
            0 0 40px rgba($color-primary, 0.3),
            0 0 80px rgba($color-primary, 0.15);
    }
}

// --------------------------------------------------------------------------
// Brand Name
// --------------------------------------------------------------------------
.preloader-brand {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 2rem 0;
    letter-spacing: -0.025em;
}

.brand-press {
    color: $light-text-primary;

    body.dark-mode & {
        color: #fff;
    }
}

.brand-zone {
    color: $color-primary;
}

// --------------------------------------------------------------------------
// Progress Card
// --------------------------------------------------------------------------
.preloader-card {
    width: 100%;
    max-width: 320px;
    background: $light-bg-secondary;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid $light-border-color;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 2rem;

    body.dark-mode & {
        background: rgba($dark-bg-tertiary, 0.6);
        border-color: $dark-border-color;
    }
}

.preloader-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;

    @include rtl {
        flex-direction: row-reverse;
    }
}

.preloader-percent {
    font-size: 0.875rem;
    font-weight: 700;
    color: $color-primary;
    font-family: 'Consolas', 'Monaco', monospace;
}

.preloader-status {
    font-size: 0.875rem;
    font-weight: 500;
    color: $light-text-secondary;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    .spin {
        animation: spin 1s linear infinite;
        color: $color-primary;
    }

    body.dark-mode & {
        color: $dark-text-secondary;
    }

    @include rtl {
        flex-direction: row-reverse;
    }
}

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

// Progress Bar
.preloader-progress {
    height: 6px;
    background: $light-bg-tertiary;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.75rem;

    body.dark-mode & {
        background: $dark-bg-primary;
    }
}

.preloader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, $color-primary, $color-primary-hover);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba($color-primary, 0.5);
}

// Footer
.preloader-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;

    @include rtl {
        flex-direction: row-reverse;
    }
}

.preloader-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: $color-primary;
    display: flex;
    align-items: center;
    gap: 0.375rem;

    i {
        font-size: 0.875rem;
    }

    @include rtl {
        flex-direction: row-reverse;
    }
}

.preloader-system {
    font-size: 0.75rem;
    font-weight: 500;
    color: $light-text-muted;
    font-family: 'Consolas', 'Monaco', monospace;

    body.dark-mode & {
        color: $dark-text-muted;
    }
}

// --------------------------------------------------------------------------
// Build Version
// --------------------------------------------------------------------------
.preloader-build {
    font-size: 0.75rem;
    font-weight: 500;
    color: $light-text-muted;
    letter-spacing: 0.1em;
    text-transform: uppercase;

    body.dark-mode & {
        color: $dark-text-muted;
    }
}
