/* ==========================================
   1. 定数と基本設定
   ========================================== */
:root {
    --ut-red: #800000;
    --text-main: #333333;
    --text-sub: #666666;
    --bg-paper: #fdfdfc;
    --bg-header: #f7f7f2;
    --border-light: #e0e0db;
    --accent-gold: #b8a078;
}

body {
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
    background-color: var(--bg-paper);
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    padding: 2.5rem 1.25rem;
}

/* 特定要素への明朝体適用 */
.intro-notice, .modal-content, table, .subtitle, .organization-link, dl dt {
    font-family: "BIZ UDPMincho", "Hiragino Mincho ProN", serif !important;
}

/* 共通コンテナ */
header, #app, .results-info, .table-wrapper, footer {
    max-width: 68.75rem;
    margin: 0 auto;
}

/* ==========================================
   2. ヘッダー・フッター
   ========================================== */
header { text-align: center; margin-bottom: 1.25rem; }
header h1 { 
    font-size: 1.7rem; 
    color: var(--ut-red); 
    font-weight: 700; 
    letter-spacing: 0.15em; 
    margin-bottom: 0.3rem; 
}

.subtitle { 
    font-size: 0.95rem; 
    color: var(--text-sub); 
    border-top: 1px solid var(--border-light); 
    padding-top: 0.5rem; 
    display: inline-block; 
}

.organization-link {
    display: block; 
    margin-top: 0.5rem; 
    font-size: 0.85rem; 
    color: var(--accent-gold);
    letter-spacing: 0.15em; 
    text-decoration: none; 
    transition: color 0.2s;
}
.organization-link:hover { color: var(--ut-red); text-decoration: underline; }

footer { text-align: right; margin: 2.5rem 0; font-size: 0.85rem; color: var(--text-sub); }

/* ==========================================
   3. セクション制御（開閉ボタン）
   ========================================== */
.collapsible-section { position: relative; margin-bottom: 2rem; }

.floating-toggle {
    position: absolute; 
    top: -0.5rem; 
    right: 0; 
    z-index: 100;
    background: #fff; 
    border: 1px solid var(--border-light);
    color: var(--accent-gold); 
    font-size: 0.85rem; 
    padding: 0.4rem 1.25rem;
    border-radius: 2rem; 
    cursor: pointer; 
    opacity: 0.8;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    transition: all 0.2s;
}
.floating-toggle:hover { 
    opacity: 1; 
    color: var(--ut-red); 
    border-color: var(--ut-red); 
    background: var(--bg-paper); 
}

.collapsible-content { 
    max-height: 2500px; 
    overflow: hidden; 
    transition: max-height 0.4s ease, opacity 0.3s; 
}
.collapsible-content.collapsed { max-height: 0 !important; opacity: 0 !important; }

/* ==========================================
   4. 案内エリア・検索パネル
   ========================================== */
/* 案内・連絡先 */
.intro-notice { background: #fff; border: 1px solid var(--border-light); }
.notice-body { padding: 1.5rem 1.8rem 1rem; }
.contact-info { 
    background: var(--bg-header); 
    padding: 1.25rem 1.8rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
}
.contact-text { display: flex; flex-direction: column; gap: 0.3rem; }
.info-line { display: block; font-size: 0.9rem; color: var(--text-sub); }
.info-line a { font-family: monospace !important; color: var(--text-main); }

.legend-button { 
    padding: 0.4rem 1rem; 
    background: #fff; 
    border: 1px solid var(--border-light); 
    color: var(--text-main); 
    text-decoration: none; 
    font-size: 0.85rem; 
    border-radius: 4px; 
}

/* 検索コントロール */
#search-content { background: #fff; border: 1px solid var(--border-light); }
.search-controls { padding: 1.5rem 1.8rem 1rem; }
#keywordSearch { 
    width: 100%; 
    border: none; 
    border-bottom: 2px solid var(--border-light); 
    padding: 0.5rem 0; 
    font-size: 1.3rem; 
    outline: none; 
}

.settings-grid { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.setting-item, .setting-item-row { display: flex; align-items: center; }
.setting-item-row { gap: 2.5rem; }
.setting-label, .filter-group label { 
    width: 5.5em; 
    font-size: 0.8rem; 
    font-weight: bold; 
    color: var(--accent-gold); 
}
.setting-options { display: flex; gap: 1rem; }

#clearFilters {
    margin-left: auto; 
    background: #fdfdfc; 
    border: 1px solid var(--border-light);
    color: var(--text-sub); 
    padding: 0.4rem 1.2rem; 
    font-size: 0.85rem;
    border-radius: 2rem; 
    cursor: pointer; 
    transition: all 0.2s;
}
#clearFilters:hover { background: #f0f0f0; color: var(--ut-red); border-color: var(--ut-red); }

/* フィルタ（セレクトボックス群） */
.filter-controls { 
    display: grid; 
    grid-template-columns: repeat(6, 1fr); 
    gap: 1rem; 
    padding: 0.5rem 1.8rem 1.5rem; 
}
.filter-group select { 
    width: 100%; 
    border: none; 
    border-bottom: 1px solid var(--border-light); 
    padding: 0.3rem 0; 
    font-size: 0.9rem; 
    outline: none; 
}

/* ==========================================
   5. 結果表示・テーブル・ナビ
   ========================================== */
.results-info { 
    margin-top: 2rem; 
    display: flex; 
    justify-content: space-between; 
    align-items: baseline; 
    font-size: 0.85rem; 
    color: var(--text-sub); 
}

.pagination { display: flex; gap: 0.75rem; }
.pagination button { 
    border: none; 
    background: transparent; 
    padding: 0.4rem 0.8rem; 
    cursor: pointer; 
    font-size: 1.1rem; 
    color: var(--text-sub); 
    transition: 0.2s; 
}
.pagination button.active { color: var(--ut-red); font-weight: bold; border-bottom: 2px solid var(--ut-red); }

.pagination-bottom { display: flex; justify-content: center; margin: 2rem 0 4rem; }

table { width: 100%; border-collapse: collapse; }
th { 
    background: var(--bg-header); 
    padding: 0.8rem 1rem; 
    text-align: left; 
    border-top: 2px solid var(--ut-red); 
    border-bottom: 1px solid var(--border-light); 
    font-size: 0.8rem; 
}
td { padding: 1rem; border-bottom: 1px solid var(--border-light); }
tbody tr:hover { background: var(--bg-header); }

/* ==========================================
   6. モーダル（アクセシビリティ対応）
   ========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
}
.modal.show { display: block; }

.modal-content {
    background: var(--bg-paper);
    margin: 3rem auto;
    padding: 2.5rem;
    width: 90%;
    max-width: 40rem;
    position: relative;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.close-button {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body dl dt { 
    font-weight: bold; 
    color: var(--accent-gold); 
    margin-top: 1.5rem; 
    font-size: 1rem; 
    border-left: 3px solid var(--accent-gold); 
    padding-left: 0.8rem; 
}
.modal-body dd { 
    margin-left: 0; 
    margin-top: 0.5rem; 
    font-size: 1rem; 
    color: var(--text-main); 
    line-height: 1.7; 
}

/* ==========================================
   7. モバイル対応 (max-width: 768px)
   ========================================== */
@media (max-width: 768px) {
    /* パネル調整 */
    .search-controls, .filter-controls { padding: 1.5rem 1.25rem; }
    .contact-info { flex-direction: column; align-items: flex-start; gap: 1.25rem; }

    /* 検索エリア：垂直レイアウト */
    .setting-item, .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        margin-bottom: 1.25rem;
    }

    .setting-label, .filter-group label { width: 100%; font-size: 0.85rem; }
    .setting-options { width: 100%; gap: 0.8rem 1.2rem; }

    .filter-controls {
        grid-template-columns: 1fr 1fr;
        gap: 1.2rem;
        border-top: 1px solid var(--border-light);
    }
    
    .filter-group select { font-size: 1rem; padding: 0.6rem 0; }

    #clearFilters { width: 100%; margin-top: 1rem; padding: 0.75rem; font-size: 1rem; }

    /* モーダル調整 */
    .modal-content { margin: 1rem auto; padding: 1.5rem; width: 95%; }

    /* テーブル：二段・左右分離レイアウト */
    thead { display: none; }
    
    tr {
        display: block;
        position: relative;
        padding: 0.8rem 140px 0.8rem 0; 
        border-bottom: 1px solid var(--border-light);
        min-height: 4.2rem;
    }
    
    td { display: inline; padding: 0; border: none; line-height: 1.4; }

    .col-type, .col-faculty, .col-dept { font-size: 0.75rem; color: var(--text-sub); }
    .col-faculty::before, .col-dept::before { content: " / "; opacity: 0.5; }

    .col-date {
        display: block;
        margin-top: 0.35rem;
        font-size: 0.85rem;
        color: var(--text-main);
    }

    .col-name {
        position: absolute;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        width: 130px;
        text-align: right;
        font-weight: bold;
        font-size: 1.15rem;
        color: var(--ut-red);
        display: block !important;
    }
}
