:root {
    --primary-burgundy: #800020;
    --primary-burgundy-gradient: linear-gradient(135deg, #4a0012 0%, #800020 50%, #2b000a 100%);
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --input-bg: #f1f5f9;
    --focus-shadow: 0 4px 12px rgba(128, 0, 32, 0.1);
    --error-red: #df2222;
    --success-green: #10b981;
    --card-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.3px;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: #fafbfc;
    background-image: 
        radial-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px), 
        linear-gradient(to right, rgba(148, 163, 184, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
    background-size: 20px 20px, 40px 40px, 40px 40px;
    background-position: 0 0, 0 0, 0 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

.bg-wave {
    position: absolute;
    left: 0;
    width: 100%;
    z-index: 0;
    pointer-events: none;
}

.bg-wave-top {
    top: 0;
    height: 11vh; 
    min-height: 82px; 
}

.bg-wave-bottom {
    bottom: env(safe-area-inset-bottom, 0px);
    height: 7vh;
    min-height: 48px;
    z-index: 2;
}

.header-top-area {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.back-btn {
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.2s ease;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.app-view {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: calc(90px + env(safe-area-inset-top)) 20px calc(45px + env(safe-area-inset-bottom)) 20px;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    max-width: 680px;
    margin: 0 auto;
}

.app-content-wrapper {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    margin: 12px auto auto auto; 
}

.header-content {
    text-align: center;
    margin-bottom: 2.5vh;
}

.header-content h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.header-content p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2.5vh;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
}

.step-dot-active {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-burgundy);
    border: 2.5px solid #ffccd5;
    transition: all 0.3s ease;
}

.step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #d1d5db;
    transition: all 0.3s ease;
}

.registration-form, .verification-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.verification-view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

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

.input-group {
    position: relative;
    width: 100%;
}

.input-box {
    width: 100%;
    height: 48px;
    background-color: var(--input-bg);
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 0 42px 0 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    outline: none;
    transition: all 0.2s ease;
}

.input-box:focus {
    border-color: var(--primary-burgundy);
    background-color: #ffffff;
    box-shadow: var(--focus-shadow);
}

.field-label {
    position: absolute;
    top: -7px;
    left: 12px;
    background-color: #fafbfc; 
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dark);
    z-index: 2;
    cursor: pointer;
}

.label-highlight {
    color: var(--primary-burgundy);
    font-weight: 700;
}

.phone-input-wrapper {
    display: flex;
    align-items: center;
}

.country-trigger {
    position: absolute;
    left: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    height: 100%;
    padding-right: 8px;
    border-right: 1.5px solid #e2e8f0;
}

.trigger-flag {
    font-size: 16px;
    line-height: 1;
}

.trigger-code {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.trigger-arrow {
    font-size: 8px;
    color: var(--text-muted);
    margin-top: 1px;
}

.input-box.phone-indent {
    padding-left: 98px;
}

/* --- FIXED WRAPPER AND EYE BUTTON --- */
.input-icon-right {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; /* Elevates wrapper above the input box */
}

.pin-toggle-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 6px; /* Increases clickable tap target for mobile */
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: color 0.2s ease;
    pointer-events: auto !important; /* Force clickability */
}

.pin-toggle-btn:hover {
    color: var(--primary-burgundy);
}

.pin-toggle-btn svg,
.pin-toggle-btn svg * {
    pointer-events: none; /* Prevents clicks targeting inner paths instead of the button */
}

/* OTP Architecture matching style guide dimensions */
.otp-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 15px 0;
}

.otp-input {
    width: 48px;
    height: 52px;
    background-color: var(--input-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    outline: none;
    transition: all 0.2s ease;
}

.otp-input:focus {
    border-color: var(--primary-burgundy);
    background-color: #ffffff;
    box-shadow: var(--focus-shadow);
}

.resend-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
    font-weight: 500;
}

.resend-link {
    color: var(--primary-burgundy);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.resend-link.disabled {
    color: #94a3b8;
    cursor: not-allowed;
    font-weight: 500;
}

/* Modal Matching Layout Structure */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-card {
    width: 90%;
    max-width: 340px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 70vh;
}

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

.modal-search-wrapper { padding: 12px; border-bottom: 1px solid #f3f4f6; }
.modal-search { width: 100%; height: 40px; background: #f3f4f6; border: 1.5px solid transparent; border-radius: 10px; padding: 0 12px; font-size: 14px; font-weight: 600; outline: none; }
.modal-search:focus { border-color: var(--primary-burgundy); background: #ffffff; }
.country-list-scroll { overflow-y: auto; flex: 1; padding: 6px 0; }
.country-item { display: flex; align-items: center; padding: 10px 18px; cursor: pointer; transition: background 0.15s ease; gap: 12px; }
.country-item:active { background: #f9fafb; }
.item-flag { font-size: 18px; }
.item-name { font-size: 14px; font-weight: 600; color: var(--text-dark); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-code { font-size: 13px; font-weight: 700; color: var(--text-muted); }

.form-action-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
}

.btn-submit {
    width: 100%;
    height: 48px;
    background: var(--primary-burgundy-gradient);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 30px; 
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(128, 0, 32, 0.2);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-submit:active {
    transform: scale(0.98);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-redirect-footer {
    font-size: 13px;
    color: var(--text-dark);
    font-weight: 500;
    text-decoration: none;
    margin-top: 2px;
}

.login-redirect-footer span {
    text-decoration: underline;
    color: var(--primary-burgundy);
    font-weight: 700;
}

.toast-container {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    z-index: 3999; 
    display: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    text-align: center;
    width: 85%;
    max-width: 340px;
}
