/* ============================================================
   kashi/css/styles.css
   Overrides and additions for the kashi items map.
   Base styles come from ../css/styles.css
   ============================================================ */

/* ── Kashi badge in header ── */
.kashi-badge {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 4px;
    font-size: 11px;
    padding: 2px 6px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── View tab bar ── */
.view-tabs {
    display: flex;
    background: #f1f3f4;
    border-bottom: 2px solid #ddd;
    padding: 0 16px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: #002d7f;
}

.tab-btn.active {
    color: #002d7f;
    border-bottom-color: #002d7f;
}

/* ── View toggle button (within map sidebar) ── */
#toggle-view-btn {
    width: 100%;
    margin-top: 10px;
    margin-bottom: 4px;
    padding: 8px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: background 0.2s;
}
#toggle-view-btn:hover { background: #1557b0; }

/* ── Chain / subchain filter panel ── */
.filter-section-title {
    font-weight: bold;
    font-size: 13px;
    margin: 12px 0 6px;
    color: #002d7f;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.filter-checkbox input[type=checkbox] {
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}
.filter-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.subchain-checkbox {
    padding-right: 16px;
    font-size: 12px;
    color: #555;
}

.no-subchains {
    font-size: 12px;
    color: #999;
    padding-right: 16px;
}

#chain-filters,
#subchain-filters {
    max-height: 180px;
    overflow-y: auto;
}

/* ── Select all / deselect all row ── */
.select-all-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.select-all-btn {
    flex: 1;
    padding: 4px 8px;
    font-size: 11px;
    background: #f0f4ff;
    color: #002d7f;
    border: 1px solid #c5cae9;
    border-radius: 4px;
    cursor: pointer;
}
.select-all-btn:hover { background: #dde4ff; }

/* ── Logo markers ── */
.logo-marker-inner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.logo-marker-inner img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* ── Cluster in logo mode ── */
.marker-cluster-logo {
    background-color: rgba(100, 100, 100, 0.6);
}
.marker-cluster-logo div {
    background-color: rgba(60, 60, 60, 0.7);
    color: white;
}

/* ── Popup note ── */
.popup-note {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

/* ── Store detail note ── */
.detail-note {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

/* ── Table view toolbar ── */
#view-table {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: #fff;
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #ddd;
    background: #fafafa;
    flex-shrink: 0;
}

.table-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    direction: rtl;
}
.table-search-input:focus {
    outline: none;
    border-color: #002d7f;
}

.download-btn {
    padding: 8px 14px;
    background: #002d7f;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.2s;
}
.download-btn:hover { background: #001f57; color: white; }

/* ── Kashi data table ── */
#kashi-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
}

.table-loading {
    text-align: center;
    color: #888;
    padding: 40px;
    font-size: 15px;
}

.kashi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 12px;
}

.kashi-table th {
    background: #002d7f;
    color: white;
    padding: 10px 12px;
    text-align: right;
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.kashi-table th:hover { background: #003a99; }
.kashi-table th.sort-asc::after { content: ' ▲'; font-size: 10px; }
.kashi-table th.sort-desc::after { content: ' ▼'; font-size: 10px; }

.kashi-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
}

.kashi-table tbody tr:hover { background: #f0f4ff; }
.kashi-table tbody tr:nth-child(even) { background: #f9f9f9; }
.kashi-table tbody tr:nth-child(even):hover { background: #f0f4ff; }

.kashi-table .col-diff {
    font-weight: bold;
    direction: ltr;
    text-align: center;
}

.diff-dark-green  { color: #006400; }
.diff-light-green { color: #2e8b2e; }
.diff-neutral     { color: #7a7a00; }
.diff-orange      { color: #cc6e00; }
.diff-red         { color: #cc0000; }

.table-empty {
    text-align: center;
    color: #888;
    padding: 40px;
    font-style: italic;
}

.table-count {
    font-size: 12px;
    color: #666;
    padding: 8px 0 0;
    text-align: left;
    direction: ltr;
}

/* ── Mobile adjustments ── */
@media (max-width: 768px) {
    .sidebar {
        max-height: 220px;
    }

    #chain-filters,
    #subchain-filters {
        max-height: 80px;
    }

    .filter-section-title {
        font-size: 12px;
        margin: 8px 0 4px;
    }

    .filter-checkbox {
        font-size: 11px;
        margin-bottom: 4px;
    }

    #toggle-view-btn {
        font-size: 12px;
        padding: 6px;
        margin-top: 6px;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .kashi-table {
        font-size: 11px;
    }

    .kashi-table th,
    .kashi-table td {
        padding: 6px 8px;
    }
}
