/* 
   翔騰數學 - 蔡奇霖老師個人網站全新響應式 CSS 樣式表 (newweb 版)
*/

/* 引入 Google Fonts: Outfit (英語/數字) 與 Noto Sans TC (繁體中文) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4ba3e3;        /* 活力天空藍 */
    --primary-dark: #2a7cbd;         /* 深天空藍 */
    --secondary-color: #1e3a5f;      /* 寧靜海藍 */
    --accent-color: #ff9e80;         /* 青春珊瑚橘 */
    --bg-light: #f0f8ff;             /* 輕盈淡藍白 */
    --text-dark: #2c3e50;            /* 深藍灰文字 */
    --text-muted: #64748b;           /* 輔助灰色 */
    --card-shadow: 0 10px 30px rgba(75, 163, 227, 0.08);
    --card-hover-shadow: 0 15px 35px rgba(75, 163, 227, 0.2);
}

body {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    background-image: url('../images/bg.jpg');
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ================= 頁首與導覽列 (Glassmorphism) ================= */
.navbar-brand {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-dark) !important;
    letter-spacing: 1px;
}

.navbar {
    background-color: rgba(220, 238, 255, 0.82) !important; /* 很淡的藍紫色 (淡薰衣草/粉紫色) */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--text-dark) !important;
    padding: 0.6rem 1.1rem !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover, 
.navbar-nav .nav-item.show .nav-link {
    color: var(--primary-dark) !important;
    background-color: rgba(23, 162, 184, 0.06);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
}

.dropdown-item {
    font-weight: 400;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--primary-color);
    color: white !important;
}

/* ================= 首頁區塊樣式 ================= */
.hero-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2027 100%);
    color: white;
    padding: 2.5rem 0; /* 縮小上下內距 (原為 5rem 0)，降低與選單間的空曠感 */
    border-radius: 0 0 2rem 2rem;
    margin-bottom: 2rem;
}

.hero-title {
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #8fc7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 幻燈片 (Carousel) 美化 */
.carousel {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    display: flex !important;
    flex-direction: column !important;
    background: rgba(0, 0, 0, 0.2);
}

.carousel-inner {
    position: relative !important;
    width: 100% !important;
}

.carousel-item img {
    height: 300px !important; /* 強制拉高顯示高度，與圖片分離 */
    object-fit: cover !important;
    width: 100% !important;
}

/* 行動裝置自適應調整 */
@media (max-width: 991.98px) {
    .carousel-item img {
        height: 240px !important;
    }
}

.carousel-item .carousel-caption {
    position: relative !important; /* 強制改為相對定位，確保排在圖片下方，不重疊 */
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    padding: 0.8rem 1.2rem !important;
    text-align: center !important;
    background: rgba(30, 58, 95, 0.9) !important; /* 寧靜海藍背景 */
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    min-height: 52px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.carousel-item .carousel-caption h5 {
    margin: 0 !important;
    font-size: 1.05rem !important;
    font-weight: 500 !important;
    color: #fff !important;
    letter-spacing: 0.5px !important;
}

.carousel .carousel-indicators {
    position: relative !important; /* 強制改為相對定位，放到最下方 */
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 0 !important;
    padding: 0.8rem 0 !important;
    background: rgba(15, 32, 39, 0.95) !important; /* 與英雄區背景色調一致 */
    z-index: 5 !important;
    display: flex !important;
    justify-content: center !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.carousel .carousel-indicators [data-bs-target] {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    margin: 0 4px !important;
    background-color: #fff !important;
    opacity: 0.5 !important;
    border: none !important; /* 移除預設的 border */
    transition: opacity 0.6s ease !important;
}

.carousel .carousel-indicators .active {
    opacity: 1 !important;
    background-color: var(--primary-color) !important;
}

/* 每日名言卡片 */
.quote-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
    color: #e2e8f0;
}

/* 首頁六大板塊卡片 */
.service-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 2.2rem 1.8rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    z-index: 2;
}

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

.service-card:hover::before {
    transform: scaleX(1);
}

.service-card .card-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.2rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.service-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
}

.service-card .card-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

/* ================= 一般內頁樣式 ================= */
.page-header {
    background: linear-gradient(135deg, rgba(75, 163, 227, 0.15) 0%, rgba(240, 248, 255, 0.6) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(75, 163, 227, 0.2);
    color: var(--secondary-color);
    padding: 1.8rem 0;
    margin-bottom: 2rem;
    border-radius: 0 0 1rem 1rem;
}

.page-title {
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0;
    font-size: 2rem;
}

.content-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2.5rem;
}

/* 巢狀條目樣式 (仿原版結構並優化) */
.math-list {
    padding-left: 0;
    list-style: none;
}

.math-list > li {
    margin-bottom: 1.5rem;
    background: #f8fafc;
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.math-list > li.b {
    border-left-color: var(--primary-color);
    background: rgba(23, 162, 184, 0.04);
}

.math-list .list-title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.math-sublist {
    padding-left: 1.2rem;
    list-style: none;
    border-left: 1px dashed #cbd5e1;
    margin-top: 0.5rem;
}

.math-sublist > li {
    position: relative;
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
    color: #475569;
}

.math-sublist > li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: 0;
    top: -2px;
}

/* ================= 浮動按鈕與公告彈出視窗 ================= */
.floating-btn {
    position: fixed;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-btn:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.25);
}

#announcement-btn {
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    animation: pulse 2s infinite;
    font-size: 1.15rem;
}

#back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    font-size: 1.25rem;
    opacity: 0;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 75, 43, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 75, 43, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 75, 43, 0);
    }
}

/* ================= 線上實驗環境 ================= */
.iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 比例 */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ================= 頁尾樣式 ================= */
footer:not(.blockquote-footer) {
    background-color: var(--secondary-color);
    color: #e2e8f0;
    padding: 3rem 0;
    margin-top: 4rem;
    border-top: 5px solid var(--primary-color);
}

footer:not(.blockquote-footer) a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer:not(.blockquote-footer) a:hover {
    color: white;
}

.counter-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ================= 留言板與後台頁面 ================= */
.message-bubble {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.message-bubble:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.admin-nav {
    border-right: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .admin-nav {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 1.5rem;
    }
}
