/* ==========================================
   數位名片 - 馬卡龍扁平設計 v3
   零漸層、純色、溫暖陰影
   ========================================== */

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

:root {
    /* 馬卡龍色板 */
    --macaron-rose:       #F4B5C1;
    --macaron-peach:      #F8C9A0;
    --macaron-lemon:      #F9E4A7;
    --macaron-mint:       #A8D8C8;
    --macaron-lavender:   #C5B9E8;
    --macaron-blueberry:  #A5C4E3;
    --macaron-pistachio:  #B8D8A8;
    --macaron-vanilla:    #FFF5E6;

    /* 品牌色（可被 JS 覆蓋） */
    --primary-color: #667eea;
    --primary-rgb: 102, 126, 234;
    --secondary-color: #764ba2;
    --secondary-rgb: 118, 75, 162;

    /* 文字 */
    --text-color: #2D2D3A;
    --text-light: #5A5A6E;
    --text-muted: #9E9EB0;

    /* 背景 */
    --bg-color: #F5F3F0;
    --card-bg: #ffffff;
    --border-color: #ECEAE6;

    /* 溫暖陰影 */
    --shadow-sm: 0 1px 3px rgba(45,45,58,0.06);
    --shadow-md: 0 4px 12px rgba(45,45,58,0.06);
    --shadow-lg: 0 8px 24px rgba(45,45,58,0.06);

    /* 圓角 */
    --radius-pill: 9999px;
    --radius-card: 16px;
    --radius-sm: 12px;

    /* 字型 */
    --font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ==========================================
   Loading Screen
   ========================================== */
.loading-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s var(--transition-smooth);
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--macaron-mint);
    animation: dotBounce 1.4s infinite;
}

.loading-dots span:nth-child(2) {
    background: var(--macaron-peach);
    animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
    background: var(--macaron-lavender);
    animation-delay: 0.3s;
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-screen p {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ==========================================
   Scroll Animations
   ========================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--transition-smooth), transform 0.6s var(--transition-smooth);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   Card Container
   ========================================== */
.card-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--card-bg);
    position: relative;
}

@media (min-width: 481px) {
    body {
        background: var(--bg-color);
    }
    .card-container {
        margin-top: 24px;
        margin-bottom: 24px;
        border-radius: var(--radius-card);
        overflow: hidden;
        min-height: auto;
        box-shadow: var(--shadow-lg);
    }
}

/* ==========================================
   Hero Section
   ========================================== */
.hero-section {
    position: relative;
    text-align: center;
    padding-bottom: 24px;
    overflow: hidden;
}

.hero-cover {
    height: 200px;
    background: var(--macaron-vanilla);
    background-size: cover;
    background-position: center;
    position: relative;
}

/* 圓弧底部切割 */
.hero-cover::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -5%;
    width: 110%;
    height: 40px;
    background: var(--card-bg);
    border-radius: 50% 50% 0 0;
}

.hero-content {
    margin-top: -52px;
    position: relative;
    z-index: 1;
    padding: 0 24px;
}

.avatar-wrapper {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 4px solid var(--card-bg);
    overflow: hidden;
    margin: 0 auto;
    background: var(--macaron-lavender);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-wrapper video.avatar-img {
    pointer-events: none;
}

.avatar-wrapper.avatar-fallback .avatar-img {
    display: none;
}

.avatar-fallback-text {
    font-size: 36px;
    font-weight: 900;
    color: white;
    display: none;
}

.avatar-wrapper.avatar-fallback .avatar-fallback-text {
    display: block;
}

.merchant-name {
    font-size: 28px;
    font-weight: 900;
    margin-top: 16px;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.merchant-subtitle {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 8px;
    font-weight: 400;
    line-height: 1.6;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.merchant-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.merchant-tag {
    display: inline-block;
    padding: 4px 14px;
    background: var(--macaron-vanilla);
    color: var(--text-light);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================
   Section Shared
   ========================================== */
.card-section {
    padding: 24px 24px;
    position: relative;
}

.card-section + .card-section {
    padding-top: 8px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.section-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-color);
}

/* Section dot colors */
.section-dot-mint { background: var(--macaron-mint); }
.section-dot-peach { background: var(--macaron-peach); }
.section-dot-rose { background: var(--macaron-rose); }
.section-dot-lemon { background: var(--macaron-lemon); }
.section-dot-blueberry { background: var(--macaron-blueberry); }
.section-dot-pistachio { background: var(--macaron-pistachio); }
.section-dot-lavender { background: var(--macaron-lavender); }

/* ==========================================
   Announcement Banner
   ========================================== */
.announcement-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 13px;
    line-height: 1.5;
    flex-wrap: wrap;
}

.announcement-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.announcement-text {
    flex: 1;
    min-width: 0;
}

.announcement-link {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.announcement-info {
    background: #EFF6FF;
    color: #1E40AF;
    border-bottom: 1px solid #BFDBFE;
}

.announcement-warning {
    background: #FFFBEB;
    color: #92400E;
    border-bottom: 1px solid #FDE68A;
}

.announcement-success {
    background: #F0FDF4;
    color: #166534;
    border-bottom: 1px solid #BBF7D0;
}

.announcement-promo {
    background: #F5F3FF;
    color: #5B21B6;
    border-bottom: 1px solid #DDD6FE;
}

/* ==========================================
   CTA Buttons
   ========================================== */
.cta-section {
    padding: 4px 24px 24px;
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s var(--transition-smooth);
    width: 100%;
    letter-spacing: 0.3px;
    font-family: var(--font-family);
}

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

.cta-btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.cta-btn-outline {
    background: white;
    color: var(--text-color);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.cta-btn-outline:active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cta-btn-icon {
    font-size: 18px;
    line-height: 1;
}

/* ==========================================
   Carousel (輪播圖)
   ========================================== */
.carousel-wrapper {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-wrapper::-webkit-scrollbar {
    display: none;
}

.carousel-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

.carousel-slide img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-card);
    display: block;
}

.carousel-slide a {
    display: block;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s;
    cursor: pointer;
}

.carousel-dot.active {
    background: var(--primary-color);
    width: 20px;
    border-radius: 4px;
}

/* ==========================================
   YouTube
   ========================================== */
.youtube-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.youtube-item {
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.youtube-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.youtube-title {
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    background: var(--macaron-vanilla);
}

/* ==========================================
   About Section
   ========================================== */
.about-content .description {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 16px;
    white-space: pre-line;
}
/* Long-description collapse / expand */
.about-desc-wrap { margin-bottom: 16px; }
.about-desc-wrap .description { margin-bottom: 8px; }
.description-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.description-expanded {
    display: block;
    max-height: none;
}
.description-toggle {
    background: transparent;
    border: none;
    padding: 4px 8px;
    color: var(--primary, #6366F1);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.description-toggle:hover { text-decoration: underline; }

.business-hours {
    background: var(--macaron-vanilla);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
}

.business-hours-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hours-grid {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 6px 16px;
    font-size: 13px;
}

.hours-day {
    color: var(--text-light);
    font-weight: 500;
}

.hours-time {
    color: var(--text-color);
}

.hours-time.closed {
    color: #e74c3c;
    font-weight: 500;
}

.hours-time.today {
    color: var(--primary-color);
    font-weight: 700;
}

.hours-day.today {
    color: var(--primary-color);
    font-weight: 700;
}

.info-items {
    display: flex;
    flex-direction: column;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--border-color);
    text-decoration: none;
}

.info-row:active {
    opacity: 0.7;
}

.info-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--macaron-vanilla);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
    min-width: 0;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    word-break: break-all;
}

.info-arrow {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

/* ==========================================
   Services Section
   ========================================== */
.services-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.service-card:active {
    transform: scale(0.98);
}

.service-img {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--macaron-vanilla);
}

.service-img-placeholder {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background: var(--macaron-vanilla);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.service-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.service-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
}

.service-desc {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    white-space: pre-line;   /* Preserve newlines in the description */
}
/* Collapsible long description: clamped 2-line preview → click toggle to expand */
.service-desc-wrap { display: block; }
.service-desc-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.service-desc.expanded {
    display: block;
    -webkit-line-clamp: unset;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 4px;
    white-space: pre-line;   /* Preserve merchant's newlines once expanded */
}
.service-desc-toggle {
    background: none;
    border: none;
    padding: 4px 0;
    margin: 2px 0 0;
    color: var(--primary, #4F46E5);
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    display: inline-block;
}
.service-desc-toggle:hover { text-decoration: underline; }

.service-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.service-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
}

.service-duration {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--macaron-vanilla);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}

/* ==========================================
   Gallery Section (相片牆)
   ========================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s var(--transition-smooth);
}

.gallery-item:active img {
    transform: scale(1.05);
}

/* ==========================================
   FAQ Section
   ========================================== */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.25s;
}

.faq-item.open {
    border-color: var(--macaron-pistachio);
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    font-family: var(--font-family);
    line-height: 1.5;
}

.faq-chevron {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-left: 10px;
    transition: transform 0.3s var(--transition-smooth);
    color: var(--text-muted);
}

.faq-item.open .faq-chevron {
    transform: rotate(180deg);
    color: var(--macaron-pistachio);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--transition-smooth), padding 0.35s var(--transition-smooth);
    padding: 0 16px;
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.8;
    white-space: pre-line;   /* Preserve merchant's newlines in answers */
}

.faq-item.open .faq-answer {
    max-height: 500px;
    padding: 0 16px 16px;
    overflow-y: auto;        /* Long answers scroll instead of getting clipped */
}

/* ==========================================
   Social Links (圓形圖標網格)
   ========================================== */
.social-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.social-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    width: 64px;
}

.social-item:active {
    transform: scale(0.92);
}

.social-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s var(--transition-smooth);
}

.social-icon-circle svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.social-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* Social brand colors */
.social-bg-facebook { background: #1877F2; }
.social-bg-instagram { background: #E4405F; }
.social-bg-line { background: #06C755; }
.social-bg-google-maps { background: #34A853; }
.social-bg-youtube { background: #FF0000; }
.social-bg-tiktok { background: #010101; }
.social-bg-website { background: var(--primary-color); }
.social-bg-default { background: var(--primary-color); }

/* ==========================================
   Share Bar
   ========================================== */
.share-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.share-btn:hover {
    background: white;
    border-color: rgba(0,0,0,0.15);
}

.share-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

.share-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}

.share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* QR Modal */
.qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}

.qr-overlay.show {
    opacity: 1;
}

.qr-modal {
    background: white;
    border-radius: 16px;
    padding: 32px 28px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.qr-overlay.show .qr-modal {
    transform: scale(1);
}

.qr-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
    transition: background 0.15s;
}

.qr-modal-close:hover {
    background: #e0e0e0;
}

.qr-modal h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

.qr-canvas-wrap {
    display: inline-block;
    padding: 12px;
    background: white;
    border-radius: 12px;
    border: 1px solid #eee;
    margin-bottom: 12px;
}

.qr-canvas-wrap canvas {
    display: block;
}

.qr-url {
    font-size: 11px;
    color: #aaa;
    word-break: break-all;
    margin-bottom: 16px;
    line-height: 1.4;
}

.qr-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.qr-save-btn:hover {
    background: #f5f5f5;
}

/* ==========================================
   Footer
   ========================================== */
.card-footer {
    padding: 32px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.card-footer p {
    opacity: 0.4;
}

/* ==========================================
   Chat FAB
   ========================================== */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.25s var(--transition-smooth);
    animation: fabPulse 3s infinite;
}

@keyframes fabPulse {
    0%, 100% { box-shadow: var(--shadow-lg); }
    50% { box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.4), 0 0 0 8px rgba(var(--primary-rgb), 0.1); }
}

.chat-fab:focus,
.chat-fab:focus-visible {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.chat-fab:active {
    transform: scale(0.92);
    animation: none;
}

.chat-fab.open {
    animation: none;
}

.chat-fab.open .chat-fab-icon { display: none; }
.chat-fab.open .chat-fab-close { display: block !important; }

.chat-fab-hint {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4757;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
    pointer-events: none;
}

/* ==========================================
   Chat Panel
   ========================================== */
.chat-panel {
    position: fixed;
    bottom: 96px;
    right: 16px;
    width: calc(100% - 32px);
    max-width: 380px;
    height: 500px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: var(--radius-card);
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    z-index: 999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s var(--transition-smooth);
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--primary-color);
    color: white;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
}

.chat-header-name { font-size: 15px; font-weight: 600; }

.chat-header-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
}

.chat-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafbfc;
}

.chat-welcome {
    text-align: center;
    padding: 20px 0;
}

.chat-welcome p {
    color: var(--text-light);
    font-size: 14px;
    background: white;
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    animation: bubbleIn 0.25s var(--transition-smooth);
}

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

.chat-bubble.bot {
    background: white;
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-bubble.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-typing {
    align-self: flex-start;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.chat-typing-dots { display: flex; gap: 4px; }

.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-8px); opacity: 1; }
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
    background: white;
}

.chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
    background: #fafbfc;
}

.chat-input:focus {
    border-color: var(--primary-color);
    background: white;
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.chat-send-btn:active { transform: scale(0.9); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 語音模式切換按鈕 */
.chat-voice-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.chat-voice-toggle.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 語音輸入區域 */
.chat-voice-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.chat-voice-status {
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    text-align: center;
}

/* 麥克風按鈕 */
.chat-mic-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.chat-mic-btn.recording {
    background: #e53935;
    animation: mic-pulse 1.5s infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(229, 57, 53, 0); }
}

/* ==========================================
   Lightbox
   ========================================== */
.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    animation: lightboxFadeIn 0.3s;
}

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

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 2001;
    border-radius: 50%;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    animation: lightboxZoomIn 0.3s var(--transition-smooth);
}

@keyframes lightboxZoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-caption {
    color: white;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
    opacity: 0.8;
}

/* ==========================================
   Mobile
   ========================================== */
@media (max-width: 480px) {
    .chat-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .chat-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    .chat-fab.open {
        display: none !important;
    }
    .chat-input-area {
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)) 12px;
    }
    .hero-cover {
        height: 180px;
    }
    .card-section {
        padding: 20px 20px;
    }
}

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

/* ==========================================
   商品 Grid
   ========================================== */
.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.product-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: relative;
    transition: transform 0.2s;
}
.product-card:active {
    transform: scale(0.98);
}
.product-card.sold-out {
    opacity: 0.6;
}
.product-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.product-img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--macaron-vanilla, #FFF5E6);
    font-size: 2em;
}
.product-sold-out-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}
.product-info {
    padding: 10px;
}
.product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.product-price {
    font-weight: 700;
    color: var(--primary-color, #667eea);
    font-size: 15px;
}
.product-original-price {
    font-size: 12px;
    color: #bbb;
    text-decoration: line-through;
}
.product-add-btn {
    width: 100%;
    padding: 8px 0;
    border: none;
    border-radius: 8px;
    background: var(--primary-color, #667eea);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.product-add-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.product-add-btn:not(:disabled):active {
    opacity: 0.8;
}

/* ==========================================
   購物車 FAB
   ========================================== */
.cart-fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-color, #667eea);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s;
}
.cart-fab:active {
    transform: scale(0.92);
}
.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ==========================================
   購物車面板
   ========================================== */
.cart-overlay, .checkout-overlay, .order-success-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 10000;
    display: flex;
    justify-content: flex-end;
}
.cart-backdrop, .checkout-backdrop {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.3s;
}
.cart-overlay.active .cart-backdrop,
.checkout-overlay.active .checkout-backdrop {
    opacity: 1;
}
.cart-panel, .checkout-panel {
    position: relative;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.cart-overlay.active .cart-panel,
.checkout-overlay.active .checkout-panel {
    transform: translateX(0);
}
.cart-header, .checkout-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-header h3, .checkout-header h3 {
    margin: 0;
    font-size: 18px;
}
.cart-close-btn, .checkout-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}
.cart-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}
.cart-empty span {
    font-size: 3em;
    display: block;
    margin-bottom: 12px;
}
.cart-item {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}
.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cart-item-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    font-size: 1.2em;
}
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price {
    font-size: 13px;
    color: var(--primary-color, #667eea);
    font-weight: 600;
}
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.cart-qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-qty-num {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}
.cart-remove-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}
.cart-remove-btn:hover {
    color: #e74c3c;
}
.cart-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    background: #fff;
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
}
.cart-total {
    font-weight: 700;
    font-size: 20px;
    color: var(--primary-color, #667eea);
}
.cart-checkout-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color, #667eea);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.cart-checkout-btn:active {
    opacity: 0.85;
}

/* ==========================================
   結帳面板
   ========================================== */
.checkout-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.checkout-section {
    margin-bottom: 20px;
}
.checkout-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}
.checkout-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #555;
}
.checkout-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0 0 0;
    border-top: 1px solid #eee;
    margin-top: 8px;
    font-size: 16px;
}
.checkout-field {
    margin-bottom: 12px;
}
.checkout-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #555;
}
.checkout-field .required {
    color: #e74c3c;
}
.checkout-field input,
.checkout-field select,
.checkout-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.checkout-field input:focus,
.checkout-field select:focus,
.checkout-field textarea:focus {
    outline: none;
    border-color: var(--primary-color, #667eea);
}
.checkout-submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color, #667eea);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}
.checkout-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ==========================================
   訂單成功
   ========================================== */
.order-success-overlay {
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.5);
}
.order-success-overlay.active {
    /* just show */
}
.order-success-panel {
    background: #fff;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.order-success-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.order-success-panel h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
}
.order-success-panel p {
    margin: 4px 0;
    font-size: 14px;
    color: #555;
}
.order-success-note {
    margin-top: 12px !important;
    color: #999 !important;
    font-size: 13px !important;
}
.order-success-btn {
    margin-top: 20px;
    padding: 12px 40px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color, #667eea);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================
   Toast 通知
   ========================================== */
.shop-toast {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 20000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.shop-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
