/* ============================================ */
/* OurLuvPhoto 共用元件層                          */
/* Tailwind 的 components 層為空（見 Styles/       */
/* tailwind.src.css），按鈕／卡片／警示／表單控制     */
/* 各頁面原本有 18 種以上寫法，此檔案收斂為單一規格。  */
/* 色彩沿用 tailwind.config.js 的品牌 token。         */
/* ============================================ */

:root {
    --brand-primary: #526348;
    --brand-primary-hover: #454f3e;
    --brand-primary-tint: #5263480f;
    --brand-accent: #35482D;
    --brand-dark: #30392F;
    --brand-secondary: #E9EDE5;
    --brand-line: #e3e7dc;
    --brand-paper: #f1f3ec;

    /* 焦點環全站唯一色彩（contrast ≥ 3:1 against paper） */
    --focus-ring: #526348;

    /* 文字灰階：gray-500 以起為主，避免低對比小字 */
    --text-muted: #5c6558;
    --text-subtle: #6b7280;
}

/* ---------------- 焦點（單一規格） ---------------- */
/* 全站只此一處 focus-visible；移除各檔案的重複覆寫 */
:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------------- 頁面骨架 ---------------- */
/* 統一流程頁背景與垂直留白；取代各頁 min-h-screen + gradient + py-12 組合 */
.page-shell {
    min-height: 100%;
    padding: 3rem 1rem;
    background: var(--brand-paper);
}

/* 統一容器寬度（取代 3xl～7xl 混用） */
.container-flow {
    max-width: 64rem;
    margin: 0 auto;
}

.container-flow-wide {
    max-width: 72rem;
    margin: 0 auto;
}

.container-flow-narrow {
    max-width: 48rem;
    margin: 0 auto;
}

/* ---------------- 卡片 ---------------- */
.card {
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(48, 57, 47, .06);
    padding: 1.5rem;
}

.card-tight {
    padding: 1rem;
}

.card-loose {
    padding: 2rem;
}

/* ---------------- 按鈕 ---------------- */
/* 單一規格：px-6 py-3 / rounded-xl / 文字粗體 / hover 加深 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: .75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: .75rem;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-primary-hover);
}

.btn-secondary {
    background: #fff;
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--brand-primary-tint);
}

.btn-ghost {
    background: transparent;
    color: var(--brand-primary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--brand-primary-tint);
}

.btn-danger {
    background: #b91c1c;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #991b1b;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: .4rem .9rem;
    font-size: .8125rem;
}

/* 停用狀態：降低透明度並關閉游標回饋，與「為何不能送出」文案搭配 */
.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------------- 狀態徽章 ---------------- */
/* 取代各頁面原本 12 種各自為政的 rounded-full 狀態標籤 */
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: .15rem .55rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}

.badge-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}

.badge-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.badge-info {
    background: var(--brand-secondary);
    border-color: var(--brand-line);
    color: var(--brand-dark);
}

.badge-neutral {
    background: #f3f4f1;
    border-color: var(--brand-line);
    color: var(--text-muted);
}
/* ---------------- 警示訊息 ---------------- */
/* 取代 12 種各自為政的紅框寫法 */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid;
    border-radius: .75rem;
    font-size: .875rem;
    line-height: 1.7;
}

.alert::before {
    font-size: 1rem;
    line-height: 1.5;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-error::before { content: "\2716"; }

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}

.alert-success::before { content: "\2714"; }

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #78350f;
}

.alert-warning::before { content: "\26A0"; }

.alert-info {
    background: var(--brand-secondary);
    border-color: var(--brand-line);
    color: var(--brand-dark);
}

.alert-info::before { content: "\2139"; }

/* ---------------- 表單控制 ---------------- */
.form-control {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: .625rem .875rem;
    border: 1px solid #cbd5c0;
    border-radius: .625rem;
    background: #fff;
    color: var(--brand-dark);
    font-size: .9375rem;
    line-height: 1.5;
}

.form-control::placeholder {
    color: #9aa39a;
}

/* ---------------- 步驟指示 ---------------- */
/* 44px 觸控高度；WCAG AA 對比 */
.step-indicator {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-bottom: 2rem;
    font-size: .875rem;
}

.step-sep {
    color: #9aa39a;
}

.step-pill {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: .4rem .9rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    font-weight: 500;
}

.step-done {
    background: var(--brand-secondary);
    border-color: var(--brand-line);
    color: var(--brand-dark);
}

a.step-done:hover {
    background: #dde3d5;
    border-color: var(--brand-primary);
}

.step-current {
    background: var(--brand-primary);
    color: #fff;
    font-weight: 700;
}

.step-todo {
    background: #f3f4f1;
    border-color: var(--brand-line);
    color: var(--text-muted);
}

/* ---------------- 可選卡片（catalog / 選片） ---------------- */
/* 選中狀態統一為品牌綠 primary，不再 primary / accent 兩種綠並存 */
.card-option {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 2px solid var(--brand-line);
    border-radius: .75rem;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.card-option:hover:not(:disabled) {
    border-color: var(--brand-primary);
}

.card-option[data-selected="true"] {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-tint);
}

/* 以實際比例顯示照片，避免方形硬裁切掉頭腳 */
.card-option-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

.card-option-mark {
    position: absolute;
    top: .5rem;
    right: .5rem;
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    background: var(--brand-primary);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

.card-option[data-selected="true"] .card-option-mark {
    display: flex;
}

.card-option:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ---------------- 文字工具 ---------------- */
/* 取代 text-gray-400（對比 2.5:1）與 text-gray-300（1.6:1） */
.text-muted {
    color: var(--text-muted);
}

.text-subtle {
    color: var(--text-subtle);
}

/* 訊息字級下限：10px 中文字在行動裝置不可讀 */
.text-label {
    font-size: .8125rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* ---------------- SweetAlert2 主題化 ---------------- */
/* 為配合本站 nonce 式 CSP，SweetAlert2 改載「不注入 <style>」的版本，
   因此彈窗維持預設白底灰字。此處以品牌色覆寫，讓錯誤／成功提示與頁面一致。 */
.swal2-popup {
    background: #fff;
    border-radius: .75rem;
    border-top: 4px solid var(--brand-primary);
    font-family: "Noto Sans TC", system-ui, sans-serif;
    font-size: .9375rem;
    color: var(--brand-dark);
}

.swal2-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.swal2-html-container {
    color: var(--text-muted);
    line-height: 1.8;
}

.swal2-icon {
    color: var(--brand-primary);
}

.swal2-icon-error {
    color: #b91c1c;
}

.swal2-icon-success {
    color: var(--brand-primary);
}

.swal2-icon-warning {
    color: #b45309;
}

.swal2-confirm,
.swal2-deny,
.swal2-cancel {
    min-height: 44px;
    border-radius: .625rem;
    font-weight: 700;
    box-shadow: none;
}

.swal2-confirm {
    background: var(--brand-primary) !important;
    color: #fff !important;
}

.swal2-cancel {
    background: #fff !important;
    color: var(--brand-primary) !important;
    border: 1px solid var(--brand-primary) !important;
}

.swal2-deny {
    background: #b91c1c !important;
    color: #fff !important;
}
/* ---------------- 法遵條款頁 ---------------- */
/* 服務條款、隱私權政策共用：長文閱讀需要放寬行高與明確的章節層級，
   法遵文字密度高，字級下限與行高都比一般行銷頁面更保守。 */
.legal-page {
    padding-bottom: 4rem;
}

.legal-breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.5rem;
    font-size: .8125rem;
    color: var(--text-muted);
}

.legal-breadcrumb a {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-header {
    padding-bottom: 1.75rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--brand-line);
}

.legal-header .section-kicker {
    margin-bottom: .5rem;
}

.legal-updated {
    margin-top: .75rem;
    font-size: .8125rem;
    color: var(--text-muted);
}

.legal-section {
    margin-bottom: 2.75rem;
}

.legal-section > h2 {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--brand-dark);
}

.legal-section > h2 > .legal-num {
    flex-shrink: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: #879576;
}

.legal-section > h3 {
    margin: 1.5rem 0 .5rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.6;
    color: var(--brand-dark);
}

.legal-section p,
.legal-section li {
    font-size: .9375rem;
    line-height: 2;
    color: var(--text-muted);
}

.legal-section p + p {
    margin-top: .85rem;
}

.legal-section ul,
.legal-section ol {
    margin: .85rem 0;
    padding-left: 1.35rem;
}

.legal-section li + li {
    margin-top: .4rem;
}

.legal-section a {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-section strong {
    font-weight: 700;
    color: var(--brand-dark);
}

/* 條款頁的重點提示框（例：AI 生成免責、已明確告知事項） */
.legal-note {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-left: 3px solid var(--brand-primary);
    border-radius: .5rem;
    font-size: .875rem;
    line-height: 1.9;
    color: var(--text-muted);
}

.legal-note > strong {
    display: block;
    margin-bottom: .35rem;
    font-size: .9375rem;
    color: var(--brand-dark);
}

/* 條款頁的目錄（長文錨點導覽） */
.legal-toc {
    margin-bottom: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: .75rem;
}

.legal-toc h2 {
    margin-bottom: .75rem;
    font-size: .9375rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.legal-toc ol {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: .35rem 1.5rem;
    padding-left: 1.35rem;
    margin: 0;
    font-size: .875rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.legal-toc a {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--brand-line);
}

.legal-footer p {
    font-size: .875rem;
    line-height: 1.9;
    color: var(--text-muted);
}

.legal-footer a {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 767px) {
    .legal-page {
        padding-bottom: 2.5rem;
    }

    .legal-section {
        margin-bottom: 2rem;
    }

    .legal-section p,
    .legal-section li {
        font-size: .9375rem;
        line-height: 1.9;
    }
}

/* ---------------- Skeleton ---------------- */
/* 清單載入中的骨架 placeholder，避免整頁只有「載入中…」三個字 */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e9ede5;
    border-radius: .75rem;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, #ffffffb8, transparent);
    animation: skeleton-sweep 1.4s infinite;
}

@keyframes skeleton-sweep {
    100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton::after { animation: none; }
}