/* 響應式設計 - RWD */

/* 大螢幕尺寸 - 隱藏漢堡選單 */
@media (min-width: 1801px) {
    .hamburger-btn {
        display: none !important;
    }

    .nav-links {
        display: flex !important;
    }
}

/* 1170px 斷點 - 防止文字與 logo 重疊 */
@media (max-width: 1170px) {
    .nav-group:first-child {
        display: none;
    }
}

/* 中等螢幕尺寸 - 顯示漢堡選單 (1800px 以下) */
@media (max-width: 1800px) {
    .nav-links {
        display: none;
    }

    .hamburger-btn {
        display: flex;
        position: absolute;
        left: 20px;
        top: 0px;
    }

    .nav-logo {
        right: 60px;
    }
}

/* 平板尺寸 (768px - 1199px) */
@media (max-width: 1199px) {
    .container {
        padding: 0 var(--spacing-large);
    }

    .hero-title img {
        max-width: 90%;
    }

    .cards-grid {
        gap: var(--spacing-medium);
    }

    .feature-card {
        height: 350px;
    }

    .content-wrapper {
        gap: var(--spacing-large);
    }

    .location-details {
        gap: var(--spacing-large);
    }

    /* Description Section 平板版 */
    .description-section {
        height: auto;
        min-height: 70vh;
        padding: var(--spacing-xlarge) 0;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .section-title::after {
        width: 80%;
        max-width: 400px;
    }

    .section-subtitle {
        font-size: 1.5rem;
    }

    .section-text p {
        font-size: 1.3rem;
    }

    /* Hero Section 平板版 - 使用手機版圖片 */
    .hero-bg {
        content: url('../images/mb_kv.jpg');
        width: 100%;
        height: auto;
        display: block;
        object-fit: contain;
    }

    .hero {
        background: none;
        height: auto;
        min-height: auto;
        padding: 0;
        margin: 0;
    }

    /* 平板版導航調整 - 顯示漢堡選單 */
    .nav-text {
        display: block;
    }

    .nav-links {
        display: none;
    }

    .hamburger-btn {
        display: flex !important;
        position: absolute;
        left: 20px;
        top: 0px;
    }

    .hero-content {
        display: none;
    }

    /* Feature Section 平板版 */
    .intro-text p {
        font-size: 1.3rem;
        padding: 0 var(--spacing-medium);
    }

    .card-info .date {
        font-size: 2rem;
    }

    .card-info .date .day,
    .card-info .date .time {
        font-size: 1.4rem;
    }

    .card-info .location {
        font-size: 1.4rem;
    }

    .card-wrapper {
        gap: 1rem;
    }

    /* Footer 平板版 */
    .footer-content h2 {
        font-size: 2.2rem;
    }

    .footer-content h2::after {
        width: 280px;
    }

    .map-container {
        height: 350px;
    }

    .address-text p:first-child {
        font-size: 1.4rem;
    }

    .address-text p {
        font-size: 1rem;
    }

    .option-text h4 {
        font-size: 1.2rem;
    }

    .option-text p {
        font-size: 1rem;
    }

    /* Event Tabs & Schedule Section 平板版 - 2x2 網格布局 */
    .tab-navigation {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 10px;
        margin-top: -110px;
        margin-bottom: 10px;
        padding: 0 var(--spacing-medium);
        overflow: visible;
    }

    .tab-btn {
        font-size: 1rem;
        padding: 12px 10px;
        text-align: center;
        border-radius: 8px;
        min-width: auto;
        white-space: normal;
        line-height: 1.3;
        min-height: 65px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: 1px solid #888;
    }

    .event-header img {
        max-width: 600px;
    }

    .schedule-item .time {
        font-size: 1.1rem;
    }

    .item-content .title {
        font-size: 1.2rem;
    }

    .item-content .badge {
        font-size: 1rem;
    }

    .speaker-card img {
        width: 120px;
        height: 120px;
    }

    .speaker-info h4 {
        font-size: 1.4rem;
    }

    .speaker-info .title {
        font-size: 0.95rem;
    }

    /* 平板版講師輪播調整 */
    .speaker-card {
        flex: 0 0 calc(33.333% - (2 * var(--spacing-large) / 3));
    }
}

/* 小平板尺寸 (768px - 991px) */
@media (max-width: 991px) {
    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-small);
    }

    .sub-nav {
        font-size: 0.8rem;
    }

    .hero-subtitle {
        font-size: 1.3rem;
    }

    .hero-description h2 {
        font-size: 1.7rem;
    }

    .desc-subtitle {
        font-size: 1.1rem;
    }

    .tab-buttons {
        gap: var(--spacing-small);
    }

    .feature-section {
        padding: var(--spacing-xlarge) 0 calc(var(--spacing-xlarge) * 2) 0;
    }


    .content-wrapper {
        grid-template-columns: 1fr;
        gap: var(--spacing-xlarge);
    }

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

    .location-details {
        grid-template-columns: 1fr;
        gap: var(--spacing-large);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--spacing-medium);
        text-align: center;
    }

    /* Hero Section 小平板版 - 使用手機版圖片 */
    .hero-bg {
        content: url('../images/mb_kv.jpg');
        width: 100%;
        height: auto;
        display: block;
        object-fit: contain;
    }

    .hero {
        background: none;
        height: auto;
        min-height: auto;
        padding: 0;
        margin: 0;
    }

    /* 小平板版導航調整 - 顯示漢堡選單 */
    .nav-text {
        display: block;
    }

    .nav-links {
        display: none;
    }

    .hamburger-btn {
        display: flex !important;
        position: absolute;
        left: 20px;
        top: 0px;
    }

    .hero-content {
        display: none;
    }

    /* Feature Section 小平板版 */
    .cards-grid {
        gap: var(--spacing-medium);
    }

    .feature-card {
        height: auto;
        min-height: 250px;
    }

    .card-info {
        margin-top: -3rem;
        margin-bottom: 1.5rem;
    }

    /* Event Tabs & Schedule Section 小平板版 */
}

/* 中等尺寸平板 (520px-767px) 特別優化 */
@media (min-width: 521px) and (max-width: 767px) {
    .card-info {
        margin-top: 0;
        margin-bottom: 2.5rem;
    }
}

/* 手機尺寸 (767px 以下) */
@media (max-width: 767px) {
    .container {
        padding: 0 var(--spacing-medium);
    }

    /* 手機版動畫調整 - 減少位移距離 */
    @keyframes fadeInUpMobile {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .fade-in-element.loaded {
        animation: fadeInUpMobile 0.8s ease-out forwards;
    }

    /* Header 手機版 */
    .top-header {
        padding: var(--spacing-small) 0;
    }

    .top-header .container {
        flex-direction: column;
        gap: var(--spacing-medium);
        align-items: center;
    }

    .header-left {
        text-align: center;
        width: 100%;
    }

    .series-text, .main-title {
        font-size: 0.9rem;
    }

    .sub-nav {
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    /* Hero 手機版 */
    .hero {
        min-height: 80vh;
    }

    .hero-content {
        padding: var(--spacing-large) var(--spacing-medium);
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-description h2 {
        font-size: 1.5rem;
    }

    .desc-subtitle {
        font-size: 1rem;
    }

    .desc-block p {
        font-size: 0.9rem;
    }

    /* Description Section 手機版 */
    .description-section {
        height: auto;
        min-height: 50vh;
        padding: var(--spacing-large) 0;
    }

    .description-section .section-bg {
        object-position: center;
        background-attachment: scroll;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-medium);
    }

    .section-title::after {
        width: 80%;
        max-width: 250px;
        height: 3px;
    }

    .section-subtitle {
        font-size: 1.2rem;
        margin-bottom: var(--spacing-large);
    }

    .section-text {
        padding: 0 var(--spacing-small);
    }

    .section-text p {
        font-size: 1.1rem;
        line-height: 1.7;
        margin-bottom: var(--spacing-large);
    }

    /* Feature Section 手機版 */
    .intro-text p {
        font-size: 1.1rem;
        line-height: 1.7;
        padding: 0 var(--spacing-medium);
    }

    .card-info {
        margin-top: -5rem;
        margin-bottom: 3rem;
    }

    .card-info .date {
        font-size: 1.6rem;
    }

    .card-info .date .day,
    .card-info .date .time {
        font-size: 1.2rem;
    }

    .card-info .location {
        font-size: 1.2rem;
    }

    .card-info .location::before {
        width: 20px;
        height: 20px;
    }

    /* 卡片手機版 - 改為單欄 */
    .cards-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-medium);
    }

    .feature-card {
        height: 300px;
    }

    .card-content {
        padding: var(--spacing-medium);
    }

    .card-title img {
        max-width: 90%;
    }

    .card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-small);
    }

    /* Tabs 手機版 - 2x2 網格布局 */
    .tab-navigation {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 12px;
        margin-bottom: 0px;
        padding: 0 var(--spacing-medium);
        overflow: visible;
        justify-content: unset;
        margin-top: -110px;
    }

    .tab-btn {
        font-size: 1.5rem;
        padding: 12px 8px;
        border-radius: 8px;
        text-align: center;
        white-space: normal;
        line-height: 1.3;
        min-height: 70px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-bottom: 1px solid #888;
    }


    .feature-section {
        padding: var(--spacing-large) 0 calc(var(--spacing-large) * 3) 0;
    }


    .event-content-container {
        border-radius: 0 8px 8px 8px;
        padding: var(--spacing-large);
        margin-top: -1px;
    }

    /* Event Header 手機版 */
    .event-header img {
        width: 100%;
        max-width: none;
        margin: var(--spacing-medium) 0;
    }

    /* Schedule 手機版改進 - 垂直排列 */
    .schedule-item {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 8px 12px;
        align-items: flex-start;
    }

    .schedule-item .time {
        min-width: auto;
        font-size: 1rem;
        text-align: left;
        padding: 0;
        margin: 0;
        color: #000 !important;
        background: none;
        display: block;
        width: auto;
        order: 0;
    }

    .item-content {
        text-align: left;
        width: 100%;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px;
        padding: 0;
        margin: 0;
        align-items: flex-start !important;
    }

    /* 確保所有子元素都是 flex items */
    .item-content > * {
        flex-shrink: 0;
    }

    /* 強制覆蓋桌面版的 flex-direction 設定 */
    .item-content:has(.badge),
    .item-content:has(.badge-container) {
        flex-direction: column !important;
        display: flex !important;
    }

    /* 設定 text-container 為 flex 布局 */
    .text-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px;
        width: 100%;
    }

    /* 設定 badge 在上方，text-container 在下方 */
    .badge-container {
        order: 1 !important;
    }

    .text-container {
        order: 2 !important;
    }

    /* 在 text-container 內部，title 在上方，speaker 在下方 */
    .text-container .title {
        order: 1 !important;
        font-size: 1rem;
    }

    .text-container .speaker-name {
        order: 2 !important;
        font-size: 1rem;
    }

    /* 針對沒有 badge 的簡單結構 */
    .item-content .title {
        font-size: 1rem;
        text-align: left;
        color: #000;
        order: 1 !important;
    }

    .item-content .speaker-name {
        font-size: 1rem;
        text-align: left;
        order: 2 !important;
    }

    /* 有 badge 的主題改為對應主題色 */
    .event-financial .text-container .title {
        color: #c3996a !important;
    }

    .event-semiconductor .text-container .title {
        color: #00aad3 !important;
    }

    .event-strategy-am .text-container .title,
    .event-strategy-pm .text-container .title {
        color: #6441fe !important;
    }

    /* Badge 樣式 */
    .badge-container .badge {
        font-size: 1rem;
        padding: 4px 8px;
        margin: 0;
        width: fit-content;
    }

    /* 講者職稱設定較小字體 */
    .speaker-title {
        font-size: 0.8rem !important;
    }

    /* 減少整個 schedule-header 的高度 */
    .schedule-header {
        min-height: auto !important;
    }

    .time-header {
        padding: 8px 12px !important;
        font-size: 1rem !important;
        min-width: auto !important;
    }

    .content-header {
        line-height: 0.8 !important;
        padding: 8px 12px !important;
        font-size: 1rem !important;
    }

    /* 手機版表格等比例縮小 */
    .schedule-list {
        transform: scale(0.9);
        transform-origin: top center;
        margin: 0 auto;
    }

    /* Schedule & Speakers 手機版 */
    .schedule-speakers {
        padding: var(--spacing-large) 0;
    }

    .schedule-panel h2 {
        font-size: 1.5rem;
    }


    /* Speakers 手機版改進 */
    .speakers-section {
        overflow: hidden;
    }

    .speakers-section h3 {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-medium);
    }

    .speakers-carousel {
        overflow-x: hidden;
        overflow-y: visible;
        padding: var(--spacing-large) 20px;
    }

    .speakers-track {
        display: flex;
        gap: var(--spacing-medium);
    }

    .speaker-card {
        flex: 0 0 calc(50% - (var(--spacing-medium) / 2));
        padding: var(--spacing-small);
        text-align: center;
    }

    .speaker-card img {
        width: 100px;
        height: 100px;
        margin: 0 auto var(--spacing-small);
    }

    .speaker-info h4 {
        font-size: 1.1rem;
        margin-bottom: 2px;
    }

    .speaker-info .title {
        font-size: 0.8rem;
    }

    /* 保留手機版輪播導航 */
    .carousel-nav {
        display: flex;
    }

    /* Footer 手機版 */
    .site-footer {
        padding: var(--spacing-large) 0;
    }

    .footer-content h2 {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-large);
    }

    .footer-content h2::after {
        width: 200px;
    }

    .map-container {
        height: 250px;
    }

    .address {
        align-items: flex-start;
        flex-direction: row;
        gap: var(--spacing-medium);
    }

    .address .icon {
        width: 20px;
        height: 20px;
        margin-top: 3px;
    }

    .address-text {
        text-align: left;
    }

    .address-text p:first-child {
        font-size: 1.2rem;
    }

    .address-text p {
        font-size: 0.9rem;
    }

    .transport-option {
        flex-direction: row;
        align-items: flex-start;
        gap: var(--spacing-medium);
        margin-bottom: var(--spacing-medium);
    }

    .transport-option .icon {
        width: 20px;
        height: 20px;
        margin-top: 2px;
        flex-shrink: 0;
    }

    .option-text h4 {
        font-size: 1.2rem;
        margin-bottom: var(--spacing-small);
    }

    .option-text p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* 修復水平滾動問題 */
    .hero,
    .description-section,
    .feature-section,
    .event-tabs-schedule,
    .site-footer {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* 確保 tab-navigation 網格布局適應螢幕寬度 */
    .tab-navigation {
        max-width: 100vw;
        box-sizing: border-box;
    }

    .event-tabs-schedule .container {
        overflow-x: hidden;
        padding: 0;
    }

    /* 修復 schedule-list */
    .schedule-list {
        overflow-x: hidden !important;
        transform: none !important;
        width: 100%;
    }

    /* 確保 speakers-carousel 不溢出 */
    .speakers-carousel {
        overflow: hidden !important;
    }
}

/* 極小螢幕 (480px 以下) */
@media (max-width: 480px) {
    :root {
        --spacing-small: 0.4rem;
        --spacing-medium: 0.8rem;
        --spacing-large: 1.5rem;
        --spacing-xlarge: 3rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-description h2 {
        font-size: 1.3rem;
    }

    /* Description Section 極小螢幕 */
    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    .section-text p {
        font-size: 1rem;
        margin-bottom: var(--spacing-medium);
    }

    /* Feature Section 極小螢幕 */
    .intro-text p {
        font-size: 1rem;
    }

    .invitation-text {
        font-size: 1rem;
        padding: 0 var(--spacing-medium);
        margin: 0 auto;
        max-width: calc(100% - 2 * var(--spacing-medium));
    }

    .card-info .date {
        margin-top: 1rem;
        font-size: 1.4rem;
    }

    .card-info .date .day,
    .card-info .date .time {
        font-size: 1rem;
    }

    .card-info .location {
        font-size: 1rem;
    }

    /* Event Tabs & Schedule Section 極小螢幕 */
    .tab-navigation {
        gap: 8px;
        margin-bottom: 10px;
    }

    .tab-btn {
        font-size: 1rem;
        padding: 8px 6px;        
        min-height: 55px;
        line-height: 1.2;
    }

    .event-header img {
        margin: var(--spacing-small) 0;
    }

    .speakers-section h3 {
        font-size: 1.5rem;
    }

    .speakers-track {
        grid-template-columns: 1fr;
        gap: var(--spacing-medium);
    }

    .speaker-card img {
        width: 100px;
        height: 100px;
    }

    .speaker-info h4 {
        font-size: 1.1rem;
    }

    .speaker-info .title {
        font-size: 0.8rem;
    }

    .schedule-item .time {
        font-size: 1rem;
    }

    .item-content .title {
        font-size: 1rem;
    }

    .feature-card {
        height: 280px;
    }

    .speakers-track {
        grid-template-columns: 1fr;
    }

    .speaker-card {
        max-width: 250px;
        margin: 0 auto;
    }

    .transport-options {
        gap: var(--spacing-large);
    }

    /* Footer 極小螢幕 */
    .footer-content h2 {
        font-size: 1.4rem;
    }

    .footer-content h2::after {
        width: 150px;
    }

    .map-container {
        height: 200px;
    }

    .address-text p:first-child {
        font-size: 1rem;
    }

    .address-text p {
        font-size: 0.8rem;
    }

    .option-text h4 {
        font-size: 1rem;
    }

    .option-text p {
        font-size: 0.8rem;
    }

    .footer-logos img {
        height: 36px;
    }
}

/* 橫向手機 */
@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        min-height: 60vh;
    }

    .hero-content {
        padding: var(--spacing-medium);
    }

    .description-blocks {
        display: none;
    }
}

/* 高解析度螢幕優化 */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .hero-description h2 {
        font-size: 2.5rem;
    }

    .feature-card {
        height: 450px;
    }

    .cards-grid {
        gap: var(--spacing-xlarge);
    }
}

/* 針對特定圖片的響應式處理 */
@media (max-width: 767px) {
    /* 手機版 Hero Section 使用專屬背景圖 */
    .hero-bg {
        content: url('../images/mb_kv.jpg');
        width: 100%;
        height: auto;
        display: block;
        object-fit: contain;
    }

    .hero {
        background: none;
        height: auto;
        min-height: auto;
        padding: 0;
        margin: 0;
    }

    /* 手機版顯示調整 */
    .nav-text {
        display: block;
    }

    /* 隱藏所有文字內容 */
    .nav-text .nav-group {
        display: none !important;
    }

    .hamburger-btn {
        display: flex !important;
        position: absolute;
        left: 20px;
        top: 0px;
    }

    .nav-logo {
        right: 20px;
        height: 28px;
        top: 0px;
        height: 20px;
    }

    .hero-content {
        display: none;
    }

    /* 手機版選單調整 */
    .mobile-menu {
        top: -280px;
    }

    .mobile-menu.active {
        top: -10px;
    }

    .mobile-menu-content {
        padding: 40px 15px 25px 15px;
    }

    .mobile-menu-item {
        font-size: 1.1rem;
        padding: 18px 20px;
    }

    .hamburger-btn {
        left: 20px;
    }

    .nav-logo {
        right: 20px;
        height: 28px;
    }

}

/* 印刷樣式 */
@media print {
    .top-header,
    .event-tabs,
    .carousel-nav,
    .btn-register,
    .btn-more {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .hero,
    .feature-section,
    .schedule-speakers,
    .site-footer {
        background: white;
        color: black;
    }
}

/* 手機版隱藏最上方標題文字 */
@media (max-width: 1800px) {
    .nav-text .nav-group:first-child {
        display: none !important;
    }
}