/* ==========================================================================
   線上連結服務入口網 - 主樣式表 (CSS)
   設計風格：比照圖二風格製作，具備現代感漸層、立體斜線切角與優良響應式體驗
   ========================================================================== */

:root {
    /* 品牌與背景色彩 */
    --bg-main: #edf6fd;
    --bg-card: #ffffff;
    
    /* 外框與邊框 */
    --card-border: #91cdfc;
    --card-shadow: 0 12px 32px rgba(16, 75, 126, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
    
    /* 區塊標題漸層 (藍綠雙色亮眼漸層) */
    --header-gradient: linear-gradient(90deg, #0072ff 0%, #0099ff 45%, #00b4db 80%, #00a884 100%);
    --header-border-bottom: #005bb5;
    
    /* 按鈕樣式 (圖二主色：亮寶藍至耀海藍漸層) */
    --btn-bg-start: #5a94ff;
    --btn-bg-end: #3b74e6;
    --btn-badge-bg: #2b56b3;
    --btn-shadow: 0 5px 16px rgba(59, 116, 230, 0.3);
    --btn-shadow-hover: 0 8px 22px rgba(59, 116, 230, 0.45);
    
    /* 字體與圓角設定 */
    --font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 基礎重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    /* 點陣波浪底紋背景 (同圖二背景質感) */
    background-image: 
        radial-gradient(#d3e7fa 2px, transparent 2px),
        radial-gradient(#d3e7fa 2px, var(--bg-main) 2px);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
    color: #2c3e50;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   1. 頂部校網橫幅 (Banner)
   ========================================================================== */
.school-banner {
    background: linear-gradient(180deg, #e3f2fd 0%, #cce5ff 100%);
    border-bottom: 3px solid #a6d5fa;
    padding: 1.2rem 1.5rem 2rem 1.5rem;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.1);
    overflow: hidden;
}

.banner-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.banner-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0077e6, #0056b3);
    color: #ffffff;
    font-size: 26px;
    font-weight: 900;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.35);
    border: 2px solid #ffffff;
}

.badge-text {
    display: flex;
    flex-direction: column;
}

.badge-county {
    font-size: 15px;
    font-weight: 700;
    color: #0056b3;
    letter-spacing: 0.5px;
}

.badge-school-en {
    font-size: 11px;
    color: #667788;
    font-weight: 500;
}

.school-title {
    font-size: 2rem;
    font-weight: 900;
    color: #0c3b66;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
}

.banner-decor {
    font-size: 22px;
    display: flex;
    gap: 6px;
}

.star-decor {
    color: #ff9800;
    animation: floatStar 3s ease-in-out infinite alternate;
}

.star-decor.small {
    font-size: 16px;
    color: #00b0ff;
    animation-delay: 1s;
}

@keyframes floatStar {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-5px) rotate(12deg); }
}

.grass-decor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: repeating-linear-gradient(
        45deg,
        #6edc9d,
        #6edc9d 12px,
        #4cd188 12px,
        #4cd188 24px
    );
    opacity: 0.85;
}

/* ==========================================================================
   2. 主要內容外框 Widget (比照圖二卡片設計)
   ========================================================================== */
.main-content {
    flex: 1;
    max-width: 1140px;
    width: 100%;
    margin: 2.2rem auto;
    padding: 0 1.2rem;
}

.widget-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    border: 3px solid var(--card-border);
    overflow: hidden;
}

/* 區塊標題列 */
.widget-header {
    background: var(--header-gradient);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--header-border-bottom);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    gap: 15px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* 黃色圓形搜尋放大鏡 Icon (同圖二) */
.search-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #ffc837 0%, #ff8008 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 2px solid #ffffff;
    flex-shrink: 0;
}

.search-icon {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.widget-title {
    font-size: 1.7rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 40, 90, 0.4);
}

/* 搜尋框設計 */
.header-right {
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    padding: 9px 36px 9px 16px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    width: 220px;
    transition: var(--transition);
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.85);
}

.search-box input:focus {
    width: 260px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a365d;
    border-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-box input:focus::placeholder {
    color: #888888;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    cursor: pointer;
    display: none;
    user-select: none;
}

.search-box input:focus + .search-clear-btn,
.search-clear-btn.active {
    display: block;
}

.search-box input:focus + .search-clear-btn {
    color: #666;
}

/* ==========================================================================
   3. 連結按鈕網格 (Grid Layout - 3 欄排列，同圖二)
   ========================================================================== */
.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 24px;
    padding: 32px 30px;
    background-color: #ffffff;
}

/* 個別連結卡片按鈕 (圖二切角星號風格) */
.link-card {
    display: flex;
    align-items: center;
    height: 60px;
    background: linear-gradient(180deg, #6ba1ff 0%, #3e78f0 100%);
    border-radius: var(--radius-md);
    box-shadow: var(--btn-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid #336be3;
    animation: fadeInCard 0.4s ease-out forwards;
}

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 左側深藍切角斜塊 (同圖二點綴星星星角標) */
.card-badge {
    width: 48px;
    height: 100%;
    background: linear-gradient(135deg, #1d42a3 0%, #153385 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* 右側斜線切角視覺 */
    clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.badge-icon {
    color: #ffffff;
    font-size: 16px;
    margin-right: 6px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* 中央標題文字 */
.card-title {
    flex: 1;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    padding-right: 24px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(10, 35, 90, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 微懸停動畫效果 */
.link-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--btn-shadow-hover), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    background: linear-gradient(180deg, #7bb0ff 0%, #4782f7 100%);
}

/* 鼠標按壓效果 */
.link-card:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 0 3px 10px rgba(59, 116, 230, 0.3);
}

/* 光芒滑過掃光效果 */
.link-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-20deg);
    transition: 0.75s;
}

.link-card:hover::after {
    left: 150%;
}

/* 無搜尋結果區塊 */
.no-results {
    padding: 50px 20px;
    text-align: center;
    color: #718096;
    font-size: 1.1rem;
    font-weight: 500;
}

.no-results.hidden {
    display: none;
}

/* ==========================================================================
   4. 提示 Toast (提示網址可設定)
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(20, 30, 55, 0.92);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 18px;
}

/* ==========================================================================
   5. 頁尾 (Footer)
   ========================================================================== */
.site-footer {
    text-align: center;
    padding: 1.8rem 1rem;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: auto;
}

/* ==========================================================================
   6. 響應式佈局 (Responsive Design)
   ========================================================================== */
@media (max-width: 960px) {
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 24px 20px;
        gap: 16px;
    }
    
    .school-title {
        font-size: 1.6rem;
    }
}

@media (max-width: 640px) {
    .banner-container {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .school-title {
        font-size: 1.4rem;
    }
    
    .widget-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .search-box input:focus {
        width: 100%;
    }
    
    .button-grid {
        grid-template-columns: 1fr;
        padding: 20px 16px;
        gap: 14px;
    }
    
    .link-card {
        height: 54px;
    }
    
    .card-title {
        font-size: 1.05rem;
    }
}
