/* ============================================
   BUBBLE OF HOPE - Main Stylesheet
   ============================================ */

@font-face {
    font-family: 'TT Firs Neue';
    src: url('../fonts/TT%20Firs%20Neue%20Trial%20Var%20Roman.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'TT Firs Neue';
    src: url('../fonts/TT%20Firs%20Neue%20Trial%20Var%20Roman%20(1).ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --text-primary: #ffffff;
    --text-dark: #1a1a2e;
    --gradient-1: #064e3b;
    --gradient-2: #0d9488;
    --gradient-3: #06b6d4;
    --gradient-4: #2563eb;
    --gradient-5: #0ea5e9;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    --radius: 24px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'TT Firs Neue', sans-serif;
    background: url('/images/bg.jpg') center center / cover no-repeat;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* ---- Pages ---- */
.page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.97);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s;
    z-index: 1;
}

.page.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    z-index: 10;
}

.page.exit {
    opacity: 0;
    transform: translateY(-30px) scale(0.97);
    z-index: 5;
}

/* ---- Image Background (landing card) ---- */
.image-bg {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: url('/images/bg.jpg') center center / cover no-repeat;
    z-index: 0;
}

/* ---- Gradient Background (inside cards) ---- */
.gradient-bg {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gradient-2);
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ---- Floating Bubbles ---- */
.bubble {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: float 8s ease-in-out infinite;
}

.bubble-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.7), transparent);
    top: -10%;
    left: -5%;
    animation-delay: 0s;
    animation-duration: 10s;
}

.bubble-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.6), transparent);
    bottom: -10%;
    right: -5%;
    animation-delay: -3s;
    animation-duration: 12s;
}

.bubble-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.5), transparent);
    top: 40%;
    left: 50%;
    animation-delay: -5s;
    animation-duration: 14s;
}

.bubble-4 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.5), transparent);
    top: 10%;
    right: 20%;
    animation-delay: -2s;
    animation-duration: 9s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 10px) scale(1.02); }
}

/* ============================================
   PAGE 1: LANDING
   ============================================ */
.landing-container {
    width: 90%;
    max-width: 1100px;
}

.landing-card {
    position: relative;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    max-height: 80vh;
}

.landing-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 90%;
    max-width: 1100px;
    padding: 60px 80px;
}

.landing-left {
    flex: 1;
    position: relative;
    padding-right: 60px;
}

.landing-left::after {
    content: '';
    position: absolute;
    top: -120px;
    right: 0;
    width: 1px;
    height: calc(100% + 240px);
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.45) 0.5%, rgba(255, 255, 255, 0.45) 99.5%, transparent);
}

.landing-title {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 2px;
    line-height: 1.1;
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.landing-subtitle {
    font-size: clamp(1.3rem, 2.2vw, 1.8rem);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 8px;
    letter-spacing: 1px;
}

.landing-right {
    flex: 1;
    padding-left: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#btnMulai {
    margin-top: 32px;
}

.scan-text {
    font-size: 1rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.qr-container {
    background: white;
    padding: 12px;
    /* border-radius: 16px; */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.qr-container:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.qr-container img {
    display: block;
    border-radius: 8px;
}

.qr-container canvas {
    display: block;
    border-radius: 8px;
}

/* Mulai Button */
.btn-mulai {
    position: relative;
    padding: 18px 80px;
    font-family: 'TT Firs Neue', sans-serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: white;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: var(--transition);
    overflow: hidden;
}

.btn-mulai::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    opacity: 0;
    transition: var(--transition);
}

.btn-mulai:hover {
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn-mulai:hover::before {
    opacity: 1;
}

.btn-mulai:active {
    transform: translateY(0) scale(0.98);
}

.landing-bottom-line {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 800px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    z-index: 2;
}

.card-bottom-line {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    z-index: 2;
}

/* ============================================
   PAGE 2: CAMERA
   ============================================ */
.camera-container {
    width: 90%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.section-title {
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.5px;
}

.camera-card {
    position: relative;
    width: 100%;
    /* border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden; */
    aspect-ratio: 16 / 10;
    max-height: 55vh;
}

.camera-viewport {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 30px;
}

.camera-viewport video,
.camera-viewport img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.camera-viewport canvas {
    display: none;
}

.camera-viewport img {
    display: none;
}

.camera-viewport img.visible {
    display: block;
}

.camera-viewport video.hidden {
    display: none;
}

.camera-frame {
    position: absolute;
    inset: 25px;
    border: 2px solid #FFFFFF;
    border-radius: 20px;
    z-index: 3;
    pointer-events: none;
}

/* Camera Action Buttons */
.camera-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-action {
    padding: 14px 48px;
    font-family: 'TT Firs Neue', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.btn-action:active {
    transform: translateY(0) scale(0.98);
}

.btn-action.btn-primary {
    background: white;
    color: var(--gradient-2);
    border: none;
}

.btn-action.btn-primary:hover {
    box-shadow: 0 8px 30px rgba(255, 255, 255, 0.4);
}

.btn-action.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
    color: white;
}

.btn-action.hidden {
    display: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gradient-2), var(--gradient-3), var(--gradient-4));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   PAGE 3: NAME INPUT
   ============================================ */
.name-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
}

.name-top {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    width: 90%;
    max-width: 700px;
}

.name-content > .btn-mulai {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
}

.name-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 0.5px;
}

.name-input {
    width: 100%;
    max-width: 500px;
    padding: 18px 24px;
    font-family: 'TT Firs Neue', sans-serif;
    font-size: 1.1rem;
    color: var(--text-dark);
    background: #f5f7fa;
    border: none;
    border-radius: 10px;
    outline: none;
    text-align: center;
    transition: var(--transition);
}

.name-input:focus {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
}

/* ============================================
   PAGE 4: MESSAGE CHOICE
   ============================================ */
.choice-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
}

.choice-top {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    width: 90%;
    max-width: 700px;
}

.choice-content > .btn-mulai {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
}

.choice-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    width: 100%;
}

.option-group.vertical {
    flex-direction: column;
    align-items: stretch;
    max-width: 550px;
}

.option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.option-card:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

.option-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.option-radio {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    position: relative;
    transition: var(--transition);
}

.option-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #fff;
    transform: scale(0);
    transition: var(--transition);
}

.option-card input:checked ~ .option-radio {
    border-color: #fff;
}

.option-card input:checked ~ .option-radio::after {
    transform: scale(1);
}

.option-card:has(input:checked) {
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.18);
}

.option-label {
    color: white;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.3px;
}

.option-group.vertical .option-label {
    text-align: left;
    flex: 1;
}

.message-textarea {
    max-width: 600px;
    min-height: 160px;
    resize: vertical;
    text-align: left;
    border-radius: 24px;
    font-family: 'TT Firs Neue', sans-serif;
}

.btn-submit .btn-loader {
    display: none;
    align-items: center;
    gap: 8px;
}

.btn-submit.loading .btn-text {
    display: none;
}

.btn-submit.loading .btn-loader {
    display: inline-flex;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   PAGE 4: SUCCESS
   ============================================ */
.success-container {
    width: 90%;
    max-width: 700px;
}

.success-card {
    position: relative;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 80px 60px;
}

.success-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 24px;
}

.success-icon {
    width: 100px;
    height: 100px;
    animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.success-icon svg {
    width: 100%;
    height: 100%;
}

.check-circle {
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    animation: drawCircle 1s ease-out 0.5s forwards;
}

.check-mark {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: drawCheck 0.5s ease-out 1.2s forwards;
}

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    animation: fadeUp 0.6s ease-out 0.8s both;
}

.success-subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    animation: fadeUp 0.6s ease-out 1s both;
}

@keyframes fadeUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .landing-content {
        flex-direction: column;
        padding: 40px 30px;
        text-align: center;
        gap: 30px;
    }

    .landing-left {
        padding-right: 0;
    }

    .landing-left::after {
        display: none;
    }

    .landing-right {
        padding-left: 0;
    }

    #btnMulai {
        margin-top: 20px;
    }

    .landing-card {
        aspect-ratio: auto;
        min-height: 80vh;
    }

    .name-top {
        top: 35%;
        gap: 24px;
    }

    .name-content > .btn-mulai {
        bottom: 60px;
    }

    .choice-top {
        top: 35%;
        gap: 24px;
    }

    .choice-content > .btn-mulai {
        bottom: 60px;
    }

    .choice-content,
    .name-content {
        padding: 30px 24px;
    }

    .camera-card {
        height: 35vh;
        max-height: 35vh;
    /*    aspect-ratio: auto;*/
    /*    min-height: 50vh;*/
    }
    
    

    .btn-action {
        padding: 12px 32px;
        font-size: 0.9rem;
    }

    .btn-mulai {
        padding: 14px 60px;
        font-size: 1rem;
    }

    .success-card {
        padding: 50px 30px;
    }
}

@media (max-width: 480px) {
    .landing-title {
        font-size: 1.6rem;
    }

    .landing-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .name-title,
    .choice-title {
        font-size: 1.3rem;
    }

    .name-input {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .camera-actions {
        flex-wrap: wrap;
    }

    .btn-action {
        padding: 12px 28px;
    }

    .btn-mulai {
        padding: 12px 48px;
        font-size: 0.95rem;
    }

    .option-card {
        padding: 12px 20px;
    }
}
