/* ==========================================================================
   Mopro Login Page - Modern Design
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Color Palette - Modern Indigo/Purple */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;

    --accent: #06b6d4;
    --accent-dark: #0891b2;

    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    --text: #1e293b;
    --text-light: #64748b;
    --text-lighter: #94a3b8;

    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(99, 102, 241, 0.08);
    --shadow-lg: 0 20px 50px rgba(99, 102, 241, 0.15);
    --shadow-xl: 0 30px 80px rgba(99, 102, 241, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 50%, #fdf4ff 100%);
    color: var(--text);
    overflow-x: hidden;
    position: relative;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Background Shapes (decorative)
   ========================================================================== */
.bg-shapes {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #818cf8 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #67e8f9 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    animation-delay: -7s;
}

.shape-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #f0abfc 0%, transparent 70%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ==========================================================================
   Page Layout
   ========================================================================== */
.page-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 800;
    transition: var(--transition);
}

.brand:hover { transform: translateY(-2px); }

.brand img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

/* ==========================================================================
   Card Container
   ========================================================================== */
.card-container {
    width: 100%;
    position: relative;
}

.form-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: none;
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-card.active { display: block; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    text-align: center;
    margin-bottom: 28px;
}

.card-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.card-header p {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ==========================================================================
   Input Fields
   ========================================================================== */
.input-group {
    position: relative;
    margin-bottom: 18px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.input-group select {
    padding-left: 16px;
    padding-right: 16px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 18px;
    cursor: pointer;
}

.input-group label {
    position: absolute;
    top: 14px;
    right: 44px;
    color: var(--text-lighter);
    font-size: 0.95rem;
    pointer-events: none;
    transition: var(--transition);
    background: var(--card-bg);
    padding: 0 6px;
}

.select-group label {
    right: 16px;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group input:valid + label,
.input-group select:focus + label,
.input-group select:valid + label {
    top: -10px;
    right: 16px;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.select-group input:focus + label,
.select-group input:not(:placeholder-shown) + label,
.select-group select:focus + label,
.select-group select:valid + label {
    right: 16px;
}

.input-group input:read-only {
    background: var(--border-light);
    color: var(--text-light);
    cursor: not-allowed;
}

.icon-phone {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    opacity: 0.6;
}

/* Row for two inputs side by side */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    opacity: 0;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover::before { opacity: 1; }

.btn-primary:active { transform: translateY(0); }

.btn-primary > * { position: relative; z-index: 1; }

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

.btn-primary.loading .btn-text { opacity: 0.4; }
.btn-primary.loading .btn-spinner { display: inline-block; }

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

/* ==========================================================================
   OTP Input
   ========================================================================== */
.otp-info {
    text-align: center;
    margin-bottom: 24px;
    padding: 14px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
}

.otp-info-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.otp-info-phone {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1.05rem;
    direction: ltr;
    display: inline-block;
}

.otp-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    direction: ltr;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
    -moz-appearance: textfield;
}

.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.otp-input:focus {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.otp-input.filled {
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

/* ==========================================================================
   Timer & Resend
   ========================================================================== */
.timer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-md);
}

.timer {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: 'Vazirmatn', monospace;
}

.resend-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.resend-link:hover:not(.disabled) {
    color: var(--primary-dark);
    text-decoration: underline;
}

.resend-link.disabled {
    color: var(--text-lighter);
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================================================
   Helper Text & Sign Link
   ========================================================================== */
.helper-text {
    text-align: center;
    color: var(--text-lighter);
    font-size: 0.8rem;
    line-height: 1.7;
    margin-top: 20px;
    padding: 0 8px;
}

.sign-link {
    text-align: center;
    margin-top: 20px;
}

.sign-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.sign-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================================
   File Upload
   ========================================================================== */
.file-upload-wrapper {
    margin-bottom: 20px;
}

.file-upload-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.file-upload-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 22px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.file-upload-box:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.file-upload-box .file-icon {
    font-size: 1.6rem;
}

.file-upload-box .file-text {
    color: var(--text-light);
    font-size: 0.88rem;
}

.file-upload-box .file-name-display {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    word-break: break-all;
    max-width: 100%;
}

.file-upload-box.has-file {
    border-color: var(--success);
    background: #f0fdf4;
}

.file-upload-box.has-file .file-text { display: none; }

/* ==========================================================================
   Messages (success/error)
   ========================================================================== */
.message {
    margin-top: 16px;
    padding: 0 8px;
    text-align: center;
    font-size: 0.88rem;
    min-height: 20px;
    line-height: 1.6;
    transition: var(--transition);
}

.message.success-msg {
    color: var(--success);
}

.message.error-msg,
.message:not(:empty):not(.success-msg) {
    color: var(--error);
}

/* ==========================================================================
   Card Footer (toggle between login/register)
   ========================================================================== */
.card-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-light);
}

.card-footer .switch-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    margin-right: 6px;
    transition: var(--transition);
}

.card-footer .switch-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==========================================================================
   Footer Note
   ========================================================================== */
.footer-note {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-lighter);
    line-height: 1.7;
}

.footer-note a {
    color: var(--primary);
    text-decoration: none;
}

.footer-note a:hover { text-decoration: underline; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.hidden { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 540px) {
    body { padding: 12px; }

    .form-card {
        padding: 28px 22px;
        border-radius: var(--radius-lg);
    }

    .card-header h2 { font-size: 1.4rem; }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .otp-input {
        width: 44px;
        height: 52px;
        font-size: 1.3rem;
    }

    .otp-container { gap: 6px; }

    .brand { font-size: 1.3rem; }
    .brand img { width: 32px; height: 32px; }
}

@media (max-width: 360px) {
    .otp-input {
        width: 38px;
        height: 48px;
        font-size: 1.2rem;
    }

    .otp-container { gap: 4px; }
}

/* ==========================================================================
   Reduced Motion (accessibility)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .shape { animation: none; }
}
