/**
 * ToolHub - 主要樣式
 * 參考 FengLeo 設計風格
 */

:root {
    --primary-color: #e74c3c;
    --primary-dark: #c0392b;
    --secondary-color: #2c3e50;
    --bg-light: #f8f9fa;
    --text-dark: #333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
    --radius: 10px;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.7;
}

/* 導覽列 */
.navbar {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.navbar-brand {
    font-size: 1.4rem;
    letter-spacing: 1px;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
}

.nav-link:hover {
    transform: translateY(-1px);
}

/* 「線上工具」mega-menu 下拉選單 */
.mega-dropdown {
    max-height: 75vh;
    overflow-y: auto;
    padding: 1.25rem;
}

@media (min-width: 1200px) {
    .mega-dropdown {
        width: min(880px, calc(100vw - 3rem));
        column-count: 3;
        column-gap: 1.75rem;
        border-radius: var(--radius);
        box-shadow: var(--shadow-hover);
    }
}

.mega-col-group {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 0.5rem;
}

.mega-dropdown .dropdown-header {
    color: var(--primary-color);
    font-weight: 700;
    padding-left: 0.5rem;
    margin-top: 0.5rem;
}

.mega-dropdown .dropdown-item {
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.92rem;
}

.mega-dropdown .dropdown-item:hover {
    background-color: rgba(231, 76, 60, 0.08);
    color: var(--primary-color);
}

/* 選單本身很長時，捲動軸細一點比較不搶眼 */
.mega-dropdown::-webkit-scrollbar {
    width: 6px;
}
.mega-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* 卡片樣式 */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    background: #fff;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* 按鈕 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    border-radius: 8px;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-radius: 8px;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Hero 區塊 */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-section h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* 搜尋框 */
.search-box {
    max-width: 600px;
    margin: 2rem auto 0;
    position: relative;
    z-index: 1;
}

.search-box .form-control {
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 1rem;
}

.search-box .btn {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    border-radius: 50px;
}

/* 工具卡片 */
.tool-card {
    border: none;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    background: #fff;
    height: 100%;
}

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

.tool-card .icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.tool-card h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
}

.tool-card .access-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* 分類標籤 */
.category-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: var(--transition);
    margin: 0.25rem;
}

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

/* 工具頁面通用 */
.tool-container {
    max-width: 900px;
    margin: 0 auto;
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h2 {
    font-weight: 700;
    color: var(--secondary-color);
}

.tool-header .icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

/* 文字區域 */
.tool-textarea {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
    width: 100%;
    min-height: 150px;
}

.tool-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
    outline: none;
}

/* 結果區域 */
.result-box {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    position: relative;
}

.result-box .copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* 統計卡片 */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

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

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.8rem;
    font-size: 1.3rem;
    color: #fff;
}

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

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 頁尾 */
footer {
    background: var(--secondary-color) !important;
}

footer a:hover {
    color: #fff !important;
}

/* 響應式 */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section {
        padding: 3rem 0 2.5rem;
    }
    
    .tool-card {
        margin-bottom: 1rem;
    }
}

/* 動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

/* Toast 通知 */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

/* Loading */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
}

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