/* Font configuration */
body {
    font-family: 'Cairo', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #F8F9FA;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
}

/* Base Styles & Utility Classes */
* { box-sizing: border-box; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 1rem; }

/* Mobile-First Container */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: #F8F9FA;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3 { margin: 0; font-weight: 700; }
a { text-decoration: none; color: inherit; }

/* Step 2 Header Nav */
.step-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.25rem;
    background-color: #F8F9FA;
}
.login-btn-outline {
    background: transparent;
    border: 1px solid #E84E27;
    color: #E84E27;
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.top-logo { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem;
    flex-direction: row-reverse; /* Ensure logo is on the right of any text if added later */
}
.header-logo-img {
    height: 50px;
    width: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

/* Hero Section (Step 1 Top) */
#hero-section {
    background: linear-gradient(135deg, #FF6B3E 0%, #E84E27 100%);
    color: white;
    padding-bottom: 4rem;
}

.top-header {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
}
.login-btn {
    background: white;
    color: #E84E27;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    cursor: pointer;
}

.hero {
    text-align: center;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.main-hero-logo {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s forwards;
}
.hero-title {
    font-size: 2rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.2s forwards;
}
.hero-subtitle {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.3s forwards;
}
.hero-subtext {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.4s forwards;
}
.apply-now-btn {
    background: white;
    color: #E84E27;
    border: none;
    border-radius: 30px;
    padding: 0.8rem 2.8rem;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.5s forwards, buttonPulse 2.5s ease-in-out infinite 1.1s;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}
.apply-now-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 30px;
    border: 3px solid rgba(255, 255, 255, 0.7);
    animation: ringPulse 2.5s ease-out infinite 1.1s;
    opacity: 0;
    z-index: -1;
}
.apply-now-btn:hover {
    animation-play-state: paused;
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 6px 15px rgba(0,0,0,0.1); }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
}

@keyframes ringPulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Form Section Main */
.form-section {
    padding: 0 1.25rem;
    margin-top: -3rem; /* Overlap hero */
    flex-grow: 1;
    transition: margin-top 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.form-section.no-overlap {
    margin-top: 0.5rem;
}

.form-card {
    background: white;
    border-radius: 20px;
    padding: 2rem 1.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    position: relative;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeUp 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) 0.6s forwards;
}

/* Step UI Elements */
.step-container {
    position: relative;
    width: 100%;
    overflow: hidden; /* Prevent inactive slides from bleeding out */
    min-height: 400px; /* Give it some default height */
}
.step { 
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
                visibility 0.4s linear; 
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%); /* Start hidden on the right by default */
    z-index: 1; /* Inactive layers */
}
.step.active {
    opacity: 1;
    position: relative;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0); /* Slide into view */
    z-index: 2; /* Active layer on top */
}

/* Sliding out logic */
.step.slide-out-left { transform: translateX(-100%); }
.step.slide-out-right { transform: translateX(100%); }

.step-title {
    text-align: center;
    font-size: 1.4rem;
    color: #1a1a1a;
    margin-bottom: 1rem;
}
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.indicator {
    height: 4px;
    border-radius: 2px;
}
.indicator.line { width: 30px; background: #E0E0E0; }
.indicator.dot { width: 30px; background: #E84E27; }

/* Step 2 Progress Header */
.step-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.step-count { color: #E84E27; font-weight: 700; }
.step-number { color: #888; }
.progress-bar {
    height: 4px;
    background: #E0E0E0;
    border-radius: 2px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.progress-fill {
    width: 100%;
    height: 100%;
    background: #E84E27;
}

.step-title-files { text-align: right; font-size: 1.3rem; margin-bottom: 0.5rem; }
.step-subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Inputs & Floating Labels */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
    text-align: right;
}
.input-group label {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #A0A0A0;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease-out;
    pointer-events: none;
    background: transparent;
    padding: 0 4px;
}
.input-group input {
    width: 100%;
    padding: 1.2rem 1rem 0.8rem 1rem;
    border: 1px solid #E0E0E0;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    background-color: #FAFAFA;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus {
    outline: none;
    border-color: #E84E27;
    background-color: #FFF;
    box-shadow: 0 0 0 3px rgba(232, 78, 39, 0.1);
}
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -8px;
    right: 12px;
    font-size: 0.8rem;
    color: #E84E27;
    background: white;
    transform: translateY(0);
}
.input-group input::-webkit-input-placeholder { color: transparent; }
.input-group input:-moz-placeholder { color: transparent; }
.input-group input::-moz-placeholder { color: transparent; }
.input-group input:-ms-input-placeholder { color: transparent; }

.error-msg {
    color: #E84E27;
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: none;
}
.input-group.error input { border-color: #E84E27; }
.input-group.error .error-msg { display: block; }

/* File Uploader Cards */
.upload-container {
    position: relative;
    margin-bottom: 1rem;
    border: 2px dashed #F8D7D0;
    border-radius: 12px;
    background: #FFF;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    cursor: pointer;
}
.upload-container.pulse {
    animation: pulseBorder 1.5s infinite;
}
@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(232, 78, 39, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(232, 78, 39, 0); }
    100% { box-shadow: 0 0 0 0 rgba(232, 78, 39, 0); }
}

.upload-container:hover { 
    border-color: #E84E27; 
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 78, 39, 0.1);
}
.upload-container.success {
    border: 2px solid #10B981; /* Green success border */
    border-style: solid; /* change from dashed to solid */
}
.upload-box {
    padding: 1.5rem;
    text-align: center;
    color: #E84E27;
    position: relative;
    transition: opacity 0.3s;
}
.upload-icon { margin-bottom: 0.5rem; }
.upload-title { color: #333; font-weight: 700; font-size: 1rem; margin-bottom: 0.2rem; }
.upload-desc { color: #888; font-size: 0.8rem; }
.success-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #10B981;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.upload-container.success .success-icon {
    opacity: 1;
    transform: scale(1);
}

/* Uploaded Thumbnails */
.thumbnails-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 1rem 1rem 1rem;
    justify-content: center;
}
.thumbnail-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: fadeUp 0.3s ease;
}
.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumbnail-wrapper .remove-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: rgba(232, 78, 39, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}
.thumbnail-wrapper .remove-btn:hover {
    transform: scale(1.1);
}

/* Buttons */
.primary-btn {
    position: relative;
    width: 100%;
    background: linear-gradient(90deg, #E84E27, #FF6B3E);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(232, 78, 39, 0.3);
}
.primary-btn:hover { 
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(232, 78, 39, 0.4);
}
.primary-btn:active { transform: translateY(0) scale(0.98); }

/* Shimmer Effect */
.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
}
.primary-btn:hover::before {
    animation: shimmer 1s;
}
@keyframes shimmer {
    100% { left: 200%; }
}

.secondary-btn {
    width: 100%;
    background-color: #F1F3F5;
    color: #333;
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    margin-top: 1rem;
}
.secondary-btn:hover { background-color: #E9ECEF; }

/* Safety Note under Step 2 */
.encryption-note {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    color: #888;
    font-size: 0.8rem;
    margin-top: 1.5rem;
}

/* Privacy Section */
.privacy-note {
    text-align: center;
    padding: 2rem 1.5rem;
}
.shield-icon {
    width: 60px;
    height: 60px;
    background: #E8F5E9;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1rem;
}
.privacy-note h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.privacy-note p { color: #666; font-size: 0.9rem; line-height: 1.6; }

/* Footer */
footer {
    background-color: #111827;
    color: white;
    padding: 2rem;
    text-align: center;
}
.footer-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
footer p {
    font-size: 0.8rem;
    color: #9CA3AF;
    margin-bottom: 1rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #D1D5DB;
}

/* Success Step */
#step-success {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.success-card {
    background: linear-gradient(145deg, #ffffff, #f9fafb);
    border: 1px solid #f3f4f6;
    border-radius: 24px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px -15px rgba(232, 78, 39, 0.15);
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.success-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: linear-gradient(90deg, #E84E27, #ff6b3d);
}

.success-anim-container {
    width: 180px;
    height: 180px;
    margin: 0 auto 1rem;
    position: relative;
}

.success-anim-container::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(232,78,39,0.1) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    z-index: -1;
}

.success-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.5rem;
}

.success-desc {
    font-size: 1.05rem;
    color: #6B7280;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.95);
    z-index: 100;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #1a1a1a;
}
.spinner {
    width: 40px; height: 40px;
    border: 4px solid #F1F3F5;
    border-top: 4px solid #E84E27;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Global Interactive Animations */
@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.bounce-in-delay {
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    animation-delay: 1.5s; /* Wait for lottie animation to finish */
    opacity: 0;
    transform: scale(0.5);
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
