/* 共用樣式 */
:root {
    --primary-color: #60a5fa;
    --secondary-color: #93c5fd;
    --accent-color: #fcd34d;
    --text-primary: #374151;
    --text-secondary: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.courses-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0rem 0rem;
}

.hero {
  width: 100%;
  height: 240px; /* ✅ 改小高度 */
  display: flex;
  justify-content: center;
  align-items: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom-left-radius: 60px;
  border-bottom-right-radius: 60px;
  overflow: hidden;
}


.hero::before {
  content: "";
  display: block;
  width: 100%;
  max-width: 1200px; /* ✅ 控制左右不滿版 */
  height: 100%;
}



.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--text-primary);
    font-weight: 700;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.course-card {
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.course-image {
    width: 100%;
    height: 250px;
    background: var(--secondary-color);
}

.course-content {
    padding: 2rem;
}

.course-category {
    display: inline-block;
    background: #ff7200;
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.course-title {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    font-weight: 700;
}

.course-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.course-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.course-duration {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enroll-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.enroll-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.4);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
}

.modal-content {
    background: white;
    max-width: 800px;
    margin: 5% auto;
    padding: 2.5rem;
    border-radius: 16px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--text-primary);
}
/* 分類側邊欄樣式 */
        .main-container {
            display: flex;
            gap: 2rem;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 1rem;
        }

        .category-sidebar {
            flex: 0 0 240px;
            background: #ffffff;
            border-radius: 16px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            padding: 1.5rem;
            height: fit-content;
            position: sticky;
            top: 2rem;
            border: 1px solid #f0f0f0;
        }

        .category-sidebar h3 {
            margin: 0 0 1.25rem 0;
            font-size: 1.25rem;
            font-weight: 700;
            color: #2c3e50;
            padding-bottom: 0.75rem;
            border-bottom: 2px solid #3498db;
        }

        .category-list {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .category-item {
            margin-bottom: 0.5rem;
        }

        .category-button {
            width: 100%;
            padding: 0.75rem 1rem;
            border: none;
            background: #f8f9fa;
            color: #555;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.95rem;
            font-weight: 500;
            transition: all 0.3s ease;
            text-align: left;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .category-button:hover {
            background: #e9f4ff;
            color: #3498db;
            transform: translateX(4px);
        }

        .category-button.active {
            background: #3498db;
            color: white;
            box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
        }

        .category-count {
            background: rgba(255, 255, 255, 0.2);
            padding: 0.25rem 0.5rem;
            border-radius: 12px;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .category-button.active .category-count {
            background: rgba(255, 255, 255, 0.3);
        }

        .courses-content {
            flex: 1;
            min-width: 0;
        }

        .filter-info {
            background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
            padding: 0.75rem 1.25rem;
            border-radius: 8px;
            margin-bottom: 1rem;
            border-left: 4px solid #3498db;
            box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
            border: 1px solid #e1f5fe;
            max-width: 400px;
            width: fit-content;
        }

        .filter-info h4 {
            margin: 0 0 0.25rem 0;
            color: #1976d2;
            font-size: 1rem;
            font-weight: 600;
        }

        .filter-info p {
            margin: 0;
            color: #546e7a;
            font-size: 0.9rem;
        }

        .clear-filter {
            background: #e74c3c;
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
            margin-top: 0.5rem;
            transition: background 0.3s ease;
        }

        .clear-filter:hover {
            background: #c0392b;
        }

        /* 手機版響應式 */
        .mobile-filter-toggle {
            display: none;
            width: 100%;
            padding: 1rem;
            background: #3498db;
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 1rem;
            cursor: pointer;
        }

        @media (max-width: 768px) {
            .main-container {
                flex-direction: column;
                gap: 1rem;
            }

            .category-sidebar {
                flex: none;
                position: static;
                display: none;
                order: -1;
            }

            .category-sidebar.mobile-visible {
                display: block;
            }

            .mobile-filter-toggle {
                display: block;
            }

            .courses-content {
                order: 1;
            }
        }

        /* 課程網格響應式調整 */
        .courses-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
            gap: 1.5rem;
        }

        @media (max-width: 768px) {
            .courses-grid {
                grid-template-columns: 1fr;
            }
        }
        /* 改善後的彈跳視窗樣式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    max-width: 500px;
    margin: 5% auto;
    padding: 1rem;
    border-radius: 16px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.1);
}

/* 手機版彈跳視窗專用樣式 */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }

    .modal-content {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding: 1rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .close-modal {
        position: fixed;
        top: 1rem;
        right: 1rem;
        font-size: 1.5rem;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.95);
        color: #333;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 1001;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .close-modal:hover {
        background: rgba(255, 255, 255, 1);
        transform: scale(1.05);
    }

    /* 手機版課程詳情佈局 */
    .course-modal-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        padding-top: 7rem !important;
        width: 100% !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }

    .course-modal-layout > div:first-child {
        flex: none !important;
        margin-bottom: 0;
        display: flex !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
        width: 100% !important;
        text-align: left !important;
        padding-left: 1rem !important;
    }

    .course-modal-layout img {
        width: auto !important;
        height: auto !important;
        max-height: 60vh !important;
        max-width: 100% !important;
        border-radius: 12px !important;
        object-fit: contain !important;
        margin: 0 !important;
        display: block !important;
    }

    .course-modal-layout > div:last-child {
        display: none !important;
    }
}

/* 平板版彈跳視窗樣式 */
@media (min-width: 769px) and (max-width: 1024px) {
    .modal-content {
        margin: 3% auto;
        max-width: 90%;
        padding: 2rem;
    }
}
