/*
Theme Name: データ検索テーマ
Description: 日本薬剤疫学会データベース検索専用テーマ
Author: Your Name
Version: 1.0.0
License: GPL v2 or later
Text Domain: data-search
*/

/* ===== 基本設定 ===== */
body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.6;
}

.data-search-theme {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ===== ヘッダー ===== */
.header {
    background: white;
    border-bottom: 1px solid #ccc;
    position: relative;
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo img {
    height: 50px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.home-link {
    font-size: 14px;
    color: #2E8B57;
    border: 1px solid #2E8B57;
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
}

.home-link:hover {
    background-color: #2E8B57;
    color: white;
}

.main-title {
    font-size: 28px;
    margin-top: 20px;
    font-weight: bold;
}

/* ===== メインレイアウト ===== */
.main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
}

.search-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.search-form {
    padding: 20px;
}

/* ===== 検索説明文 ===== */
.search-description {
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f8ef 100%);
    border: 1px solid #2E8B57;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.description-text {
    color: #2E8B57;
    font-weight: 500;
    margin: 0;
}

/* ===== セクション（折りたたみ） ===== */
.search-section {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.section-header {
    /*background: linear-gradient(135deg, #2E8B57 0%, #3aa76d 100%);*/
    background: #ECF7EE;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.section-header:hover {
  background: linear-gradient(135deg, #C7E9D0 0%, #A8D5B4 100%);
}

.section-main-title {
    /*color: white;*/
    color: #009122;
    font-size: 16px;
    font-weight: bold;
    margin: 0;
}

.section-title {
    font-size: 18px;
    color: #2E8B57;
    font-weight: bold;
}

.toggle-btn {
    /*background: rgba(255, 255, 255, 0.2);*/
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background: #009122;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 20px;
}

.section-content.active {
    max-height: 5000px;
    padding: 20px;
    transition: max-height 0.5s ease-in;
}

.collapsible:not(.expanded) .section-content {
    display: none;
}

.collapsible.expanded .section-content {
    display: block;
}

/* ===== フィールドタイトル ===== */
.field-title {
    font-size: 14px;
    font-weight: bold;
    margin: 20px 0 10px 0;
    color: #555;
    border-left: 3px solid #2E8B57;
    padding-left: 10px;
}

.field-title:first-child {
    margin-top: 0;
}

.subsection-title {
    font-size: 16px;
    color: #2E8B57;
    font-weight: bold;
    margin: 30px 0 10px;
    background-color: #ECF7EE;
    padding: 8px 12px;
    border-radius: 4px;
}

/* ===== フォーム要素 ===== */
.form-row {
    margin: 15px 0;
    display: flex;
    align-items: center;
}

.form-label {
    width: 120px;
    font-weight: bold;
    color: #2E8B57;
}

.dropdown-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-height: 60px;
}

select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

/* ===== チェックボックス ===== */
.checkbox-simple-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
}

.checkbox-simple-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    min-width: 80px;
}

.checkbox-simple-item input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.checkbox-simple-item span {
    user-select: none;
}

.checkbox-simple-item:hover span {
    color: #2E8B57;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 30px;
    margin-bottom: 20px;
}

.checkbox-item {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== 数値入力フィールド（範囲指定） ===== */
.range-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.range-number-input {
    width: 120px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.range-number-input:focus {
    border-color: #2E8B57;
    outline: none;
    box-shadow: 0 0 0 2px rgba(46, 139, 87, 0.1);
}

.range-number-input:invalid {
    border-color: #dc3545;
}

.range-separator {
    font-size: 16px;
    color: #666;
    font-weight: bold;
    margin: 0 5px;
}

.range-unit {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

/* ===== ボタン ===== */
.button-group {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    display: flex;
    gap: 15px;
    margin-top: 40px;
}

.search-button,
.clear-button {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.search-button {
    background-color: #28a745;
    color: white;
}

.search-button:hover {
    background-color: #218838;
}

.clear-button {
    background-color: #6c757d;
    color: white;
}

.clear-button:hover {
    background-color: #545b62;
}

.detail-button {
    background: #2E8B57;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.detail-button:hover {
    background: #236B43;
}

.back-button {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

/* ===== 検索結果 ===== */
#results-section {
    animation: fadeIn 0.3s ease-in;
}

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

.search-summary {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.summary-label {
    font-weight: bold;
    color: #2E8B57;
}

.summary-value {
    color: #333;
}

.summary-value.highlight {
    color: #c00;
    font-weight: bold;
}

.collapsed-conditions {
    padding: 10px 0 0 0;
    margin: 0;
    list-style: none;
    color: #333;
    font-size: 14px;
}

.collapsed-conditions li {
    padding: 4px 0;
}

.condition-status {
    font-size: 14px;
    margin-left: auto;
    margin-right: 12px;
    color: #d00;
}

.condition-status.empty {
    color: #999;
}

/* ===== テーブル ===== */
.table-container {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.results-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}

.results-table th,
.results-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #eee;
    white-space: nowrap;
}

.results-table th:last-child,
.results-table td:last-child {
    border-right: none;
}

.results-table th {
    background: #2E8B57;
    color: #fff;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table tr:nth-child(even) {
    background: #f9f9f9;
}

.results-table tr:hover {
    background: #f1f8f5;
}

/* ===== スクロール通知 ===== */
.scroll-notice {
    display: none;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.scroll-notice.show {
    display: block;
}

/* ===== ユーティリティ ===== */
.note {
    font-size: 14px;
    color: #c00;
    margin-bottom: 20px;
}

.small-text {
    font-size: 12px;
    color: #666;
}

.value-display {
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}

/* ===== Google Translate ===== */
.translate-widget {
    font-size: 14px;
}

.goog-te-combo {
    padding: 4px 8px;
    border: 1px solid #2E8B57;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    color: #2E8B57;
}

.goog-te-combo:hover {
    background: #f8f9fa;
}

.goog-te-banner-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

/* ===== WordPress管理バー対応 ===== */
.admin-bar .header {
    top: 32px;
}

/* ===== レスポンシブデザイン ===== */
@media screen and (max-width: 782px) {
    .admin-bar .header {
        top: 46px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
        padding: 15px 10px;
    }
    
    .logo-section {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        margin-bottom: 15px;
        width: 100%;
    }
    
    .logo img {
        height: 40px;
    }
    
    .home-link {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .main-title {
        font-size: 24px;
        margin-top: 10px;
    }
    
    .main {
        padding: 15px;
    }
    
    .search-description {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .description-text {
        font-size: 14px;
        text-align: left;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .translate-widget {
        order: 1;
    }
    
    .home-link {
        order: 2;
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .checkbox-simple-grid {
        flex-direction: column;
        gap: 10px;
    }
    
    .dual-handle-slider-wrapper {
        padding: 10px 0;
    }
    
    .slider-values {
        margin-top: 10px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
        padding: 20px;
    }
    
    .search-button,
    .clear-button {
        padding: 12px;
        font-size: 16px;
    }
    
    .table-container {
        padding: 10px;
    }
    
    .results-table {
        font-size: 12px;
    }
    
    .results-table th,
    .results-table td {
        padding: 6px 8px;
    }
}

/* スライダーコンテナ */
.dual-handle-slider-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* スライダーラッパー */
.dual-handle-slider-wrapper {
    position: relative;
    padding: 30px 10px;
}

/* スライダー要素 */
.slider-element {
    height: 8px;
}

/* noUiSlider カスタムスタイル */
.slider-element.noUi-target {
    background: #ddd;
    border: none;
    box-shadow: none;
    border-radius: 4px;
}

/* スライダーの接続部分（選択範囲） */
.slider-element .noUi-connect {
    background: #2E8B57;
    box-shadow: 0 2px 4px rgba(46, 139, 87, 0.3);
}

/* スライダーハンドル */
.slider-element .noUi-handle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2E8B57;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider-element .noUi-handle:hover {
    background: #236B43;
    transform: scale(1.15);
}

.slider-element .noUi-handle:active {
    transform: scale(1.25);
}

/* ハンドルの前後 */
.slider-element .noUi-handle:before,
.slider-element .noUi-handle:after {
    display: none;
}

/* ツールチップ */
.slider-element .noUi-tooltip {
    background: #2E8B57;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: bold;
    bottom: 140%;
}

/* ツールチップの矢印 */
.slider-element .noUi-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2E8B57 transparent transparent transparent;
}

/* スライダー値表示 */
.slider-values {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.value-display {
    font-size: 18px;
    font-weight: 600;
    color: #2E8B57;
    min-width: 80px;
    text-align: center;
}

.range-separator {
    font-size: 16px;
    color: #666;
    font-weight: bold;
    margin: 0 5px;
}

.range-unit {
    font-size: 14px;
    color: #555;
    font-weight: 500;
    margin-left: 5px;
}

/* スライダーフォーカス時 */
.slider-element.noUi-target.noUi-state-tap {
    box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.2);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .dual-handle-slider-container {
        padding: 10px;
        margin: 15px 0;
    }
    
    .dual-handle-slider-wrapper {
        padding: 20px 5px;
    }
    
    .slider-element .noUi-handle {
        width: 20px;
        height: 20px;
    }
    
    .value-display {
        font-size: 16px;
        min-width: 60px;
    }
    
    .slider-values {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .slider-element .noUi-tooltip {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* アクセシビリティ: キーボードフォーカス */
.slider-element .noUi-handle:focus {
    outline: 2px solid #2E8B57;
    outline-offset: 2px;
}

/* スライダー無効化時 */
.slider-element.noUi-target[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-element.noUi-target[disabled] .noUi-handle {
    cursor: not-allowed;
    background: #999;
}

.slider-element.noUi-target[disabled] .noUi-connect {
    background: #999;
}