/*
 * 우리끼리 스탬프 투어
 * Theme Color: #ffd600 (Primary Yellow)
 * Design System based on reference images
 */

@import url('https://fonts.googleapis.com/css2?family=Jua&family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --primary: #ffd600;
    --primary-light: #ffeb3b;
    --primary-dark: #c7a600;
    --secondary: #586ec4;
    --secondary-light: #7289da;
    --background: #ffffff;
    --card-bg: #fafafa;
    --card-border: #eeeeee;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --white: #ffffff;
    --success: #4caf50;
    --warning: #ff9800;
    --checkbox-border: #dddddd;
    --button-gradient: linear-gradient(180deg, #ffeb3b 0%, #ffd600 100%);
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--background);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Header - 우리끼리 Logo Style */
.header {
    text-align: center;
    padding: 20px 20px 16px;
    background: var(--primary);
}

.logo {
    max-width: 120px;
    height: auto;
}

.logo-text {
    font-family: 'Jua', sans-serif;
    font-size: 32px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -1px;
    text-shadow:
        -1.5px -1.5px 0 var(--white),
        1.5px -1.5px 0 var(--white),
        -1.5px 1.5px 0 var(--white),
        1.5px 1.5px 0 var(--white);
}

/* Main Content Area */
.consent-content,
.stamp-content {
    flex: 1;
    padding: 0 16px 24px;
}

/* Content - Full Layout */
.consent-content,
.stamp-content {
    background: #f9f9f7;
    padding: 20px 16px 24px;
}

/* ==================== */
/* CONSENT SCREEN       */
/* ==================== */

.consent-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.consent-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Checkbox Container - All Agree */
.consent-all {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    margin-bottom: 16px;
    border: 1.5px solid var(--card-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.consent-all:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.15);
}

.consent-all .checkbox-label {
    font-size: 17px;
    font-weight: 700;
}

/* Consent Items Container */
.consent-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.consent-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    border: 1.5px solid var(--card-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.consent-item:has(input:checked) {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.15);
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--checkbox-border);
    border-radius: 6px;
    margin-right: 14px;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: var(--white);
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary-dark);
    background: rgba(255, 214, 0, 0.05);
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark::after {
    content: '';
    width: 6px;
    height: 11px;
    border: solid var(--white);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    margin-bottom: 3px;
}

.checkbox-label {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
    font-weight: 500;
}

/* Consent Details */
.consent-details {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--card-border);
    margin-left: 38px;
}

.consent-details p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.6;
}

/* Primary Button */
.primary-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-light);
}

.primary-btn:active:not(:disabled) {
    background: var(--primary-dark);
}

.primary-btn:disabled {
    background: #e0e0e0;
    color: #aaaaaa;
    cursor: not-allowed;
}

.consent-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 20px;
    line-height: 1.5;
}

/* ==================== */
/* STAMP SCREEN         */
/* ==================== */

.stamp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.stamp-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stamp-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Demo Button */
.demo-btn {
    padding: 6px 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.demo-btn:active {
    background: #d0d0d0;
}

/* Completion Badge */
.completion-badge {
    display: none;
    align-items: center;
    gap: 4px;
    background: var(--secondary);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.completion-badge.show {
    display: flex;
}

.badge-icon {
    font-size: 11px;
}

.stamp-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Progress Box - Yellow Theme */
.progress-box {
    background: var(--primary);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 20px;
}

.progress-count {
    font-family: 'Jua', sans-serif;
    font-size: 52px;
    font-weight: 400;
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1;
}

.progress-message {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 8px;
    font-weight: 500;
}

/* Stamps Grid - 2 columns */
.stamps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

/* Individual Stamp Item */
.stamp-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 12px;
    border: 1px solid var(--card-border);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.stamp-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.stamp-item:active {
    transform: translateY(0);
}

/* Stamp Image Container */
.stamp-image-container {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fafafa;
    position: relative;
}

.stamp-image {
    width: 85%;
    height: 85%;
    object-fit: contain;
    transition: all 0.4s ease;
}

/* Stamp States */

/* 예약확정 - Grayscale */
.stamp-item.booked .stamp-image {
    filter: grayscale(100%);
    opacity: 0.75;
}

/* 이용완료 - Full Color */
.stamp-item.completed .stamp-image {
    filter: grayscale(0%);
    opacity: 1;
}

/* 미이용 - Very faded */
.stamp-item.pending .stamp-image-container {
    background: #f5f5f5;
}

.stamp-item.pending .stamp-image {
    filter: grayscale(100%);
    opacity: 0.25;
}

/* Stamp Info */
.stamp-info {
    text-align: center;
}

.stamp-branch {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.stamp-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stamp-status {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 10px;
}

.stamp-item.completed .stamp-status {
    background: rgba(88, 110, 196, 0.1);
    color: var(--secondary);
}

.stamp-item.booked .stamp-status {
    background: rgba(255, 214, 0, 0.2);
    color: var(--primary-dark);
}

.stamp-item.pending .stamp-status {
    background: #f5f5f5;
    color: var(--text-muted);
}

/* Stamp Press Animation */
@keyframes stampPress {
    0% { transform: scale(1); }
    30% { transform: scale(1.15); }
    50% { transform: scale(0.95); }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.stamp-item.completed.animate .stamp-image {
    animation: stampPress 0.6s ease;
}

/* User Info Section */
.user-info-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.user-phone {
    font-size: 13px;
    color: var(--text-muted);
}

.help-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 1.5px solid var(--card-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-btn:hover {
    border-color: var(--secondary);
    background: rgba(88, 110, 196, 0.05);
}

.help-icon {
    width: 20px;
    height: 20px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.help-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Stamp Title Wrap */
.stamp-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-code {
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary);
    background: rgba(88, 110, 196, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
}

/* Footer Info */
.stamp-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    background: #f8f8f8;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

.info-icon {
    color: var(--secondary);
    font-size: 14px;
}

/* Collapsible Section */
.collapsible-section {
    margin-top: 20px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.collapsible-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f8f8f8;
    border: none;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.collapsible-header:hover {
    background: #f0f0f0;
}

.collapsible-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.collapsible-header.active .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--white);
}

.collapsible-content.show {
    max-height: 500px;
}

.notice-item {
    padding: 16px;
    border-bottom: 1px solid var(--card-border);
}

.notice-item:last-child {
    border-bottom: none;
}

.notice-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.notice-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notice-item li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 12px;
    position: relative;
    margin-bottom: 4px;
}

.notice-item li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.notice-item.warning {
    background: #fff8e1;
}

.notice-item.warning h4 {
    color: #f57c00;
}

.notice-item.highlight {
    background: rgba(88, 110, 196, 0.05);
}

.notice-item.highlight p {
    font-size: 13px;
    color: var(--secondary);
    margin: 0;
    text-align: center;
}

/* ==================== */
/* MODALS               */
/* ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 320px;
    overflow: hidden;
    animation: modalSlideUp 0.25s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #eeeeee;
}

.modal-body {
    padding: 24px 20px;
}

.modal-stamp-image {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-stamp-image img {
    max-width: 100%;
    max-height: 100%;
}

.modal-info {
    text-align: center;
}

.modal-info p {
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-branch {
    font-size: 17px !important;
    font-weight: 600;
    color: var(--text-primary) !important;
    margin-bottom: 12px !important;
}

.modal-status {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 12px !important;
}

.modal-status.completed {
    background: rgba(88, 110, 196, 0.1);
    color: var(--secondary);
}

.modal-status.booked {
    background: rgba(255, 214, 0, 0.2);
    color: var(--primary-dark);
}

.modal-status.pending {
    background: #f5f5f5;
    color: var(--text-muted);
}

/* Completion Modal */
.completion-modal-content {
    text-align: center;
    padding: 40px 24px;
}

.completion-celebration {
    font-size: 56px;
    margin-bottom: 16px;
    animation: celebrationBounce 1s ease infinite;
}

@keyframes celebrationBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

.completion-title {
    font-family: 'Jua', sans-serif;
    font-size: 26px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.completion-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.completion-submessage {
    font-size: 14px;
    color: var(--secondary);
    margin-bottom: 24px;
    font-weight: 500;
}

/* Help Modal */
.help-modal-content {
    max-width: 360px;
    max-height: 85vh;
    overflow-y: auto;
}

.help-modal-body {
    padding: 20px !important;
}

.help-step {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.help-step:last-of-type {
    margin-bottom: 24px;
}

.step-number {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--primary);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.step-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.step-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.help-contact {
    background: #f8f8f8;
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
}

.help-contact h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.help-contact > p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--secondary);
    color: var(--white);
    text-decoration: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.contact-link:hover {
    background: var(--secondary-light);
}

.contact-icon {
    font-size: 16px;
}

.contact-hours {
    font-size: 12px;
    color: var(--text-muted);
    margin: 10px 0 0 0 !important;
}

/* ==================== */
/* RESPONSIVE           */
/* ==================== */

@media (max-width: 380px) {
    .consent-card,
    .stamp-card {
        padding: 20px 16px;
    }

    .consent-title,
    .stamp-title {
        font-size: 18px;
    }

    .progress-count {
        font-size: 44px;
    }

    .stamps-grid {
        gap: 10px;
    }

    .stamp-item {
        padding: 10px;
    }

    .stamp-branch {
        font-size: 11px;
    }
}

/* ==================== */
/* REWARD SECTION       */
/* ==================== */

/* 리워드 받기 버튼 */
.reward-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    border: none;
    border-radius: var(--radius-lg);
    font-family: 'Jua', sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    animation: rewardPulse 2s ease-in-out infinite;
}

.reward-btn.show {
    display: flex;
}

.reward-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.reward-btn:active {
    transform: translateY(0);
}

.reward-icon {
    font-size: 22px;
}

@keyframes rewardPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(255, 107, 107, 0.6); }
}

/* 리워드 수령 완료 표시 */
.reward-claimed {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 24px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid var(--success);
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    color: var(--success);
}

.reward-claimed.show {
    display: flex;
}

.claimed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--success);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
}

/* 리워드 수령 모달 */
.reward-modal-content {
    text-align: center;
    padding: 32px 24px;
    max-width: 360px;
}

.reward-celebration {
    font-size: 64px;
    margin-bottom: 16px;
    animation: celebrationBounce 1s ease infinite;
}

.reward-title {
    font-family: 'Jua', sans-serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.reward-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.reward-info-box {
    background: linear-gradient(135deg, #fff9c4 0%, #ffecb3 100%);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    text-align: left;
}

.reward-info-box h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.reward-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reward-item {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.reward-item strong {
    color: var(--text-primary);
}

.reward-code-box {
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.code-label {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reward-code {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: 1px;
    margin: 0;
}

.reward-thanks {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
    margin: 0 0 8px 0;
}

.reward-note {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 20px 0;
}

/* Safe area for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .consent-content,
    .stamp-content {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}
