/* 国税庁法人番号検索 - フロントエンドスタイル */

.houjin-search-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

/* アクセスカウンター */
.houjin-search-counter {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* 下部に表示するカウンター（控えめなスタイル） */
.houjin-search-counter-bottom {
    background: #f8f9fa;
    border: none;
    border-top: 1px solid #e0e0e0;
    padding: 15px;
    margin-top: 30px;
    margin-bottom: 0;
    box-shadow: none;
    text-align: center;
}

.search-count-text {
    margin: 0;
    text-align: center;
    color: #fff;
    font-size: 18px;
}

.houjin-search-counter-bottom .search-count-text {
    color: #666;
    font-size: 14px;
}

.count-icon {
    font-size: 24px;
    margin-right: 10px;
}

.count-number {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.houjin-search-counter-bottom .count-number {
    font-size: 16px;
    color: #667eea;
    text-shadow: none;
}

/* カウント表示用ショートコード */
.houjin-count-default,
.houjin-count-simple,
.houjin-count-detailed {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.houjin-count-detailed h4 {
    margin-top: 0;
    color: #333;
}

.houjin-count-detailed ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.houjin-count-detailed li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.houjin-count-detailed li:last-child {
    border-bottom: none;
}

.count-text {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.count-text strong {
    color: #667eea;
    font-size: 20px;
}

/* 検索フォーム */
.houjin-search-form {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
}

.houjin-search-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #333;
}

.search-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.houjin-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.houjin-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

.houjin-search-button {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background-color: #0073aa;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.houjin-search-button:hover {
    background-color: #005a87;
}

.houjin-search-button:active {
    background-color: #004d73;
}

/* 検索オプション */
.search-options {
    margin-top: 20px;
}

.search-options-section {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.search-options-section summary {
    padding: 12px 15px;
    cursor: pointer;
    font-weight: bold;
    color: #333;
    user-select: none;
    list-style-position: inside;
}

.search-options-section summary:hover {
    background: #f5f5f5;
}

.search-options-section[open] summary {
    border-bottom: 1px solid #ddd;
    background: #f5f5f5;
}

.checkbox-group {
    padding: 15px;
}

.checkbox-group label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 5px 0;
}

.checkbox-group label:last-child {
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.option-note {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

/* ローディング */
.houjin-search-loading {
    text-align: center;
    padding: 30px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    margin-bottom: 20px;
}

.houjin-search-loading p {
    margin: 0;
    font-size: 16px;
    color: #0073aa;
}

/* エラーメッセージ */
.houjin-search-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.houjin-search-error p {
    margin: 0;
    color: #856404;
}

/* 検索結果 */
.houjin-search-results {
    margin-top: 30px;
}

.search-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #b3d9e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.search-summary {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.csv-download-button {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    background-color: #28a745;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.csv-download-button:active {
    background-color: #1e7e34;
}

.no-results {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
}

/* 結果テーブル */
.results-table-wrapper {
    overflow-x: auto;
    margin-bottom: 30px;
    width: 100%;
}

.houjin-results-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    table-layout: auto;
}

.houjin-results-table thead {
    background: #e8f4f8;
    color: #333;
}

.houjin-results-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #b3d9e6;
    color: #000;
    background: #e8f4f8;
}

.houjin-results-table tbody tr {
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s;
}

.houjin-results-table tbody tr:hover {
    background-color: #f5f5f5;
}

.houjin-results-table td {
    padding: 15px 10px;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* カラムごとの幅制御（最小幅 + パーセント） */
.corporate-number,
.th-corporate-number {
    min-width: 110px;
    width: 15%;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #0073aa;
}

.company-name,
.th-company-name {
    min-width: 150px;
    width: 35%;
}

.name-main {
    font-weight: bold;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.name-furigana {
    font-size: 0.85em;
    color: #666;
}

.address,
.th-address {
    min-width: 150px;
    width: 35%;
    color: #333;
    word-wrap: break-word;
}

.kind,
.th-kind {
    min-width: 80px;
    width: 15%;
    white-space: nowrap;
    color: #666;
}

/* カラム数に応じた幅調整 */
/* 商号のみ（1カラム） */
.houjin-results-table tbody tr td:only-child.company-name {
    width: 100%;
}

/* 商号 + 1項目（2カラム） */
.houjin-results-table tbody tr:has(td:nth-child(2)):not(:has(td:nth-child(3))) .company-name {
    width: 60%;
}

/* 商号 + 2項目（3カラム） */
.houjin-results-table tbody tr:has(td:nth-child(3)):not(:has(td:nth-child(4))) .company-name {
    width: 40%;
}

/* ページネーション */
.houjin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.houjin-pagination .page-link {
    display: inline-block;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #0073aa;
    text-decoration: none;
    transition: all 0.3s;
}

.houjin-pagination .page-link:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.houjin-pagination .page-link.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: bold;
    cursor: default;
}

.houjin-pagination .page-ellipsis {
    padding: 8px 12px;
    color: #666;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .houjin-search-wrapper {
        padding: 10px;
    }
    
    .houjin-search-form {
        padding: 20px 15px;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .houjin-search-input,
    .houjin-search-button {
        width: 100%;
    }
    
    .search-options-section summary {
        font-size: 0.95em;
    }
    
    .checkbox-group {
        padding: 12px;
    }
    
    .checkbox-group label {
        font-size: 0.9em;
    }
    
    .search-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .csv-download-button {
        width: 100%;
    }
    
    .houjin-results-table {
        font-size: 14px;
    }
    
    /* テーブルを縦並びのカード形式に */
    .results-table-wrapper {
        overflow-x: visible;
    }
    
    .houjin-results-table thead {
        display: none;
    }
    
    .houjin-results-table,
    .houjin-results-table tbody,
    .houjin-results-table tr,
    .houjin-results-table td {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    
    .houjin-results-table tr {
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 15px;
        background: #fff;
    }
    
    .houjin-results-table td {
        padding: 10px 0;
        border: none;
        text-align: left;
    }
    
    .houjin-results-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        margin-bottom: 5px;
        color: #0073aa;
        font-size: 0.9em;
    }
    
    .houjin-results-table td:not(:last-child) {
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 15px;
        margin-bottom: 5px;
    }
    
    .corporate-number {
        white-space: normal;
        word-break: break-all;
        font-size: 13px;
    }
    
    .company-name {
        width: 100%;
    }
    
    .name-main {
        font-size: 1.1em;
    }
}

@media screen and (max-width: 480px) {
    .houjin-search-form h3 {
        font-size: 1.2em;
    }
    
    .search-summary {
        font-size: 16px;
    }
    
    .checkbox-group label {
        font-size: 0.85em;
    }
}
