:root {
    --bg-dark: #0f111a;
    --bg-card: rgba(25, 28, 41, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-primary: #7c3aed;
    --accent-secondary: #3b82f6;
    --accent-glow: rgba(124, 58, 237, 0.4);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.15), transparent 40%),
        radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.15), transparent 40%);
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 400px;
    height: 100vh;
    max-height: 800px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.8s ease-out;
}

/* Screens Setup */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 48px 32px;
    display: none;
    flex-direction: column;
    justify-content: space-between;
}

.screen.active {
    display: flex;
}

/* Slide Animations */
.slide-in-right {
    animation: slideInRight 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.slide-out-left {
    animation: slideOutLeft 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.slide-out-right {
    animation: slideOutRight 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 0; display: none; }
    to { transform: translateX(-30%); opacity: 0; display: none; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; display: none; }
}

/* Base Utility Classes */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 0; /* Ensures flex container can shrink and trigger overflow scroll */
}

.mobile-content {
    align-items: flex-start;
    text-align: left;
    margin-top: 40px;
    justify-content: flex-start;
}

.screen-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 32px;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Scrollable forms wrapper */
.scrollable-content {
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px; 
}
.scrollable-content::-webkit-scrollbar { width: 4px; }
.scrollable-content::-webkit-scrollbar-track { background: transparent; }
.scrollable-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

/* Welcome Screen */
.logo-container {
    position: relative;
    margin-bottom: 40px;
    animation: slideDown 0.8s ease-out 0.2s both;
}

.logo {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    object-fit: cover;
    position: relative;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo:hover {
    transform: scale(1.1) rotate(2deg);
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
    z-index: 1;
    border-radius: 50%;
    animation: pulseGlow 4s infinite alternate;
}

.welcome-text {
    font-size: 28px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.5px;
    color: var(--text-secondary);
    animation: slideDown 0.8s ease-out 0.3s both;
}

.brand-name {
    font-size: 36px;
    background: linear-gradient(135deg, var(--accent-secondary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    display: block;
    margin-top: 8px;
}

/* Top Bar and Titles */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin-left: -12px;
}

.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(-2px);
}

.step-indicator {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Inputs Common */
.input-group { width: 100%; display: flex; flex-direction: column; }

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px 20px;
    height: 64px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

.input-wrapper.error-border {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.country-code { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.divider { width: 2px; height: 24px; background: rgba(255, 255, 255, 0.1); margin: 0 16px; }

.phone-input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text-primary); font-size: 20px; font-weight: 600;
    font-family: inherit; width: 100%; letter-spacing: 1px;
}
.phone-input::placeholder { color: rgba(255, 255, 255, 0.2); letter-spacing: 2px; }

/* OTP Specific */
.otp-inputs { display: flex; justify-content: space-between; gap: 8px; }
.otp-box {
    width: 100%; max-width: 48px; height: 60px; border-radius: 12px;
    background: rgba(255, 255, 255, 0.03); border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary); font-size: 24px; font-weight: 700; text-align: center;
    transition: all 0.3s ease; outline: none; font-family: inherit; padding: 0;
}
.otp-box:focus {
    border-color: var(--accent-primary); background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}
.otp-box.error-border {
    border-color: #ef4444; background: rgba(239, 68, 68, 0.05);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

/* Forms Common */
.form-container {
    width: 100%; display: flex; flex-direction: column; gap: 16px; padding-bottom: 16px;
}
.input-group-vertical { display: flex; flex-direction: column; width: 100%; }
.input-row { display: flex; gap: 12px; width: 100%; }
.input-label { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; margin-left: 4px; font-weight: 500; }
.optional-tag { font-size: 12px; opacity: 0.6; font-weight: 300; }

.standard-input {
    background: rgba(255, 255, 255, 0.03); border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px; padding: 14px 16px; color: var(--text-primary);
    font-size: 16px; font-family: inherit; transition: all 0.3s ease; width: 100%; outline: none;
}
.standard-input:focus {
    border-color: var(--accent-primary); background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}
.standard-input::placeholder { color: rgba(255, 255, 255, 0.2); }
.disabled-input {
    background: rgba(0, 0, 0, 0.3); border-color: transparent;
    color: rgba(255, 255, 255, 0.5); cursor: not-allowed;
}

/* Chips */
.chip-group { display: flex; gap: 12px; flex-wrap: wrap; }
.chip {
    padding: 10px 20px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.03); color: var(--text-secondary);
    cursor: pointer; font-size: 14px; font-weight: 500; font-family: inherit;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.chip:hover { border-color: rgba(255,255,255,0.4); }
.chip.active {
    background: rgba(124, 58, 237, 0.2); border-color: var(--accent-primary);
    color: var(--text-primary); box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

/* Role Selection Cards */
.role-cards-container { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.role-radio { display: none; }
.role-card { display: block; cursor: pointer; width: 100%; transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); }
.role-card:active { transform: scale(0.98); }
.role-card-content {
    display: flex; align-items: center; background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
    padding: 18px 20px; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.role-icon { font-size: 32px; margin-right: 20px; line-height: 1; }
.role-text { flex: 1; }
.role-text h3 { font-size: 17px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.role-text p { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin: 0; }
.role-check {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex; align-items: center; justify-content: center; color: transparent; transition: all 0.3s ease;
}
.role-radio:checked + .role-card-content {
    background: rgba(124, 58, 237, 0.15); border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 8px 24px rgba(124, 58, 237, 0.2);
    transform: scale(1.02);
}
.role-radio:checked + .role-card-content .role-check {
    background: var(--accent-primary); border-color: var(--accent-primary); color: white;
}

/* Auto-fill Location */
.location-group {
    background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-top: 4px;
}
.location-header { display: flex; justify-content: space-between; align-items: center; }
.location-header .input-label { margin-bottom: 0; }
.text-button {
    background: transparent; border: none; color: var(--accent-secondary); font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; padding: 6px 12px; border-radius: 8px;
    transition: all 0.2s ease; background: rgba(59, 130, 246, 0.05);
}
.text-button:hover { background: rgba(59, 130, 246, 0.15); }

/* Buttons & Footer */
.footer { text-align: center; width: 100%; }
.primary-button.large-cta {
    width: 100%; padding: 20px; border-radius: 20px; border: none;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white; font-size: 18px; font-weight: 700; font-family: inherit; cursor: pointer;
    box-shadow: 0 12px 32px rgba(124, 58, 237, 0.4); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-bottom: 28px; position: relative; overflow: hidden; letter-spacing: 0.5px;
}
.primary-button.large-cta::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-20deg); transition: all 0.6s ease;
}
.primary-button.large-cta:hover:not(.loading) { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(124, 58, 237, 0.5); }
.primary-button.large-cta:hover:not(.loading)::after { left: 150%; }
.primary-button.large-cta:active:not(.loading) { transform: translateY(2px); box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4); }

.primary-button.loading {
    color: transparent !important;
    pointer-events: none;
}
.primary-button .spinner {
    width: 24px; height: 24px; border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%; border-top-color: white; animation: spin 0.8s linear infinite;
    position: absolute; top: calc(50% - 12px); left: calc(50% - 12px); display: none;
}
.primary-button.loading .spinner {
    display: block;
}

.secondary-text { color: var(--text-secondary); font-size: 15px; font-weight: 400; }
.login-link {
    color: var(--text-primary); text-decoration: none; font-weight: 700; margin-left: 6px;
    position: relative; transition: color 0.3s ease;
}
.login-link::after {
    content: ''; position: absolute; width: 100%; height: 2px; bottom: -4px; left: 0;
    background-color: var(--accent-secondary); transform: scaleX(0); transform-origin: right;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.login-link:hover { color: var(--accent-secondary); }
.login-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* Errors & Utilities */
.error-text {
    color: #ef4444; font-size: 14px; font-weight: 500; margin-top: 12px; margin-left: 4px;
    display: flex; align-items: center; opacity: 0; visibility: hidden; transform: translateY(-5px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.error-text.visible { opacity: 1; visibility: visible; transform: translateY(0); }

.timer-container { margin-top: 32px; text-align: center; display: flex; flex-direction: column; align-items: center; min-height: 40px; }
.timer-text { color: var(--text-secondary); font-size: 15px; font-weight: 400; }
#timer-count { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.resend-btn {
    background: transparent; border: none; color: var(--accent-secondary); font-size: 15px; font-weight: 700;
    cursor: pointer; font-family: inherit; padding: 8px 16px; border-radius: 20px; transition: all 0.2s ease;
}
.resend-btn:hover { background: rgba(59, 130, 246, 0.1); }
.hidden { display: none !important; }

/* Keyframes */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseGlow { 0% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.9); } 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.shake { animation: shake 0.4s ease-in-out; }

/* Review & Dashboard Screens */
.review-card {
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px; padding: 24px; width: 100%; text-align: left; margin-bottom: 24px;
}
.review-item { margin-bottom: 16px; display: flex; flex-direction: column; }
.review-item:last-child { margin-bottom: 0; }
.review-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.review-value { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.secondary-button {
    width: 100%; padding: 18px; border-radius: 20px; border: 2px solid rgba(255,255,255,0.1);
    background: transparent; color: var(--text-primary); font-size: 16px; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease; margin-bottom: 16px; font-family: inherit;
}
.secondary-button:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); }

.dashboard-card {
    background: rgba(124, 58, 237, 0.1); border: 1px solid var(--accent-primary);
    border-radius: 20px; padding: 32px; text-align: center; width: 100%;
}
.dashboard-icon { font-size: 48px; margin-bottom: 16px; display: block; }

/* Responsive */
@media (max-width: 480px) {
    .app-container { border-radius: 0; max-height: 100vh; border: none; box-shadow: none; }
    .screen { padding: 32px 20px; }
    .otp-box { width: 40px; height: 48px; font-size: 20px; }
    .screen-title { font-size: 24px; margin-bottom: 24px; }
    .role-icon { font-size: 28px; margin-right: 16px; }
    .role-card-content { padding: 14px 16px; }
    .primary-button.large-cta { padding: 16px; font-size: 16px; }
    .dashboard-icon { font-size: 40px; }
}
