@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #DB2777;
    --primary-dark: #831843;
    --bg-color: #FFFFFF;
    --card-bg: #FDF2F8;
    --text-dark: #831843;
    --text-gray: #64748B;
    --border-color: #FBCFE8;
    --gradient-btn: linear-gradient(135deg, #F472B6 0%, #DB2777 100%);
    --shadow-sm: 0 4px 15px rgba(219, 39, 119, 0.05);
    --shadow-md: 0 8px 25px rgba(219, 39, 119, 0.1);
    --shadow-lg: 0 12px 35px rgba(219, 39, 119, 0.15);
    --primary-pink: #DB2777;
    --bg-pink: #FDF2F8;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Kanit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* background-image: url('assets/images/bg_cloud_pattern.png'); /* Placeholder */ */
    background-size: cover;
    background-attachment: fixed;
    background-position: top center;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background: #FFFFFF;
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

/* Views Management */
.view-step {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    animation: fadeIn 0.3s ease-in-out;
}

.view-step.active {
    display: flex;
}

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

/* Common Header */
.app-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    position: relative;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--bg-color);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    flex-grow: 1;
    text-align: center;
    margin-right: 40px; /* balance the back button */
}

/* Header Text Blocks */
.page-title-block {
    text-align: center;
    padding: 10px 24px 20px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.page-subtitle {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
    background: var(--card-bg);
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
}

/* Image Placeholders (Illustrations) */
.hero-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    min-height: 180px;
}
.hero-illustration img {
    max-width: 100%;
    max-height: auto;
    object-fit: contain;
}
.mask-y {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 25%, black 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 25%, black 75%, transparent 100%);
}

/* Service Grid (Home) */
.service-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 24px;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.service-card:hover, .service-card:active {
    border-color: #F57C00;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.service-icon-img {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: contain;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.service-icon-wrapper {
    background: transparent;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}
.service-note {
    font-size: 12px;
    color: var(--text-gray);
}

/* Select Type Buttons */
.type-select-list {
    padding: 0 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.type-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    text-align: left;
}

.type-btn:hover, .type-btn:active {
    border-color: #F57C00;
    box-shadow: var(--shadow-md);
}

.type-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.type-icon img {
    width: 30px;
    height: 30px;
}
.type-text {
    flex-grow: 1;
}
.type-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}
.type-desc {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* Forms */
.form-container {
    padding: 0 24px;
}
.input-group {
    margin-bottom: 20px;
}
.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}
.input-field {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.2);
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: var(--gradient-btn);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 18px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
    margin-top: 10px;
}
.btn-primary:active {
    transform: scale(0.98);
}
.btn-secondary {
    width: 100%;
    background: transparent;
    color: #F57C00;
    border: none;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 10px;
}
.btn-secondary:active {
    opacity: 0.7;
}

/* Warning/Info Box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 24px;
    margin-bottom: 24px;
}
.info-icon {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 2px;
}
.info-text {
    font-size: 12px;
    color: var(--text-gray);
    line-height: 1.5;
}

/* OTP Result Display */
.otp-display-area {
    padding: 0 24px 24px;
    text-align: center;
}
.otp-subtitle {
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 8px;
}
.otp-email-display {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 24px;
}

.otp-box-large {
    background: var(--bg-color);
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}
.otp-title-small {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
}
.otp-code-big {
    font-size: 42px;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 8px;
}

.countdown-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}
.countdown-text {
    font-size: 13px;
    color: var(--text-gray);
}
.countdown-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 15px;
}

/* Custom List Display (for multiple OTPs) */
.otp-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}
.otp-list-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: left;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.otp-item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.otp-item-time {
    font-size: 12px;
    color: var(--text-gray);
}
.otp-item-code {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 2px;
}
.otp-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.status-ready {
    background: #E8F5E9;
    color: #2E7D32;
}
.status-expired {
    background: #FFEBEE;
    color: #C62828;
}

/* Footer elements */
.footer-illustration {
    margin-top: auto;
    width: 100vw;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
}
.footer-illustration img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 25%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 25%);
}
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 500;
    margin-top: -10px;
}
.trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.loader-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utilities */
.hidden { display: none !important; }

/* Mobile Hero Styling */
.mobile-hero {
    position: relative;
}
.mobile-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, transparent, #FFFFFF);
    pointer-events: none;
}

/* PC Header Styling */
.pc-header {
    display: none;
    width: 100%;
    position: relative;
}
.pc-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, transparent, #FFFFFF);
    pointer-events: none;
}
.pc-header img {
    width: 100%;
    height: auto;
    display: block;
}

/* Media query for desktop */
@media (min-width: 768px) {
    body {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }
    .pc-header {
        display: block;
    }
    /* Hide the mobile hero image inside the container on PC */
    .mobile-hero {
        display: none !important;
    }
    
    /* Full width container on PC */
    .app-container {
        max-width: 100% !important;
        box-shadow: none;
    }
    
    /* Keep the form content centered and not too wide */
    .view-step {
        max-width: 800px;
        margin: 0 auto;
        width: 100%;
        align-items: center;
    }
    
    .service-grid {
        display: flex !important;
        justify-content: center;
        flex-wrap: wrap;
        gap: 20px;
        width: 100%;
    }
    
    .service-grid .service-card {
        width: 160px;
    }
    
    .form-container {
        width: 100%;
        max-width: 500px;
    }
}


/* Construction Modal */
.construction-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeInModal 0.4s ease-out;
}

.construction-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(219, 39, 119, 0.35);
    animation: slideUpModal 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 24px;
    color: var(--primary-color);
    box-shadow: inset 0 2px 10px rgba(219, 39, 119, 0.08);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.modal-desc {
    font-size: 15px;
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 32px;
}

.progress-container {
    margin-bottom: 32px;
    text-align: left;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.progress-bar-bg {
    width: 100%;
    height: 14px;
    background: var(--border-color);
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-btn);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    animation: shimmerProgress 2s infinite;
}

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

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

@keyframes shimmerProgress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* OTP Boxes UI */
.otp-boxes-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.otp-box {
    width: 45px;
    height: 55px;
    border: 2px solid #FBCFE8;
    border-radius: 20px;
    background-color: #FDF2F8;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    color: #831843;
    transition: all 0.2s ease;
    padding: 0;
}
.otp-box:focus {
    outline: none;
    border-color: #DB2777;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.15);
}
.btn-verify-green {
    width: 100%;
    background: var(--gradient-btn);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}
.btn-verify-green:hover {
    transform: scale(0.98);
}
