/* 首頁主視覺 */
.hero {
    max-width: 1440px;
    margin: 0 auto;
    padding: 65px 40px 25px;
    text-align: center;
    position: relative;
}
.hero-content {
    margin-bottom: 38px;
}
.hero-tagline { /* 橘色小標籤 */
    display: inline-block;
    padding: 10px 24px;
    border-radius: 30px;
    background: #ffe8d5;
    color: #a35b2e;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 25px;
}
.hero h1 {
    font-size: clamp(36px, 5vw, 68px);
    font-weight: 800;
    letter-spacing: 2px; /* 控制字元之間的距離 */
    line-height: 1.4;
}
.hero h1 span {
    color: var(--primary);
}
.hero-description {
    margin-top: 18px;
    font-size: 18px;
    line-height: 1.9;
    color: var(--text-gray);
}

/* Search 搜尋欄位 */
.search-box {
    background: var(--white);
    border-radius: 32px;
    padding: 20px 25px;

    display: flex;
    align-items: center;
    gap: 18px;

    box-shadow: 0 12px 35px rgba(184, 119, 66, 0.08);
}
.search-field {
    flex: 1;
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 18px;

    padding: 5px 18px;
    border-right: 1px solid #eee2d8;
}
.search-field > svg { /* 搜尋欄位的 Icon */
    width: 30px;
    height: 30px;
    flex-shrink: 0; /* 不允許這個 Icon 因為 Flexbox 空間不足而縮小 */
    color: var(--primary);
}
.field-content {
    flex: 1;
    min-width: 0;
    text-align: left;
}
.field-content label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
}
.field-content select {
    width: 100%;
    border: none; /* 移除選單的預設邊框 */
    outline: none; /* 移除輪廓線 */
    background: transparent;
    color: var(--text-gray);
    font-size: 14px;
    cursor: pointer;
}
.location-field {
    position: relative;
}
.location-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    padding: 0;

    border: none;
    outline: none;
    background: transparent;
    box-shadow: none;
    appearance: none;

    color: var(--text-gray);
    font-size: 14px;
    font-weight: 400;
    text-align: left;

    cursor: pointer;
}
.location-trigger svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-gray);
}
.location-trigger:focus-visible { /* 鍵盤操作時的焦點提示 */
    outline: 2px solid var(--primary);
    outline-offset: 5px;
    border-radius: 4px;
}
.location-dropdown[hidden] { /* 預設隱藏下拉面板 */
    display: none;
}
.location-dropdown { /* 展開後的白色浮動面板 */
    position: absolute;
    z-index: 20;
    top: calc(100% + 12px);
    left: 0;
    width: min(440px, 85vw);
    padding: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 14px 36px rgba(80, 54, 35, 0.14);
}
.location-dropdown-content { /* 縣市與行政區左右排列 */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.location-option { /* 縣市與行政區欄位 */
    min-width: 0;
    text-align: left;
}
.location-option label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}
.location-option select { /* 縣市與行政區下拉選單 */
    width: 100%;
    padding: 12px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fffaf5;
    color: var(--text-dark);
    font-size: 14px;
    cursor: pointer;
}
.location-option select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.location-option select:disabled {
    color: #aaaaaa;
    background: #f7f7f7;
    cursor: not-allowed;
}
.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    background: var(--primary);
    color: white;
    border: none;
    border-radius: 35px;

    padding: 20px 32px;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;

    transition: background 0.2s, transform 0.2s; /* 設定滑鼠移入時的過渡效果 */
}
.search-button svg {
    width: 23px;
    height: 23px;
}
.search-button:hover { /* 滑鼠移入時的效果 */
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Teachers Results 家教老師列表 */
.teachers-results {
    max-width: 1360px;
    margin: 50px auto 80px;
    padding: 35px;

    background: var(--white);
    border-radius: 32px;
    box-shadow: 0 12px 35px rgba(184, 119, 66, 0.08);
}
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.results-header h2 {
    font-size: 26px;
    font-weight: 700;

    display: flex;
    align-items: center;
    gap: 12px;
}
.results-header h2::before {
    content: "";
    display: block;
    width: 5px;
    height: 30px;
    border-radius: 5px;
    background: var(--primary);
}
#sort-order {
    padding: 10px 16px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: #fffaf5;
    color: var(--text-dark);
    font-size: 14px;

    cursor: pointer;
}
#sort-order:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
#result-count {
    margin-top: 15px;
    color: var(--text-gray);
    font-size: 14px;
}
#teacher-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-top: 25px;
}


/* Teacher Card 老師卡片 */
.teacher-card {
    display: flex;
    flex-direction: column;
    gap: 18px;

    padding: 25px;
    background: #fffaf5;
    border: 1px solid var(--border);
    border-radius: 22px;

    transition: transform 0.2s, box-shadow 0.2s;
}
.teacher-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(184, 119, 66, 0.12);
}

/* 老師基本資料 */
.teacher-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
}
.teacher-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #ffe8d5;
    color: var(--primary);
}
.teacher-avatar.male {
    background: #e4eef9;
    color: #4275ad;
}
.teacher-avatar.female {
    background: #fce4ec;
    color: #c45a80;
}
.teacher-avatar svg {
    width: 30px;
    height: 30px;
    stroke-width: 2;
}
/* 老師卡片：AWS S3 頭貼照片 */
.teacher-avatar-image {
    width: 100%;
    height: 100%;

    /* 保持照片比例，填滿圓形頭貼 */
    object-fit: cover;

    /* 將照片裁切成圓形 */
    border-radius: 50%;

    /* 避免圖片超出原本頭貼區域 */
    display: block;
}
.teacher-basic h3 {
    font-size: 21px;
    margin-bottom: 5px;
}
.teacher-basic p {
    color: var(--text-gray);
    font-size: 14px;
}

/* 科目與年級標籤 */
.teacher-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.teacher-tag,
.teacher-grade {
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
}
.teacher-tag {
    background: #ffe8d5;
    color: #a35b2e;
    font-weight: 600;
}
.teacher-grade {
    background: #f1eee9;
    color: var(--text-gray);
}

/* 學歷與教學經驗 */
.teacher-education,
.teacher-experience {
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 14px;
    color: var(--text-gray);
}
.teacher-education svg,
.teacher-experience svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--primary);
}

/* 老師介紹 */
.teacher-intro {
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-gray);
}

/* 卡片底部 */
.teacher-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.teacher-price {
    color: var(--primary);
    font-size: 21px;
    font-weight: 700;
}
.teacher-price span {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-gray);
}
.teacher-detail-button {
    display: flex;
    align-items: center;
    gap: 6px;

    padding: 10px 14px;
    border: none;
    border-radius: 20px;

    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.teacher-detail-button:hover {
    background: var(--primary-dark);
}
.teacher-detail-button svg {
    width: 16px;
    height: 16px;
}
.no-results {
    grid-column: 1 / -1;
    padding: 50px 20px;
    text-align: center;
    color: var(--text-gray);
    font-size: 16px;
}

/* 老師卡片收藏愛心 */
/* 收藏老師卡片 */
.teacher-favorite-card {
    position: relative;
}
/* 卡片右上角的愛心按鈕 */
.teacher-heart-button {
    position: absolute;
    top: 16px;
    right: 16px;

    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #fff3eb;
    color: var(--primary);
    border: none;
    border-radius: 50%;

    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
/* 愛心圖示 */
.teacher-heart-button svg {
    width: 20px;
    height: 20px;
}
/* 已收藏：實心愛心 */
.teacher-heart-button.is-favorited svg {
    fill: currentColor;
}
/* 滑鼠移入 */
.teacher-heart-button:hover:not(:disabled) {
    background: #ffe3d0;
    transform: scale(1.08);
}
/* 鍵盤操作 */
.teacher-heart-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
/* 尚未啟用時維持正常外觀 */
.teacher-heart-button:disabled {
    cursor: default;
    opacity: 1;
}
/* 未登入時隱藏收藏愛心 */
.teacher-heart-button[hidden] {
    display: none;
}

/* RWD 平板 */
@media (max-width: 1100px) {
    .hero {
        padding: 55px 25px 25px;
    }
    .search-box {
        flex-wrap: wrap;
    }
    .search-field {
        flex: 1 1 28%;
    }
    .search-button {
        width: 100%;
    }
    .teachers-results {
        margin: 35px 25px 60px;
        padding: 25px;
    }
    #teacher-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* RWD 手機 */
@media (max-width: 600px) {
    .hero {
        padding: 45px 16px 20px;
    }
    .hero-tagline {
        font-size: 12px;
    }
    .hero h1 {
        font-size: 30px;
        letter-spacing: 0;
    }
    .hero-description {
        font-size: 14px;
    }
    .hero-description br {
        display: none;
    }
    .search-box {
        flex-direction: column;
        padding: 20px;
        border-radius: 22px;
        gap: 12px;
    }
    .search-field {
        width: 100%;
        flex: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 12px 5px;
    }
    .search-button {
        padding: 16px;
        font-size: 15px;
    }
    .teachers-results {
        margin: 25px 16px 50px;
        padding: 20px;
        border-radius: 22px;
    }
    .results-header h2 {
        font-size: 21px;
    }
    #sort-order {
        width: 100%;
    }
    #teacher-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}