/* ═══════════════════════════════════════════════════════════
   Addi Web Platform - Styles
   Based on Addi's design system
   ═══════════════════════════════════════════════════════════ */

:root {
    --addi-blue: #3366FF;
    --addi-blue-dark: #2952CC;
    --addi-blue-light: #EBF0FF;
    --addi-navy: #1A1F36;
    --addi-orange: #FF6633;
    --text-primary: #1A1F36;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F8FA;
    --bg-card: #F0F2F5;
    --border-color: #E5E7EB;
    --border-focus: #3366FF;
    --error-color: #E53E3E;
    --success-color: #38A169;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

/* ─── Screen Management ─────────────────────────────────── */

.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    animation: fadeIn 0.35s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

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

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

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

/* ─── INDEX / HERO SCREEN ────────────────────────────────── */

.index-hero {
    background: linear-gradient(180deg, #3366FF 0%, #2952CC 60%, #1A3FAA 100%);
    position: relative;
    overflow: hidden;
    padding-bottom: 0;
    flex: 1;
}

.index-header {
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

.addi-logo {
    width: 70px;
    height: 32px;
}

.hero-image-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    margin-top: 10px;
}

.hero-image {
    width: 280px;
    height: 280px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.2);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: floatImage 6s ease-in-out infinite;
}

@keyframes floatImage {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero-text {
    padding: 24px 28px 32px;
    position: relative;
    z-index: 2;
}

.hero-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.hero-title {
    color: #FFFFFF;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.hero-desc {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.index-actions {
    background: var(--bg-primary);
    padding: 24px 24px 40px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin-top: -16px;
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.08);
}

/* ─── BUTTONS ────────────────────────────────────────────── */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn:active::after {
    opacity: 1;
}

.btn-primary {
    background: var(--addi-blue);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(51, 102, 255, 0.35);
}

.btn-primary:hover:not(:disabled) {
    background: var(--addi-blue-dark);
    box-shadow: 0 6px 20px rgba(51, 102, 255, 0.45);
    transform: translateY(-1px);
}

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

.btn-primary:disabled {
    background: #D1D5DB;
    color: #9CA3AF;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-tertiary {
    background: transparent;
    color: var(--text-secondary);
}

.btn-tertiary:disabled {
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-full {
    width: 100%;
}

/* ─── FORM SCREENS ───────────────────────────────────────── */

.form-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-primary);
}

.form-header {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

.otp-header {
    justify-content: space-between;
}

.btn-close, .btn-back {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--addi-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.btn-close:hover, .btn-back:hover {
    background: var(--bg-secondary);
}

.form-content {
    flex: 1;
    padding: 8px 28px;
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.form-title.centered {
    text-align: center;
}

.form-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 32px;
}

.form-subtitle.centered {
    text-align: center;
}

.form-footer {
    padding: 20px 28px 36px;
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
}

/* ─── INPUT FIELDS ───────────────────────────────────────── */

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.input-row {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg-primary);
}

.input-row:focus-within {
    border-color: var(--addi-blue);
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.12);
}

.input-prefix {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-right: 1.5px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
}

.input-field {
    flex: 1;
    padding: 14px 16px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

.input-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-left: 2px;
}

/* Password input */
.input-password-wrapper {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg-secondary);
}

.input-password-wrapper:focus-within {
    border-color: var(--addi-blue);
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.12);
    background: var(--bg-primary);
}

.input-password {
    flex: 1;
    padding: 16px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
}

.input-password::placeholder {
    color: var(--text-tertiary);
}

.btn-toggle-password {
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.link-forgot {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--addi-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Info banner */
.info-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.info-banner span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ─── LOADING SCREEN ─────────────────────────────────────── */

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.loading-container {
    text-align: center;
    padding: 40px;
}

.loading-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.loading-logo.spin {
    animation: spinPulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spinPulse {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.05); }
    100% { transform: rotate(360deg) scale(1); }
}

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ─── WELCOME SCREEN ─────────────────────────────────────── */

.welcome-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    text-align: center;
}

.welcome-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--addi-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: slideInUp 0.5s ease;
}

.welcome-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.welcome-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.welcome-doc {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-radius: 20px;
}

.policies-text {
    margin-top: 16px;
    text-align: center;
}

.policies-text p {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.policies-text a {
    color: var(--addi-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ─── FOOTER ─────────────────────────────────────────────── */

.app-footer {
    padding: 16px 28px 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-content p {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

/* ─── OTP SCREEN ─────────────────────────────────────────── */

.otp-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 32px 0 20px;
}

.otp-box {
    width: 48px;
    height: 56px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
    background: var(--bg-primary);
    -webkit-tap-highlight-color: transparent;
}

.otp-box:focus {
    border-color: var(--addi-blue);
    box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.15);
    background: var(--addi-blue-light);
}

.otp-box.filled {
    border-color: var(--addi-blue);
    background: var(--addi-blue-light);
}

.otp-timer {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* ─── MAINTENANCE SCREEN ─────────────────────────────────── */

.maintenance-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #F7F8FA 0%, #EBF0FF 100%);
}

.maintenance-container {
    text-align: center;
    padding: 40px 32px;
}

.maintenance-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.maintenance-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
}

.maintenance-progress {
    width: 200px;
    height: 4px;
    background: var(--border-color);
    border-radius: 4px;
    margin: 0 auto;
    overflow: hidden;
}

.maintenance-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--addi-blue), var(--addi-blue-dark));
    border-radius: 4px;
    animation: progressFill 4s ease-in-out forwards;
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ─── MODALS ─────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: fadeIn 0.25s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.35s ease;
}

.modal-icon {
    margin-bottom: 16px;
}

.modal-icon.error svg {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */

@media (max-width: 380px) {
    .hero-title {
        font-size: 22px;
    }
    .hero-image {
        width: 220px;
        height: 220px;
    }
    .otp-box {
        width: 42px;
        height: 50px;
        font-size: 18px;
    }
    .otp-inputs {
        gap: 6px;
    }
}

@media (min-width: 481px) {
    body {
        box-shadow: 0 0 40px rgba(0,0,0,0.08);
    }
}

/* ─── UTILITY ────────────────────────────────────────────── */

.hidden {
    display: none !important;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: var(--addi-blue);
    color: #FFFFFF;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 0px;
}
