/* ================================================
   弁理士ナビ ウィジェット用CSS
   ================================================ */

/* --- モダンな配色パレット定義 (CSS変数) - 上が濃いグラデーション --- */
:root {
    /* 右列: 青系（上が濃い） */
    --color-hokkaido: #1e3a8a; /* 濃い青（Row 1） */
    --color-tohoku: #2563eb; /* 中間の青（Row 2） */
    --color-kanto: #60a5fa; /* 薄い青（Row 3） */

    /* 中央右: 緑系（上が濃い） */
    --color-hokuriku: #047857; /* 濃い緑（Row 2） */
    --color-chubu: #10b981; /* 薄い緑（Row 3） */

    /* 中央左: オレンジ系（上が濃い） */
    --color-kansai: #ea580c; /* 濃いオレンジ（Row 2） */
    --color-shikoku: #fb923c; /* 薄いオレンジ（Row 3） */

    /* 左列: ピンク系（上が濃い） */
    --color-chugoku: #be185d; /* 濃いピンク（Row 2） */
    --color-kyushu: #ec4899; /* 薄いピンク（Row 3） */

    --benrishi-bg-gradient-start: #f8fafc;
    --benrishi-bg-gradient-end: #f1f5f9;
}

/* --- 新グリッド定義: 4列 x 3行 (日本地図配置) --- */
.block-map-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 50px 50px 50px; /* 全て同じ高さ（北海道も50px） */
    gap: 8px;
    width: 100%;
    max-width: 100%; /* モバイル対応 */
}

@media (min-width: 768px) {
    .block-map-grid {
        max-width: 400px;
    }
}

/* --- マップセルの基本スタイル --- */
.map-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.7rem; /* モバイル用に少し小さく */
    font-weight: 700;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    .map-cell {
        font-size: 0.75rem;
    }
}

/* ホバー効果: 浮き上がりと輝き */
.map-cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    filter: brightness(1.1);
}

/* アクティブ状態: 発光するグラデーションボーダー */
.map-cell.active {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px rgba(59, 130, 246, 0.5); /* 外側の光 */
    z-index: 10;
}

.map-cell.active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    padding: 3px; /* ボーダー幅 */
    background: linear-gradient(to bottom right, #60a5fa, #3b82f6); /* 青系のグラデーション */
    -webkit-mask:
       linear-gradient(#fff 0 0) content-box,
       linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* --- エリア配置と個別カラーリング (4列×3行 日本地図配置) --- */

/* 1行目: 北海道のみ（上に飛び出す） - 濃い青 */
.area-hokkaido {
    grid-column: 4;
    grid-row: 1;
    background: linear-gradient(135deg, var(--color-hokkaido), #1e40af);
}

/* 2行目: 中国・関西・北陸・東北（下揃え） */
.area-chugoku {
    grid-column: 1;
    grid-row: 2;
    background: linear-gradient(135deg, var(--color-chugoku), #db2777);
}

.area-kansai {
    grid-column: 2;
    grid-row: 2;
    background: linear-gradient(135deg, var(--color-kansai), #f97316);
}

.area-hokuriku {
    grid-column: 3;
    grid-row: 2;
    background: linear-gradient(135deg, var(--color-hokuriku), #059669);
}

.area-tohoku {
    grid-column: 4;
    grid-row: 2;
    background: linear-gradient(135deg, var(--color-tohoku), #3b82f6);
}

/* 3行目: 九州・四国・中部・関東（下揃え） */
.area-kyushu {
    grid-column: 1;
    grid-row: 3;
    background: linear-gradient(135deg, var(--color-kyushu), #f472b6);
}

.area-shikoku {
    grid-column: 2;
    grid-row: 3;
    background: linear-gradient(135deg, var(--color-shikoku), #fdba74);
}

.area-chubu {
    grid-column: 3;
    grid-row: 3;
    background: linear-gradient(135deg, var(--color-chubu), #34d399);
}

.area-kanto {
    grid-column: 4;
    grid-row: 3;
    background: linear-gradient(135deg, var(--color-kanto), #93c5fd);
}

/* ウィジェットコンテナ */
.benrishi-widget-container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px); /* すりガラス効果 */
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 767px) {
    .benrishi-widget-container {
        border-radius: 16px;
        /* margin削除して正常な表示に */
    }
}

/* レイアウト: PC版は左右2カラム、モバイルは縦積み */
.benrishi-layout {
    display: flex;
    flex-direction: column;
    height: auto;
}

@media (min-width: 768px) {
    .benrishi-layout {
        flex-direction: row;
        height: 400px;
    }
}

/* 左側: 地図エリア */
.benrishi-map-area {
    width: 100%;
    padding: 1.25rem 1rem; /* スマホ用：上下を少し広く */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* スマホで中央寄せ */
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .benrishi-map-area {
        width: 41.666667%; /* w-5/12 */
        padding: 2rem;
        align-items: flex-start; /* PC版は左寄せ */
        border-bottom: none;
        border-right: none; /* PC版の縦線を削除 */
    }
}

/* 背景の光るエフェクト */
.benrishi-map-area::before {
    content: '';
    position: absolute;
    top: 70%; /* モバイル用：グリッド中央に配置 */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16rem;
    height: 16rem;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    filter: blur(64px);
    pointer-events: none;
}

@media (min-width: 768px) {
    .benrishi-map-area::before {
        top: 55%; /* PC版もグリッド中央に調整 */
    }
}

.benrishi-map-header {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem; /* スマホ用に縮小 */
    text-align: center;
    position: relative;
    z-index: 10;
}

@media (min-width: 768px) {
    .benrishi-map-header {
        text-align: left;
        margin-bottom: 1.5rem;
    }
}

.benrishi-map-grid-wrapper {
    width: 100%; /* スマホで横幅いっぱい */
    max-width: 400px; /* 最大幅制限 */
    margin: 0 auto; /* 中央寄せ */
    position: relative;
    z-index: 10;
}

@media (min-width: 768px) {
    .benrishi-map-grid-wrapper {
        margin: 0; /* PC版は左寄せ */
    }
}

/* 右側: リストエリア */
.benrishi-list-area {
    width: 100%;
    padding: 1rem; /* モバイル用に縮小 */
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.6);
}

@media (min-width: 768px) {
    .benrishi-list-area {
        width: 58.333333%; /* w-7/12 */
        padding: 1.5rem 2rem;
    }
}

.benrishi-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

@media (max-width: 767px) {
    .benrishi-list-header {
        margin-bottom: 1rem;
    }
}

.benrishi-area-label {
    font-size: 12px;
    color: #2563eb;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center; /* モバイルで中央揃え */
}

@media (min-width: 768px) {
    .benrishi-area-label {
        text-align: left; /* PC版は左揃え */
    }
}

.benrishi-area-name {
    font-size: 20px; /* スマホ用に縮小 */
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
    text-align: center; /* モバイルで中央揃え */
}

/* base.cssのh2::after装飾線を非表示 */
.benrishi-area-name::after {
    display: none !important;
}

@media (min-width: 768px) {
    .benrishi-area-name {
        font-size: 24px;
        text-align: left; /* PC版は左揃え */
    }
}

.benrishi-count-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 6px 12px;
    border-radius: 9999px;
}

.benrishi-count-number {
    font-size: 14px;
    font-weight: 700;
}

.benrishi-count-text {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.7;
}

/* スクロール可能なリストエリア */
.benrishi-office-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    max-height: 280px; /* モバイル: 3つのカード表示 */
}

@media (max-width: 767px) {
    .benrishi-office-list {
        padding-right: 0; /* スマホではスクロールバー非表示のためパディング不要 */
    }
}

@media (min-width: 768px) {
    .benrishi-office-list {
        max-height: 220px; /* PC: 2つのカード表示 */
    }
}

/* スクロールバーの洗練 */
.benrishi-office-list::-webkit-scrollbar {
    width: 5px;
}

.benrishi-office-list::-webkit-scrollbar-track {
    background: transparent;
}

.benrishi-office-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
    border: 1px solid white;
}

/* 弁理士事務所カード */
.benrishi-office-card {
    display: block; /* aタグ対応 */
    padding: 0.75rem; /* モバイル用に縮小 */
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    background: white;
    margin-bottom: 0.75rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none; /* aタグのデフォルト下線を削除 */
    color: inherit; /* aタグのデフォルト色をリセット */
}

@media (min-width: 768px) {
    .benrishi-office-card {
        padding: 1rem;
    }
}

.benrishi-office-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #eff6ff, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.benrishi-office-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.benrishi-office-card:hover::before {
    opacity: 1;
}

.benrishi-office-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}

.benrishi-office-info {
    flex: 1;
}

.benrishi-office-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.benrishi-pickup-badge {
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    color: white;
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.05em;
}

.benrishi-office-name {
    font-size: 14px; /* スマホ用に縮小 */
    font-weight: 700;
    color: #334155;
    transition: color 0.3s ease;
}

@media (min-width: 768px) {
    .benrishi-office-name {
        font-size: 16px;
    }
}

.benrishi-office-card:hover .benrishi-office-name {
    color: #1d4ed8;
}

.benrishi-office-address {
    font-size: 11px; /* スマホ用に縮小 */
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

@media (min-width: 768px) {
    .benrishi-office-address {
        font-size: 12px;
    }
}

.benrishi-office-address svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

.benrishi-arrow-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.benrishi-office-card:hover .benrishi-arrow-icon {
    background: #2563eb;
    color: white;
    transform: translateX(4px);
}

.benrishi-arrow-icon svg {
    width: 16px;
    height: 16px;
}

/* 空状態 */
.benrishi-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: #cbd5e1;
    opacity: 0.6;
}

.benrishi-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
}

.benrishi-empty-state p {
    font-size: 14px;
    font-weight: 500;
}
