/* ============================================
   Foto Kita Blur by Kare
   CSS Styles
   ============================================ */

/* ---------- Reset & Variables ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- Accessibility: Skip Link ---------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--pink);
    color: white;
    padding: 10px 20px;
    z-index: 9999;
    font-size: 0.9rem;
    border-radius: 0 0 8px 0;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:root {
    --pink: #ff2d78;
    --purple: #a855f7;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --dark: #0a0a0f;
    --glass: rgba(0, 0, 0, 0.6);
    --glass-border: rgba(255, 255, 255, 0.06);
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-dim: rgba(255, 255, 255, 0.4);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* ---------- Base ---------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--dark);
    min-height: 100vh;
    min-height: 100dvh;
    color: white;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Background ---------- */
.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 30% 50%, rgba(168, 85, 247, 0.15), transparent 50%),
        radial-gradient(circle at 70% 50%, rgba(255, 45, 120, 0.1), transparent 50%);
}

/* ---------- Loading Screen ---------- */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--dark);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: bounce 1s infinite;
}

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

.loading-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--pink), var(--purple));
    border-radius: 4px;
    animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0%; margin-left: 0; }
    50% { width: 60%; margin-left: 20%; }
    100% { width: 0%; margin-left: 100%; }
}

/* ---------- Camera Placeholder ---------- */
.camera__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #0f0f1a);
    z-index: 1;
}

.camera__placeholder.hidden {
    display: none;
}

.camera__placeholder-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.camera__placeholder-text {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ---------- Layout ---------- */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 80px;
}

/* ---------- Header ---------- */
.header {
    text-align: center;
    padding: 20px 16px 12px;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo__subtitle {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    background: none;
    -webkit-text-fill-color: var(--text-dim);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ---------- Camera ---------- */
.camera {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    padding: 2px;
}

.camera__inner {
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    position: relative;
    aspect-ratio: 4/3;
}

.camera__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
}

.camera__blur {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: none;
    z-index: 2;
    pointer-events: none;
}

.camera__blur--active {
    display: block;
}

/* ---------- Badges ---------- */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 5;
}

.badge__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pink);
    transition: background-color 0.3s;
}

.badge__dot--active {
    background: #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.gesture-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 1.2rem;
    display: none;
    z-index: 5;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.gesture-badge--visible {
    display: block;
}

/* ---------- Buttons ---------- */
.actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, opacity 0.15s;
}

.btn:active {
    transform: scale(0.97);
}

.btn--primary {
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    box-shadow: 0 4px 20px rgba(255, 45, 120, 0.3);
}

.btn--primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 0 0 50px;
}

.btn--ghost.active {
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    border-color: transparent;
}

/* ---------- Info Cards ---------- */
.cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.card__icon {
    font-size: 1.3rem;
    font-style: normal;
}

.card__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    color: var(--purple);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 6px 0 4px;
}

.card__text {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---------- How To ---------- */
.howto {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.howto__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.howto__steps {
    display: flex;
    gap: 8px;
}

.howto__step {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
}

.howto__step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 auto 6px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.howto__step-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 24px;
    font-size: 0.68rem;
    color: var(--text-dim);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: linear-gradient(180deg, #1a1a2e, #0f0f1a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 28px 20px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.4s ease;
}

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

.modal__icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.modal__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal__text {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 16px;
    line-height: 1.5;
}

.modal__qr {
    width: 170px;
    height: 170px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    margin-bottom: 16px;
}

.modal__btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.modal__skip {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 10px;
    cursor: pointer;
    padding: 8px;
}

.modal--hidden {
    display: none !important;
}

/* ---------- Loading ---------- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Error ---------- */
.error-message {
    color: #f87171;
    font-size: 0.75rem;
    margin-top: 8px;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .header {
        padding: 14px 10px 8px;
    }

    .container {
        padding: 0 10px 60px;
    }

    .camera {
        border-radius: var(--radius-md);
    }

    .camera__inner {
        border-radius: 12px;
        aspect-ratio: unset;
    }

    .camera__video {
        height: auto;
        object-fit: contain;
    }

    .btn {
        padding: 12px;
        font-size: 0.82rem;
    }

    .btn--ghost {
        flex: 0 0 44px;
    }

    .card {
        padding: 10px;
    }

    .howto {
        padding: 12px;
    }

    .modal {
        padding: 20px 16px;
    }

    .modal__qr {
        width: 140px;
        height: 140px;
    }
}

@media (min-width: 768px) {
    .camera__inner {
        aspect-ratio: 16/9;
    }
}
