/* ═══════════════════════════════════════════
   Picha AI - PWA Styles
   Native app look & feel
   ═══════════════════════════════════════════ */

/* ── Standalone Mode Adjustments ── */
.pwa-standalone body {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior-y: contain;
}
.pwa-standalone input,
.pwa-standalone textarea,
.pwa-standalone [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}
.pwa-standalone .top-bar {
    padding-top: calc(env(safe-area-inset-top, 0px) + .75rem);
}
.pwa-standalone .page-content {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px) + 1.5rem);
}
.pwa-standalone .mobile-nav {
    padding-bottom: env(safe-area-inset-bottom, 8px);
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
}
.pwa-standalone .auth-container {
    padding-top: env(safe-area-inset-top, 0px);
}

/* ── iOS-specific Enhancements ── */
.pwa-ios body {
    -webkit-tap-highlight-color: transparent;
}
.pwa-ios .btn,
.pwa-ios .nav-item,
.pwa-ios .feature-card,
.pwa-ios .ig-post,
.pwa-ios .package-card {
    -webkit-tap-highlight-color: transparent;
}

/* ── Splash Screen ── */
#pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #00205B 0%, #001845 50%, #000a1f 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity .5s ease, visibility .5s ease;
}
#pwa-splash.pwa-splash-hide {
    opacity: 0;
    visibility: hidden;
}
.pwa-splash-img {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    object-fit: cover;
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
    animation: splashPulse 2s ease-in-out infinite;
}
.pwa-splash-brand {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
    margin-bottom: .25rem;
}
.pwa-splash-brand span {
    color: #C5A900;
}
.pwa-splash-tagline {
    font-size: .88rem;
    color: rgba(255,255,255,.55);
    font-weight: 500;
    margin-bottom: 2rem;
}
.pwa-splash-loader {
    width: 120px;
    height: 3px;
    background: rgba(255,255,255,.12);
    border-radius: 4px;
    overflow: hidden;
}
.pwa-splash-loader-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #C5A900, #e6c700);
    border-radius: 4px;
    animation: splashLoader 1.2s ease-in-out infinite;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}
@keyframes splashLoader {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ── Install Banner ── */
#pwa-install-banner {
    position: fixed;
    bottom: calc(var(--mobile-nav-height, 68px) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: calc(100% - 1.5rem);
    max-width: 420px;
    z-index: 1080;
    opacity: 0;
    transition: transform .4s cubic-bezier(.175,.885,.32,1.275), opacity .3s ease;
    pointer-events: none;
}
#pwa-install-banner.pwa-install-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.pwa-install-content {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08);
    border: 1px solid rgba(0,0,0,.06);
}
.pwa-install-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.pwa-install-text {
    flex: 1;
    min-width: 0;
}
.pwa-install-text strong {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}
.pwa-install-text span {
    font-size: .78rem;
    color: #6b7280;
}
.pwa-install-btn {
    flex-shrink: 0;
    padding: .5rem 1.1rem;
    background: linear-gradient(135deg, var(--primary, #00205B), #001845);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 4px 12px rgba(0,32,91,.3);
}
.pwa-install-btn:active {
    transform: scale(.95);
}
.pwa-install-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
    transition: all .2s;
}
.pwa-install-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ── iOS Instructions Modal ── */
.pwa-ios-overlay {
    position: fixed;
    inset: 0;
    z-index: 10010;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: background .35s ease;
    pointer-events: none;
}
.pwa-ios-overlay.pwa-ios-show {
    background: rgba(0,0,0,.45);
    pointer-events: auto;
}
.pwa-ios-sheet {
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.18);
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.25,.46,.45,.94);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
}
.pwa-ios-overlay.pwa-ios-show .pwa-ios-sheet {
    transform: translateY(0);
}
.pwa-ios-handle {
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 4px;
    margin: .75rem auto .5rem;
}
.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .25rem 1.25rem .75rem;
    border-bottom: 1px solid #f1f3f5;
}
.pwa-ios-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}
.pwa-ios-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
.pwa-ios-close:hover {
    background: #e5e7eb;
}

/* ── iOS Steps ── */
.pwa-ios-steps {
    padding: 1rem 1.25rem .5rem;
}
.pwa-ios-step {
    display: none;
    gap: .85rem;
    padding: .75rem 0;
    animation: iosStepIn .35s ease;
}
.pwa-ios-step.active {
    display: flex;
}
.pwa-ios-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #00205B), #001845);
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: .15rem;
}
.pwa-ios-step-body {
    flex: 1;
    min-width: 0;
}
.pwa-ios-step-title {
    font-weight: 700;
    font-size: .95rem;
    color: #1a1a1a;
    margin-bottom: .15rem;
}
.pwa-ios-step-desc {
    font-size: .82rem;
    color: #9ca3af;
    margin-bottom: .75rem;
}
.pwa-ios-animation {
    background: #f9fafb;
    border-radius: 14px;
    padding: .75rem;
    border: 1px solid #f1f3f5;
}
.pwa-ios-svg {
    width: 100%;
    height: auto;
}

@keyframes iosStepIn {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── iOS SVG Animations ── */
.pwa-ios-tap-ring,
.pwa-ios-tap-ring-2,
.pwa-ios-tap-ring-3 {
    animation: iosTapPulse 2s ease-in-out infinite;
}
.pwa-ios-finger {
    animation: iosFingerTap 2s ease-in-out infinite;
}
.pwa-ios-finger-add {
    animation: iosFingerTap 2s ease-in-out infinite .5s;
}
.pwa-ios-finger-confirm {
    animation: iosFingerTap 2s ease-in-out infinite 1s;
}
.pwa-ios-highlight {
    animation: iosHighlight 2s ease-in-out infinite;
}
.pwa-ios-share-icon {
    animation: iosShareBounce 2s ease-in-out infinite;
}

@keyframes iosTapPulse {
    0%, 100% { r: 14; opacity: .2; }
    50% { r: 22; opacity: 0; }
}
@keyframes iosFingerTap {
    0%, 40%, 100% { transform: translate(0, 0); opacity: .8; }
    15%, 25% { transform: translate(0, -4px); opacity: 1; }
    20% { transform: translate(0, 0); opacity: 1; }
}
@keyframes iosHighlight {
    0%, 100% { opacity: 0; }
    30%, 70% { opacity: 1; }
}
@keyframes iosShareBounce {
    0%, 100% { transform: translate(0,0); }
    20%, 40% { transform: translate(0,-3px); }
    30% { transform: translate(0, 0); }
}

/* ── iOS Step Dots ── */
.pwa-ios-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 0 .25rem;
}
.pwa-ios-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: all .25s ease;
}
.pwa-ios-dot.active {
    width: 24px;
    border-radius: 4px;
    background: var(--primary, #00205B);
}

/* ── Profile Install Item ── */
.pwa-profile-install {
    background: linear-gradient(135deg, rgba(0,32,91,.02), rgba(0,32,91,.06)) !important;
    border-left: 3px solid var(--primary, #00205B) !important;
}
.pwa-profile-install:active {
    background: rgba(0,32,91,.1) !important;
}

/* ── Native Feel: Haptic-like touch feedback ── */
.pwa-standalone .feature-card:active,
.pwa-standalone .stat-card:active,
.pwa-standalone .ig-post:active,
.pwa-standalone .package-card:active,
.pwa-standalone .nav-item:active,
.pwa-standalone .btn:active {
    transition-duration: .08s;
}

/* ── Overscroll prevention in standalone ── */
.pwa-standalone .page-content {
    overscroll-behavior-y: contain;
}

/* ── Safe Area padding for iPhone X+ notch ── */
@supports (padding: env(safe-area-inset-top)) {
    .pwa-standalone .top-bar {
        padding-left: calc(env(safe-area-inset-left) + 1rem);
        padding-right: calc(env(safe-area-inset-right) + 1rem);
    }
    .pwa-standalone .mobile-nav {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ── Hide install banner when already in standalone ── */
.pwa-standalone #pwa-install-banner {
    display: none !important;
}
