/**
 * CFN-TW 奇楠沉香網站樣式
 * 設計理念：自然禪意 × 高端奢華
 */

/* =====================================================
   變數設定
   ===================================================== */
:root {
    /* 主色調 */
    --primary: #3D2B1F;
    --primary-light: #5D4B3F;
    --primary-dark: #2D1B0F;
    
    /* 次要色 */
    --secondary: #2D5016;
    --secondary-light: #4D7026;
    --secondary-dark: #1D3016;
    
    /* 強調色 */
    --accent: #C9A962;
    --accent-light: #D9C982;
    --accent-dark: #8B6914;
    
    /* 背景色 */
    --light: #F5F0E8;
    --light-gray: #E8E4DE;
    --white: #FFFFFF;
    
    /* 文字色 */
    --dark: #1A1A1A;
    --gray: #6C757D;
    --light-text: #999999;
    
    /* 功能色 */
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    /* 陰影 */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    /* 圓角 */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    
    /* 過渡 */
    --transition: all 0.3s ease;
}

/* =====================================================
   基礎設定
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
}

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

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

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

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* =====================================================
   通用容器
   ===================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 800px;
}

.container-lg {
    max-width: 1400px;
}

/* =====================================================
   Header 導航列 - 與 Footer 統一配色
   ===================================================== */
.header {
    background: var(--primary);
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

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

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

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
}

.logo-text span {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    font-weight: 400;
}

.nav {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-link {
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    padding: 8px 0;
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

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

.nav-buttons {
    display: flex;
    gap: 10px;
}

/* Header 登入/註冊按鈕 */
.header .nav-buttons .btn-outline {
    border-color: rgba(255,255,255,0.5);
    color: rgba(255,255,255,0.9);
}

.header .nav-buttons .btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--white);
    color: var(--white);
}

.header .nav-buttons .btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--primary-dark);
}

.header .nav-buttons .btn-primary:hover {
    background: #e6ad00;
    border-color: #e6ad00;
}

.mobile-menu-btn {
    display: none;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--white);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* =====================================================
   Hero 區塊
   ===================================================== */
.hero {
    height: 100vh;
    min-height: 600px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/assets/images/wood-texture.png') repeat;
    opacity: 0.1;
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: 20px;
}

.hero h1 {
    font-size: 3.5rem;
    color: var(--white);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =====================================================
   按鈕
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-primary:hover {
    background: var(--accent-dark);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background: var(--white);
    color: var(--primary);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* =====================================================
   卡片
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.card-text {
    color: var(--gray);
    margin-bottom: 15px;
}

/* =====================================================
   區塊標題
   ===================================================== */
.section {
    padding: 80px 0;
}

.section-dark {
    background: var(--primary);
    color: var(--white);
}

.section-dark h2,
.section-dark h3 {
    color: var(--white);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    margin-bottom: 15px;
}

.section-header p {
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto;
}

.section-dark .section-header p {
    color: rgba(255,255,255,0.8);
}

/* =====================================================
   格狀佈局
   ===================================================== */
.grid {
    display: grid;
    gap: 30px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* =====================================================
   特色卡片
   ===================================================== */
.feature-card {
    text-align: center;
    padding: 40px 30px;
    background: var(--white);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.feature-card h3 {
    margin-bottom: 15px;
}

.feature-card p {
    color: var(--gray);
}

/* =====================================================
   樹木卡片
   ===================================================== */
.tree-card {
    position: relative;
    overflow: hidden;
}

.tree-card .card-img {
    height: 250px;
}

.tree-status {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tree-status.available {
    background: var(--success);
    color: var(--white);
}

.tree-status.adopted {
    background: var(--info);
    color: var(--white);
}

.tree-meta {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.875rem;
    color: var(--gray);
}

.tree-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =====================================================
   表單
   ===================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--light-gray);
    border-radius: var(--radius);
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.2);
}

.form-control.error {
    border-color: var(--danger);
}

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 5px;
}

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

/* =====================================================
   提示訊息
   ===================================================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* =====================================================
   管理員後台
   ===================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--light);
}

.admin-sidebar {
    width: 260px;
    background: var(--primary);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.admin-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-sidebar-header h3 {
    color: var(--white);
    font-size: 1.1rem;
}

.admin-nav {
    padding: 20px 0;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.admin-nav a i {
    width: 20px;
    text-align: center;
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--light-gray);
}

.admin-header h1 {
    font-size: 1.75rem;
}

.admin-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-card h4 {
    color: var(--gray);
    font-size: 0.875rem;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card.accent .value {
    color: var(--accent);
}

/* =====================================================
   會員專區
   ===================================================== */
.member-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 40px;
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
}

.member-header h2 {
    color: var(--white);
    margin-bottom: 10px;
}

.member-stats {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.member-stat {
    text-align: center;
}

.member-stat .number {
    font-size: 2rem;
    font-weight: 700;
}

.member-stat .label {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* =====================================================
   表格
   ===================================================== */
.table-wrapper {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
}

.table tr:hover {
    background: rgba(0,0,0,0.02);
}

.table-actions {
    display: flex;
    gap: 5px;
}

/* =====================================================
   分頁
   ===================================================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--dark);
    border: 1px solid var(--light-gray);
}

.pagination a:hover {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

.pagination .active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
    background: var(--primary);
    color: var(--white);
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer h4 {
    color: var(--white);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer p,
.footer a {
    color: rgba(255,255,255,0.7);
    line-height: 2;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    font-size: 0.875rem;
}

/* =====================================================
   載入動畫
   ===================================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   響應式設計
   ===================================================== */
@media (max-width: 1200px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    .nav {
        position: fixed;
        top: 74px;
        left: 0;
        right: 0;
        background: var(--primary);
        flex-direction: column;
        padding: 20px;
        gap: 0;
        box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }
    
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        font-size: 1rem;
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .nav-buttons {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255,255,255,0.1);
        justify-content: center;
    }
    
    .nav-buttons .btn {
        flex: 1;
        text-align: center;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    /* Logo 平板尺寸 */
    .logo-img,
    .logo img {
        height: 40px;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        text-align: left;
        gap: 20px;
    }
    
    .footer-grid > div:first-child {
        grid-column: 1 / -1;
        text-align: center;
    }
    
    .footer-grid > div:nth-child(4) {
        grid-column: 1 / -1;
    }
    
    .member-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .section {
        padding: 50px 0;
    }
}

@media (max-width: 576px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    
    .container {
        padding: 0 15px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .hero {
        min-height: 500px;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    /* Logo 手機尺寸 */
    .logo-img,
    .logo img {
        height: 35px;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
    
    .table {
        min-width: 600px;
    }
}

/* =====================================================
   工具類別
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.hidden { display: none; }
.visible { visibility: visible; }

/* 圖示字體 */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* Footer Logo */
.footer-logo {
    height: 60px;
    width: auto;
    margin-bottom: 15px;
}

/* Footer 連結圖示 */
.footer p i {
    width: 20px;
    color: var(--accent);
}

/* 數據統計區塊 */
.stats-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 50px 0;
    position: relative;
}

.stats-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.stats-card {
    text-align: center;
    padding: 25px 15px;
    position: relative;
}

.stats-card:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background: rgba(201, 169, 98, 0.3);
}

.stats-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.stats-value {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 5px;
    font-family: 'Noto Serif TC', serif;
    letter-spacing: 2px;
}

.stats-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .stats-section {
        padding: 40px 20px;
    }
    
    .stats-value {
        font-size: 2.2rem;
    }
    
    .stats-card:not(:last-child)::after {
        display: none;
    }
    
    .stats-card {
        border-bottom: 1px solid rgba(201, 169, 98, 0.2);
        padding-bottom: 30px;
    }
    
    .stats-card:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
}
