/* ============================================================
   美雅清潔服務 — 前台樣式
   基於原有 styles.css 擴展，配合 Tailwind CDN 使用
   ============================================================ */

/* ── CSS 變數 ────────────────────────────────────────────── */
:root {
    --primary:      #12abca;
    --primary-dark: #0e8fa8;
    --primary-light:#e8f7fb;
    --secondary:    #ffffff;
    --text:         #333333;
    --text-muted:   #6b7280;
    --heading:      #111111;
    --link:         #12abca;
    --link-hover:   #0e8fa8;
    --border:       #e5e7eb;
    --bg-light:     #f9fafb;
    --bg-section:   #f3f4f6;
    --success:      #10b981;
    --warning:      #f59e0b;
    --error:        #ef4444;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg:    0 14px 30px rgba(2,6,23,0.12);
    --radius-sm:    0.375rem;
    --radius-md:    0.5rem;
    --radius-lg:    0.75rem;
    --radius-xl:    1rem;
    --transition:   all 0.25s ease;
}

/* ── 基礎重置 ────────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    color: var(--text);
    background: var(--secondary);
    font-family: 'Noto Sans TC', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading);
    line-height: 1.3;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--link-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── 導航列 ──────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-link {
    position: relative;
    color: var(--text);
    font-weight: 500;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* 手機選單 */
.mobile-menu {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.mobile-menu.open {
    max-height: 500px;
    opacity: 1;
}

/* ✅ NEW ── 漢堡按鈕 ────────────────────────────────────── */
.hamburger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.hamburger:hover {
    background: var(--bg-light);
}

.hamburger:active {
    background: var(--bg-section);
}

/* ✅ NEW ── 漢堡三條線 ──────────────────────────────────── */
.icon-bars {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 24px;
    height: 24px;
}

.icon-bars span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--heading);
    border-radius: 2px;
    transition: var(--transition);
}

.icon-bars span:nth-child(2) {
    width: 15px;
    align-self: flex-end;
}

.hamburger:hover .icon-bars span:nth-child(2) {
    width: 20px;
}

/* ✅ NEW ── 漢堡 X 圖示 ─────────────────────────────────── */
.icon-x {
    display: none;
    position: relative;
    width: 24px;
    height: 24px;
}

.icon-x span {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background-color: var(--heading);
    border-radius: 2px;
}

.icon-x span:first-child {
    transform: translate(-50%, -50%) rotate(45deg);
}

.icon-x span:last-child {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* ✅ NEW ── 手機選單面板 ─────────────────────────────────── */
.mobile-menu-panel {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0 1rem;
}

/* ✅ NEW ── 手機導航連結 ─────────────────────────────────── */
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-decoration: none;
}

.mobile-nav-link:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.mobile-nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* ✅ NEW ── 手機選單電話 ─────────────────────────────────── */
.mobile-menu-phone {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.mobile-phone-link {
    color: var(--primary) !important;
    font-weight: 600 !important;
}

.mobile-phone-link:hover {
    background: var(--primary-light) !important;
}

/* ── Logo ────────────────────────────────────────────────── */
.site-logo {
    display: block;
    width: 22rem;
    max-width: min(22rem, calc(100vw - 7rem));
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .site-logo {
        max-width: 22rem;
    }
}

.site-logo-footer {
    display: block;
    width: 14rem;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* ── 按鈕 ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(18, 171, 202, 0.35);
}

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.btn-white {
    background: #fff;
    color: var(--primary);
    border: 2px solid #fff;
}

.btn-white:hover {
    background: transparent;
    color: #fff;
    transform: translateY(-2px);
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.0625rem;
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.8125rem;
}

/* ── Banner 輪播 ─────────────────────────────────────────── */
.slider-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.slider-item {
    display: none;
    animation: sliderFade 0.6s ease-in-out;
}

.slider-item.active {
    display: block;
}

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

.slider-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 21/9;
}

@media (max-width: 767px) {
    .slider-item img {
        aspect-ratio: 16/9;
    }
}

.slider-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.slider-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.slider-dot:hover {
    background: var(--primary-dark);
}

/* 左右箭頭 */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.slider-arrow:hover {
    background: #fff;
    box-shadow: var(--shadow-md);
}

.slider-arrow.prev { left: 12px; }
.slider-arrow.next { right: 12px; }

@media (max-width: 767px) {
    .slider-arrow { display: none; }
}

/* ── 卡片 ────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.card-img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
}

.card-body {
    padding: 1.25rem;
}

/* ── 區塊共用 ────────────────────────────────────────────── */
.section {
    padding: clamp(2.5rem, 6vw, 5rem) 0;
}

.section-alt {
    background: var(--bg-section);
}

.section-title {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    font-size: 1.0625rem;
}

/* ── CMS 內容區 (Summernote 輸出) ────────────────────────── */
.cms-content {
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.cms-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
}

.cms-content h3 {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

.cms-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.cms-content p {
    margin-bottom: 1rem;
}

.cms-content ul, .cms-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.cms-content li {
    margin-bottom: 0.375rem;
}

.cms-content img {
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.cms-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text);
    font-style: italic;
}

.cms-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.cms-content th, .cms-content td {
    border: 1px solid var(--border);
    padding: 0.625rem 0.875rem;
    text-align: left;
}

.cms-content th {
    background: var(--bg-light);
    font-weight: 600;
}

.cms-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cms-content a:hover {
    color: var(--primary-dark);
}

/* ── Blog 列表 ───────────────────────────────────────────── */
.blog-card .card-img {
    aspect-ratio: 16/10;
}

.blog-card .blog-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.blog-card .blog-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card .blog-excerpt {
    font-size: 0.9375rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-category-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.blog-category-badge:hover {
    background: var(--primary);
    color: #fff;
}

/* ── 表單 ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
    color: var(--heading);
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    transition: var(--transition);
    color: var(--text);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 171, 202, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--error);
    margin-top: 0.25rem;
}

/* ── WhatsApp 浮動按鈕 ───────────────────────────────────── */
.whatsapp-float {
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 60;
    width: 56px;
    height: 56px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    transition: var(--transition);
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.whatsapp-float svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

/* 脈動動畫 */
.whatsapp-float::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.4);
    animation: whatsappPulse 2s ease-out infinite;
}

@keyframes whatsappPulse {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    background: #111827;
    color: #d1d5db;
}

.site-footer a {
    color: #d1d5db;
    transition: var(--transition);
}

.site-footer a:hover {
    color: var(--primary);
}

.footer-heading {
    color: #fff;
    font-weight: 600;
    font-size: 1.0625rem;
    margin-bottom: 1rem;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding: 1.25rem 0;
    font-size: 0.8125rem;
    color: #9ca3af;
    text-align: center;
}

/* ── 麵包屑 Breadcrumb ──────────────────────────────────── */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    padding: 1rem 0;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    color: #d1d5db;
}

/* ── 返回頂部 ────────────────────────────────────────────── */
.back-to-top {
    position: fixed;
    right: 16px;
    bottom: 88px;
    z-index: 55;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    box-shadow: var(--shadow-sm);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ── 頁面 Hero ───────────────────────────────────────────── */
.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: clamp(2rem, 5vw, 4rem) 0;
    text-align: center;
}

.page-hero h1 {
    color: #fff;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
}

/* ── 響應式修正 ──────────────────────────────────────────── */
@media (max-width: 767px) {
    .section {
        padding: 2rem 0;
    }

    .section-title {
        font-size: 1.375rem;
    }

    .cms-content h2 {
        font-size: 1.375rem;
    }

    .cms-content h3 {
        font-size: 1.125rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }
}

/* ── 列印 ────────────────────────────────────────────────── */
@media print {
    .site-header, .site-footer, .whatsapp-float, .back-to-top { display: none !important; }
    body { color: #000; background: #fff; }
    a { color: #000; text-decoration: underline; }
}