/**
 * templates/igg/common.css
 * igG 企業風格主題 - 通用 CSS 樣式
 * 包含基礎樣式、導航選單樣式等共用 CSS
 */

/* 基礎樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft JhengHei", sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    overflow-x: hidden;
}

body.menu-open {
    overflow: hidden;
}

/* 頂部導航區域 */
.header-container {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-section h1 {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0;
}

.logo-section .subtitle {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 400;
}

.tagline {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

/* 導航選單樣式 */
.main-nav {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 10px;
}

.main-nav ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 8px 8px;
    padding: 0;
    margin: 0;
    align-items: center;
}

.main-nav li a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8em;
    padding: 6px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.main-nav li a:hover {
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.main-nav li a.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

/* 漢堡選單 */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 35px;
    height: 35px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* 手機版選單 */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    z-index: 1001;
    padding: 30px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li a {
    color: white;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: 500;
    padding: 15px;
    border-radius: 10px;
    display: block;
    text-align: center;
    transition: background 0.3s ease;
}

.mobile-menu li a:hover {
    background: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

.mobile-menu li a.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

.mobile-menu .close-btn {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

/* 頁尾樣式 */
footer {
    background: #1e3a8a;
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-top: 60px;
}

footer p {
    font-size: 0.9em;
    opacity: 0.8;
}

/* 主要內容區域 - 通用樣式 */
.main-content {
    max-width: 1200px;
    margin: 150px auto 40px auto;
    padding: 0 20px;
}

/* 頁面通用樣式 */
.page-header {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2.5em;
    color: #1e3a8a;
    margin-bottom: 15px;
    font-weight: 700;
}

.page-header .subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.page-header .meta {
    color: #666;
    font-size: 0.9em;
}

.page-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.page-content h2 {
    color: #1e3a8a;
    margin: 30px 0 15px 0;
    font-size: 1.8em;
}

.page-content p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.page-content ul, .page-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.page-content li {
    margin-bottom: 10px;
}

.page-content a {
    color: #3b82f6;
    text-decoration: none;
}

.page-content a:hover {
    text-decoration: underline;
}

/* 內容區媒體與表格（避免手機橫向溢出） */
.page-content img,
.page-content video,
.page-content iframe,
.article-detail-content img,
.article-detail-content video,
.article-detail-content iframe {
    max-width: 100%;
    height: auto;
}

.page-content table,
.article-detail-content table {
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    background: white;
    margin: 20px 0;
    -webkit-overflow-scrolling: touch;
}

.page-content table,
.article-detail-content table {
    display: inline-table;
    min-width: 100%;
}

.page-content table thead,
.article-detail-content table thead {
    display: table-header-group;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.page-content table th,
.article-detail-content table th {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    font-weight: 600;
    border: 1px solid #0d47a1;
    padding: 12px 15px;
    text-align: left;
}

.page-content table td,
.article-detail-content table td {
    border: 1px solid #e5e7eb;
    padding: 12px 15px;
}

.page-content table tbody tr:nth-child(odd),
.article-detail-content table tbody tr:nth-child(odd) {
    background: #f9fafb;
}

.page-content table tbody tr:hover,
.article-detail-content table tbody tr:hover {
    background: #e0f2fe;
    transition: background 0.2s ease;
}

.page-content pre,
.article-detail-content pre {
    overflow-x: auto;
    word-break: break-word;
    white-space: pre-wrap;
}

/* 篩選區域樣式 */
.filter-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.filter-header {
    font-size: 1.3em;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.filter-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.filter-item select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-item select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.current-filter {
    background: #e0f2fe;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #3b82f6;
}

.current-filter span {
    color: #1e3a8a;
    font-weight: 500;
}

.clear-filter {
    background: #3b82f6;
    color: white;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-filter:hover {
    background: #1e40af;
}

/* 文章/產品卡片樣式 */
.article-grid, .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.article-card, .product-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.article-card:hover, .product-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.article-header, .product-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 20px;
}

.article-header h2, .product-header h2 {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 10px;
}

.article-header h2 a, .product-header h2 a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.article-header h2 a:hover, .product-header h2 a:hover {
    opacity: 0.8;
}

.article-meta, .product-meta {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.article-meta .category, .product-meta .category {
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 8px;
}

.article-meta .date, .product-meta .price {
    color: #666;
    font-size: 0.85em;
}

.article-content, .product-content {
    padding: 20px;
}

.article-excerpt, .product-excerpt {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 15px;
}

.article-tags, .product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.article-tag, .product-tag {
    background: #f3f4f6;
    color: #666;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    transition: all 0.3s ease;
}

.article-tag:hover, .product-tag:hover {
    background: #3b82f6;
    color: white;
    text-decoration: none;
}

.article-footer, .product-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.article-footer .read-more, .product-footer .read-more {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.article-footer .read-more:hover, .product-footer .read-more:hover {
    color: #1e40af;
    text-decoration: none;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.empty-state h3 {
    color: #666;
    margin-bottom: 15px;
}

.empty-state p {
    color: #999;
}

/* 文章詳情頁樣式 */
.article-detail-header {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.article-detail-header h1 {
    font-size: 2.5em;
    color: #1e3a8a;
    margin-bottom: 20px;
    font-weight: 700;
}

.article-detail-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.article-detail-content h2 {
    color: #1e3a8a;
    margin: 30px 0 15px 0;
    font-size: 1.8em;
}

.article-detail-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.article-detail-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.article-detail-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.back-link {
    display: inline-block;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #1e40af;
    text-decoration: none;
}

.article-footer {
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.article-footer .article-tags {
    margin-top: 15px;
}

/* 聯絡我們頁面 */
.contact-hero-tag {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 12px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 25px;
    align-items: start;
}

.contact-form-wrapper {
    background: #f9fafb;
    border-radius: 10px;
    padding: 25px;
    border: 1px solid #e5e7eb;
}

.contact-form .form-group {
    margin-bottom: 1.25rem;
}

.contact-form label {
    display: block;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 8px;
}

.contact-form .required {
    color: #dc2626;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    background: white;
    transition: all 0.3s ease;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.contact-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.contact-form .hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-form .form-hint {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 6px;
}

.contact-form .form-privacy {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #f3f4f6;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #666;
    font-size: 0.9rem;
}

.contact-form .form-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.contact-form .form-submit:hover {
    opacity: 0.92;
}

.contact-form .form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.contact-form .form-warning {
    margin-top: 15px;
    padding: 15px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 8px;
}

.contact-form-success {
    text-align: center;
    padding: 20px 0;
}

.contact-form-success .success-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.contact-form-success h2 {
    color: #1e3a8a;
    margin-bottom: 15px;
}

.contact-form-success p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 10px;
}

.contact-form-success .success-note {
    color: #d97706;
    font-style: italic;
    margin: 20px 0;
}

.contact-form-success .back-home {
    display: inline-block;
    margin-top: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

.contact-info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-info-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e5e7eb;
}

.contact-info-card .info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.contact-info-card h3 {
    color: #1e3a8a;
    font-size: 1.1em;
    margin: 0;
}

.contact-info-card p {
    color: #666;
    line-height: 1.7;
    margin-bottom: 8px;
}

.contact-info-card .email-link {
    color: #3b82f6;
    font-weight: 600;
    word-break: break-all;
}

.contact-info-card .info-signature {
    color: #d97706;
    font-style: italic;
}

.contact-info-card.info-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-info-card.info-links li {
    margin-bottom: 10px;
}

.contact-info-card.info-links a {
    color: #666;
    text-decoration: none;
}

.contact-info-card.info-links a:hover {
    color: #3b82f6;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
        position: absolute;
        top: 12px;
        right: 15px;
        z-index: 2;
    }

    .main-nav {
        display: none;
    }

    .header-container {
        padding: 14px 0;
    }

    .header-content {
        padding: 0 15px;
    }

    .header-top {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 0;
        padding-right: 48px;
        align-items: flex-start;
    }

    .logo-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .logo-section h1 {
        font-size: 1.25em;
        line-height: 1.25;
    }

    .logo-section .subtitle {
        font-size: 0.8em;
    }

    .tagline {
        display: none;
    }

    .main-content {
        margin-top: 108px;
        margin-bottom: 24px;
        padding: 0 15px;
    }

    .mobile-menu {
        z-index: 1002;
    }

    .page-header, .page-content, .article-detail-header, .article-detail-content {
        padding: 22px 18px;
    }

    .page-header h1, .article-detail-header h1 {
        font-size: 1.65em;
        line-height: 1.3;
    }

    .page-header .subtitle {
        font-size: 1em;
    }

    .page-content h2, .article-detail-content h2 {
        font-size: 1.35em;
    }

    .filter-section {
        padding: 18px;
    }

    .filter-row {
        flex-direction: column;
        gap: 15px;
    }

    .filter-item {
        min-width: 0;
        flex: 1 1 100%;
    }

    .current-filter {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .current-filter span {
        word-break: break-word;
    }

    .article-grid, .product-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .article-header h2, .product-header h2 {
        font-size: 1.05em;
    }

    .article-meta, .product-meta {
        padding: 12px 16px;
    }

    .article-content, .product-content {
        padding: 16px;
    }

    footer {
        padding: 28px 15px;
        margin-top: 40px;
    }

    .article-footer {
        padding: 18px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .contact-form-wrapper {
        padding: 18px;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 12px;
    }

    .main-content {
        margin-top: 95px;
        padding: 0 12px;
    }

    .page-header, .page-content, .article-detail-header, .article-detail-content {
        padding: 18px 14px;
    }

    .page-header h1, .article-detail-header h1 {
        font-size: 1.4em;
    }

    .page-content ul, .page-content ol,
    .article-detail-content ul, .article-detail-content ol {
        padding-left: 22px;
    }

    .article-header h2, .product-header h2 {
        font-size: 1em;
    }

    .mobile-menu li a {
        font-size: 1.05em;
        padding: 12px;
    }
}