/* KnexPay Screen Layouts — Futuristic Neon Transparent */

/* ========================================
   LOADING OVERLAY
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    z-index: var(--z-toast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(-20px);
}

.loading-logo-container {
    width: 72px;
    height: 72px;
    margin-bottom: var(--spacing-lg);
    filter: drop-shadow(var(--knex-glow));
    animation: pulse-logo 2s ease-in-out infinite;
}

.loading-logo-svg {
    width: 100%;
    height: 100%;
}

.loading-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.18em;
    margin-bottom: var(--spacing-lg);
    text-shadow: var(--glow-neon);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,140,0,0.12);
    border-top-color: var(--neon);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: var(--glow-neon);
}

/* ========================================
   APP CONTAINER
   ======================================== */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    z-index: 3;
}

/* ========================================
   iOS-STYLE HEADER — Neon Transparent
   ======================================== */

.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    min-height: var(--header-height);
    padding: var(--safe-top) var(--spacing-md) 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    border-bottom: 1px solid var(--stroke-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: var(--z-dropdown);
}

.header h1 {
    display: none;
}

.network-status {
    position: relative;
    top: auto;
    transform: none;
    right: auto;
    padding: 5px 12px;
    background: rgba(255,140,0, 0.04);
    border: 1px solid var(--stroke-subtle);
    border-radius: var(--radius-pill);
    font-size: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    backdrop-filter: blur(var(--blur-soft));
    -webkit-backdrop-filter: blur(var(--blur-soft));
}

.network-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(52,199,89,0.6);
    animation: pulse-dot 2s ease-in-out infinite;
}

.network-status.offline::before {
    background: var(--red);
    box-shadow: var(--glow-red);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    min-height: 0;
}

/* ========================================
   SCREENS
   ======================================== */

.screen {
    display: none;
    padding: var(--spacing-md);
    padding-bottom: 80px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.screen.active {
    display: block;
}

.screen-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-sm);
}

/* ========================================
   iOS-STYLE TAB NAVIGATION — Neon Transparent
   ======================================== */

.tab-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    border-top: 1px solid var(--stroke-light);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 8px 0 16px;
    z-index: var(--z-dropdown);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
    position: relative;
}

.tab-item .icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: all var(--transition-fast);
}

.tab-item:hover {
    color: var(--text-secondary);
}

.tab-item.active {
    color: var(--neon);
}

.tab-item.active .icon {
    filter: drop-shadow(0 0 6px rgba(255,140,0,0.5));
}

/* Active tab neon glow underline */
.tab-item.active::after {
    content: '';
    position: absolute;
    top: -7px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--neon);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255,140,0,0.5);
}

/* ========================================
   PIN MODAL — Neon Transparent
   ======================================== */

.pin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0,0,0,0.80);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    z-index: var(--z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--spacing-lg);
}

.pin-modal.hidden {
    display: none;
}

.pin-container {
    border-radius: var(--radius-xl);
    border: 1px solid var(--stroke-light);
    background: rgba(255,140,0, 0.04);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xl) var(--spacing-lg);
    max-width: 360px;
    width: 100%;
    text-align: center;
}

.pin-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
    letter-spacing: 0.05em;
}

.pin-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border: 2px solid var(--stroke);
    border-radius: 50%;
    background: transparent;
    transition: all var(--transition-fast);
}

.pin-dot.filled {
    background: var(--neon);
    border-color: var(--neon);
    box-shadow: var(--glow-neon);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    max-width: 240px;
    margin: 0 auto;
}

.pin-key {
    width: 62px;
    height: 62px;
    border: 1px solid var(--stroke-subtle);
    background: rgba(255,140,0, 0.03);
    backdrop-filter: blur(var(--blur-soft));
    -webkit-backdrop-filter: blur(var(--blur-soft));
    color: var(--text);
    font-size: 24px;
    font-weight: 400;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-family: var(--font);
    margin: 0 auto;
}

.pin-key:hover {
    background: rgba(255,140,0, 0.06);
    border-color: var(--stroke-light);
}

.pin-key:active,
.pin-key.pressed {
    background: rgba(255,140,0, 0.12);
    border-color: var(--stroke);
    box-shadow: var(--glow-neon);
    transform: scale(0.92);
}

.pin-key:empty {
    visibility: hidden;
}

.pin-key.backspace {
    background: rgba(255,51,51, 0.06);
    border-color: rgba(255,51,51, 0.25);
    color: var(--red);
}

.pin-key.backspace:hover {
    background: rgba(255,51,51, 0.12);
}

.pin-key .icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ========================================
   BIOMETRIC BUTTON — Neon
   ======================================== */

.biometric-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255,140,0, 0.04);
    border: 1px solid var(--stroke-light);
    border-radius: var(--radius-lg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-md);
    backdrop-filter: blur(var(--blur-med));
    -webkit-backdrop-filter: blur(var(--blur-med));
}

.biometric-btn:hover {
    background: rgba(255,140,0, 0.08);
    border-color: var(--stroke);
}

.biometric-btn:active {
    transform: scale(0.98);
    box-shadow: var(--glow-neon);
}

.face-id-wrapper {
    width: 40px;
    height: 40px;
    position: relative;
}

.face-id-wrapper svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.face-id-wrapper .circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0;
}

.face-id-wrapper.scanning .circle {
    animation: pulse-biometric 1s ease-in-out infinite;
}

.face-id-wrapper .circle.yellow { background: var(--yellow); animation-delay: 0s; }
.face-id-wrapper .circle.blue { background: var(--cyan); animation-delay: 0.33s; }
.face-id-wrapper .circle.red { background: var(--red); animation-delay: 0.66s; }

/* ========================================
   DEVICE-SPECIFIC RESPONSIVE ADJUSTMENTS
   ======================================== */

/* iPhone SE / small screens (375×667) — no notch */
@media screen and (max-width: 375px) and (max-height: 700px) {
    .screen-title { font-size: 18px; }
    .balance-amount { font-size: 1.8rem; }
    .balance-logo { width: 36px; height: 36px; }
    .pin-key { width: 56px; height: 56px; font-size: 22px; }
    .pin-keypad { gap: var(--spacing-xs); }
}

/* Standard iPhones 12-14 (390×844) — notch, 47pt safe-top */
@media screen and (min-width: 380px) and (max-width: 400px) and (min-height: 800px) {
    .balance-amount { font-size: 2.2rem; }
    .pin-key { width: 62px; height: 62px; }
}

/* iPhone 14 Pro - 16 (393×852) — Dynamic Island, 59pt safe-top */
@media screen and (min-width: 390px) and (max-width: 410px) and (min-height: 840px) {
    .balance-amount { font-size: 2.2rem; }
}

/* iPhone Pro Max models (430-440px wide) */
@media screen and (min-width: 420px) and (max-height: 960px) {
    .balance-amount { font-size: 2.4rem; }
    .balance-logo { width: 52px; height: 52px; }
    .screen-title { font-size: 22px; }
}

/* Android standard (360-412px) — typically no safe areas */
@media screen and (min-width: 356px) and (max-width: 416px) and (max-height: 780px) {
    .balance-amount { font-size: 2rem; }
    .pin-key { width: 58px; height: 58px; font-size: 22px; }
}

/* ========================================
   DEVICE BLOCK & INSTALL OVERLAYS
   ======================================== */

.device-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 30px;
    text-align: center;
}

.device-overlay.hidden {
    display: none;
}

.device-icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-lg);
    opacity: 0.8;
}

.device-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--neon);
    filter: drop-shadow(0 0 20px rgba(255,140,0,0.5));
}

.device-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon);
    text-shadow: var(--glow-neon);
    margin-bottom: var(--spacing-md);
    letter-spacing: 0.12em;
}

.device-message {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.6;
    margin-bottom: var(--spacing-xl);
}

.device-message strong {
    color: var(--text);
}

.device-qr-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.device-qr-box {
    background: white;
    padding: 12px;
    border-radius: var(--radius-lg);
}

/* Install Instructions Overlay */
.install-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 24px;
    text-align: center;
    overflow-y: auto;
}

.install-overlay.hidden {
    display: none;
}

.install-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--neon);
    text-shadow: var(--glow-neon);
    letter-spacing: 0.12em;
    margin-bottom: var(--spacing-xs);
}

.install-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xl);
}

.install-card {
    background: var(--glass);
    border: 1px solid var(--stroke-light);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg) var(--spacing-md);
    width: 100%;
    max-width: 320px;
    margin-bottom: var(--spacing-md);
    backdrop-filter: blur(var(--blur-med));
    -webkit-backdrop-filter: blur(var(--blur-med));
}

.install-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text);
}

.install-step {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: var(--spacing-md);
    text-align: left;
}

.install-step:last-child {
    margin-bottom: 0;
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--neon);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(255,140,0,0.3);
}

.step-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}

.step-content strong {
    color: var(--text);
}

.step-content svg {
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    flex-shrink: 0;
}

.install-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.5;
}

.install-note svg {
    width: 14px;
    height: 14px;
    fill: var(--yellow);
    vertical-align: middle;
    margin-right: 4px;
}

.ios-instructions,
.android-instructions {
    display: none;
}

.ios-instructions.active,
.android-instructions.active {
    display: block;
}
