:root {
    --bg-color: #030303;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent: #ffffff;
    --border-color: rgba(255, 255, 255, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Vazirmatn', 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at center, #111 0%, var(--bg-color) 100%);
}

/* Ambient Canvas Background */
#ambient-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 1; /* Behind content, above background */
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease;
}

#ambient-canvas.visible {
    opacity: 1;
}

/* Cinematic Shockwave - GPU Optimized */
#shockwave {
    position: fixed;
    top: 50%; left: 50%;
    width: 20px; height: 20px;
    margin-top: -10px; margin-left: -10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 20px 10px rgba(255, 255, 255, 0.4);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
    transform: scale(0) translateZ(0);
}

#shockwave.explode {
    animation: shockwaveBurst 0.9s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

@keyframes shockwaveBurst {
    0% { opacity: 1; border-width: 15px; transform: scale(1) translateZ(0); }
    100% { opacity: 0; border-width: 1px; transform: scale(200) translateZ(0); }
}

/* Intro Container & Text */
#intro-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 10;
}

.typewriter-wrapper {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    padding: 0 20px;
    direction: ltr;
}

#cursor {
    display: inline-block;
    width: 4px;
    height: 2.5rem;
    background-color: white;
    margin-left: 5px;
    vertical-align: middle;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Glitch Effect - Hardware Accelerated */
.glitch {
    animation: glitchAnim 0.15s cubic-bezier(.25, .46, .45, .94) both infinite;
    color: #fff;
    text-shadow: 
        2px 2px 0px rgba(255, 0, 0, 0.7), 
        -2px -2px 0px rgba(0, 255, 255, 0.7);
    will-change: transform;
}

@keyframes glitchAnim {
    0% { transform: translate(0) translateZ(0); }
    20% { transform: translate(-3px, 3px) translateZ(0); }
    40% { transform: translate(-3px, -3px) translateZ(0); }
    60% { transform: translate(3px, 3px) translateZ(0); }
    80% { transform: translate(3px, -3px) translateZ(0); }
    100% { transform: translate(0) translateZ(0); }
}

/* Main Container & Reveal */
#main-container {
    width: 100%;
    height: 100%;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    perspective: 1000px; /* Required for 3D Parallax effect */
}

#main-container.hidden {
    display: none;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    width: 90%;
    max-width: 900px;
    opacity: 0;
    transform: scale(2) translateZ(0);
    will-change: transform, opacity;
    transform-style: preserve-3d;
}

.content-wrapper.reveal {
    animation: slamContent 0.8s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes slamContent {
    0% { opacity: 0; transform: scale(2) translateZ(0); }
    100% { opacity: 1; transform: scale(1) translateZ(0); }
}

/* Brand Logo Glow Effect - GPU Optimized */
.logo-container {
    position: relative;
    display: inline-block;
    transform: translateZ(50px); /* Pops out slightly in 3D */
}

.logo-glow {
    position: absolute;
    top: 50%; left: 50%;
    width: 120%; height: 120%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.4) 0%, rgba(0, 0, 0, 0) 60%);
    filter: blur(15px);
    animation: pulseBackground 3s ease-in-out infinite alternate;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes pulseBackground {
    0% { opacity: 0.1; transform: translate(-50%, -50%) scale(0.8) translateZ(0); }
    100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.1) translateZ(0); }
}

.logo-container .brand-logo {
    max-width: 400px;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    animation: textNeonPulse 2.5s ease-in-out infinite alternate;
    will-change: filter;
}

@keyframes textNeonPulse {
    0% { filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3)); }
    100% { filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.7)); }
}

/* System Loading Status */
.status-wrapper {
    background: rgba(255, 255, 255, 0.03);
    padding: 25px 35px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: translateZ(20px); /* 3D layer positioning */
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    direction: ltr;
}

.status-percentage {
    color: var(--accent);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
    animation: pulsePercentage 2s infinite alternate;
}

@keyframes pulsePercentage {
    0% { opacity: 0.6; }
    100% { opacity: 1; text-shadow: 0 0 15px rgba(255,255,255,0.9); }
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    direction: ltr;
    transform: translateZ(0); 
}

.progress-bar {
    width: 99%;
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    position: relative;
}

.progress-bar::after {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(
        -45deg, 
        rgba(0,0,0,0.2) 25%, 
        transparent 25%, 
        transparent 50%, 
        rgba(0,0,0,0.2) 50%, 
        rgba(0,0,0,0.2) 75%, 
        transparent 75%, 
        transparent
    );
    background-size: 15px 15px;
    animation: moveStripes 0.8s linear infinite;
    will-change: background-position;
}

@keyframes moveStripes {
    0% { background-position: 0 0; }
    100% { background-position: 15px 0; }
}

.status-logs {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: right;
    direction: rtl;
    display: flex;
    align-items: center;
    gap: 5px;
}

#log-text {
    color: var(--accent);
    transition: opacity 0.3s ease;
    will-change: opacity;
}

.log-cursor {
    animation: blink 1s infinite;
    font-family: 'Share Tech Mono', monospace;
}

/* Form */
.form-container {
    text-align: center;
    width: 100%;
    max-width: 500px;
    transform: translateZ(30px); /* 3D layer positioning */
}

.form-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.form-description strong {
    color: var(--accent);
    text-shadow: 0 0 8px rgba(255,255,255,0.4);
}

.input-group {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s, border-color 0.3s;
}

.input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}

#phone {
    flex: 1;
    padding: 18px 20px;
    background: transparent;
    border: none;
    color: white;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    outline: none;
    text-align: right;
    direction: ltr;
}

#phone::placeholder {
    color: #666;
    direction: rtl;
    text-align: right;
}

.submit-btn {
    padding: 0 30px;
    background: var(--accent);
    color: var(--bg-color);
    border: none;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    will-change: transform;
}

.submit-btn:hover {
    background: #e0e0e0;
}

.submit-btn:active {
    transform: scale(0.96) translateZ(0);
}

/* Modal / Popup Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    padding: 40px 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    transform: scale(0.8) translateY(20px) translateZ(0);
    transition: transform 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
    direction: rtl;
    will-change: transform;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0) translateZ(0);
}

.modal-title {
    color: var(--accent);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.6rem;
    margin-bottom: 15px;
    text-shadow: 0 0 15px rgba(255,255,255,0.4);
}

.modal-text {
    color: var(--text-secondary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

.modal-btn {
    padding: 12px 35px;
    background: var(--accent);
    color: var(--bg-color);
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.modal-btn:hover {
    background: #e0e0e0;
    box-shadow: 0 0 20px rgba(255,255,255,0.3);
}

.modal-btn:active {
    transform: scale(0.98) translateZ(0);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .typewriter-wrapper { font-size: 1.6rem; }
    #cursor { height: 1.6rem; }
    .content-wrapper { gap: 2.5rem; }
    .logo-container .brand-logo { max-width: 260px; }
    
    .status-wrapper {
        padding: 20px 20px;
    }
    .status-header {
        font-size: 1rem;
    }
    .status-logs {
        font-size: 0.85rem;
    }
    
    .input-group {
        flex-direction: column;
        background: transparent;
        border: none;
        gap: 12px;
    }

    #phone {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        text-align: center;
        padding: 15px;
    }
    
    #phone::placeholder { text-align: center; }
    
    .submit-btn {
        padding: 15px;
        border-radius: 10px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
}
