/* KnexPay Screen Layouts — Futuristic Neon Transparent */

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #000;
    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: space-between;
    width: 100%;
    height: 100%;
    padding: 0 var(--spacing-lg);
    padding-top: calc(20vh);
    padding-bottom: calc(var(--spacing-xl) + var(--safe-bottom));
}

.loading-logo-container {
    width: 120px;
    height: 120px;
    margin-bottom: var(--spacing-lg);
    filter: drop-shadow(0 0 24px rgba(57,255,20,0.6));
    position: relative;
}

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

/* Glitch layers — horizontal slice displacement */
.glitch-layer {
    animation: glitch-flicker 3s steps(1) infinite;
}

.glitch-top {
    animation: glitch-slice-top 3s steps(1) infinite;
}

.glitch-bottom {
    animation: glitch-slice-bottom 3s steps(1) infinite;
}

/* Title — Orbitron font */
.loading-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.22em;
    text-shadow: 0 0 20px rgba(255,255,255,0.3), 0 0 40px rgba(255,255,255,0.1);
    margin-bottom: auto;
}

/* Bottom section wrapper */
.loading-bottom {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Progress bar */
.loading-progress-wrap {
    width: 60%;
    max-width: 240px;
    height: 3px;
    background: rgba(57,255,20,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(57,255,20,0.6), var(--neon));
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(57,255,20,0.5);
    animation: progress-fill 2.8s ease-out forwards;
}

/* Tagline */
.loading-tagline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(57,255,20,0.35);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

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

.app-container {
    position: relative;
    display: flex;
    flex-direction: column;
    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(57,255,20, 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;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    min-height: 0;
    padding-top: calc(var(--safe-top) + 8px);
    overscroll-behavior: none;
}

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

.screen {
    display: none;
    flex-direction: column;
    padding: var(--spacing-md);
    padding-bottom: calc(80px + var(--safe-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Send screen — no scrolling, fixed layout.
   68px = tab-nav total height sans safe-area (8px pad-top + ~44px content + 16px pad-bottom).
   --safe-bottom covers the home indicator on notch iPhones.
   --spacing-md = gap between glass bottom and tab bar top (matches the side gaps). */
#sendScreen {
    padding-bottom: calc(68px + var(--safe-bottom, 0px) + 15px);
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    touch-action: none;
    /* Fill available height so flex children can grow */
    flex: 1;
    min-height: 0;
}

.screen.active {
    display: flex;
}

#walletActions,
#setupState {
    margin-top: auto;
}

.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(var(--blur-med));
    -webkit-backdrop-filter: blur(var(--blur-med));
}

.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-icon-mask {
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

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

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

.tab-item.active .icon {
    filter: drop-shadow(0 0 6px rgba(57,255,20,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(57,255,20,0.5);
}

/* ========================================
   AUTH MODAL — Hide app content behind auth
   ======================================== */

/* Hide app content behind auth modals — only Three.js shows */
.pattern-modal:not(.hidden) ~ .app-container,
.pattern-modal:not(.hidden) ~ .tab-nav {
    visibility: hidden;
}

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

.biometric-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(57,255,20, 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(57,255,20, 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; }

/* ========================================
   PATTERN LOCK MODAL — Neon Transparent
   ======================================== */

.pattern-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: transparent;
    z-index: var(--z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--spacing-lg);
}

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

.pattern-container {
    border-radius: var(--radius-xl);
    border: 1px solid var(--stroke-light);
    background: var(--glass);
    backdrop-filter: blur(var(--blur-strong));
    -webkit-backdrop-filter: blur(var(--blur-strong));
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-lg) var(--spacing-sm);
    max-width: 400px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

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

#patternCanvas {
    display: block;
    margin: 0 auto;
    touch-action: none;
    max-width: 100%;
    max-height: 360px;
}

.pattern-hint-btn {
    margin-top: var(--spacing-sm);
    background: rgba(127,255,0,0.1);
    border: 1px solid rgba(127,255,0,0.3);
    color: rgba(127,255,0,0.8);
    font-family: var(--font);
    font-size: 13px;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}

.pattern-hint-btn:active {
    background: rgba(127,255,0,0.25);
    border-color: rgba(127,255,0,0.6);
    color: #7fff00;
}

.pattern-pin-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: var(--spacing-sm);
}
.pattern-pin-controls.hidden { display: none; }
.pattern-pin-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-user-select: none;
    user-select: none;
}
.pattern-pin-btn:active {
    background: rgba(255,255,255,0.2);
    transform: scale(0.92);
}
.pattern-pin-btn.submit {
    border-color: rgba(127,255,0,0.4);
    background: rgba(127,255,0,0.15);
    color: #7fff00;
}
.pattern-pin-btn.submit:active {
    background: rgba(127,255,0,0.35);
}

/* Shake animation for wrong pattern */
@keyframes pattern-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}

#patternCanvas.shake {
    animation: pattern-shake 0.5s ease-in-out;
}

/* ========================================
   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; }

}

/* 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; }

}

/* 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; }

}

