/* browse.css — user-facing hierarchy browser */

.browse-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* Breadcrumb row — back button + breadcrumb trail */
.breadcrumb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

#btn-back-drill {
    display: none;
    padding: 4px 12px;
    font-size: 0.85em;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

#btn-back-drill:hover {
    background: #e0e0e0;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.9em;
    margin-bottom: 0;
    color: #666;
}
.crumb {
    cursor: pointer;
    color: #00BFFF;
    text-decoration: underline;
}
.crumb.active {
    color: #333;
    text-decoration: none;
    cursor: default;
}
.crumb-sep { color: #aaa; }

/* Level info bar */
.level-info {
    margin-bottom: 18px;
    padding: 14px 18px;
    background: #f7fbff;
    border-left: 4px solid #00BFFF;
    border-radius: 0 6px 6px 0;
}
.level-info h2 { margin: 0 0 4px; font-size: 1.3em; }
.level-info p  { margin: 3px 0; color: #555; font-size: 0.9em; }
.level-price   { font-weight: bold; color: #0099cc; }

/* Search bar */
.browse-search {
    margin-bottom: 14px;
}
.browse-search input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box;
}
.browse-search input:focus { outline: none; border-color: #00BFFF; }

/* Node grid */
.node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

/* Node cards */
.node-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.18s, border-color 0.18s, background 0.18s, transform 0.18s;
}
.node-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }

/* Drillable hierarchy cards — whole card is interactive */
.node-card.drillable-card {
    cursor: pointer;
}
.node-card.drillable-card:hover {
    background: #e8f7ff;
    border-color: #00BFFF;
    box-shadow: 0 4px 14px rgba(0, 191, 255, 0.22);
    transform: translateY(-2px);
}
.node-card.drillable-card.status-for-sale:hover {
    background: #edfaf0;
    border-color: #4CAF50;
    box-shadow: 0 4px 14px rgba(76, 175, 80, 0.22);
}

/* Status variants */
.node-card.status-for-sale    { border-color: #4CAF50; }
.node-card.status-admin        { border-color: #00BFFF; }
.node-card.status-owned        { border-color: #9e9e9e; }
.node-card.status-available    { border-color: #c8b86a; background: #fffdf5; }
.node-card.status-checking     { border-color: #d0d0d0; }

.card-status {
    font-size: 0.72em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 10px;
    align-self: flex-start;
}
.status-for-sale .card-status  { background: #e8f5e9; color: #388e3c; }
.status-admin    .card-status  { background: #e3f4fd; color: #0077aa; }
.status-owned    .card-status  { background: #eeeeee; color: #555; }
.status-available .card-status { background: #f5eed6; color: #7a5e00; }
.status-checking  .card-status { background: #eeeeee; color: #666; }

.has-offers-badge {
    font-size: 0.68em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 10px;
    background: #fff3e0;
    color: #e65100;
    align-self: flex-start;
    margin-top: 2px;
}

.card-name {
    font-weight: bold;
    font-size: 1em;
    color: #222;
    display: flex;
    align-items: center;
    gap: 6px;
}
.country-code {
    font-size: 0.75em;
    color: #555;
    font-weight: normal;
    background: #e8e8e8;
    padding: 1px 5px;
    border-radius: 3px;
}
.card-price {
    font-size: 0.9em;
    color: #0099cc;
    font-weight: bold;
}
.card-earn-note {
    font-size: 0.78em;
    color: #555;
    font-style: italic;
}
.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* Buttons */
.btn-browse, .btn-buy, .btn-available {
    padding: 5px 11px;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    line-height: 1.6;
}
.btn-browse    { background: #e3f4fd; color: #0077aa; }
.btn-browse:hover { background: #00BFFF; color: #fff; }
.btn-buy       { background: #4CAF50; color: #fff; }
.btn-buy:hover { background: #388e3c; }
.btn-available { background: #f0e8c0; color: #7a5e00; cursor: default; font-style: italic; border: 1px solid #d4c078; }

/* Loading / empty states */
.loading-message, .empty-message, .error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 0.95em;
}
.error-message { color: #c62828; }
.available-hint { margin-top: 8px; }
.available-hint a { color: #00BFFF; }

/* District search (L4) */
.district-search-root { display: block; }

.district-search-section {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}
.district-search-hint {
    color: #555;
    font-size: 0.9em;
    margin-bottom: 10px;
}
.district-search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}
.district-search-bar input {
    flex: 1;
    max-width: 360px;
    padding: 9px 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}
.district-search-bar input:focus { outline: none; border-color: #00BFFF; }
.district-search-bar button {
    padding: 9px 18px;
    background: #00BFFF;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
}
.district-search-bar button:hover { background: #0099cc; }

.district-results { margin-top: 6px; }

.district-not-found {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px 20px;
    max-width: 420px;
}
.district-not-found-name {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin: 6px 0 10px;
    letter-spacing: 0.04em;
}
.district-not-found p { margin: 4px 0; color: #555; font-size: 0.9em; }
.district-price { font-weight: bold; color: #0099cc !important; }
.district-claim-note { color: #aaa !important; font-style: italic; font-size: 0.82em !important; }

/* District autocomplete suggestions */
.district-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.district-suggestion {
    padding: 4px 10px;
    background: #e3f4fd;
    color: #0077aa;
    border: 1px solid #b3dff5;
    border-radius: 14px;
    cursor: pointer;
    font-size: 0.85em;
}
.district-suggestion:hover { background: #00BFFF; color: #fff; border-color: #00BFFF; }

/* Claim button (enabled, on unclaimed cards) */
.btn-claim, .btn-claim-district {
    padding: 5px 12px;
    border: 1px solid #4caf50;
    border-radius: 4px;
    background: #e8f5e9;
    color: #388e3c;
    font-size: 0.85em;
    cursor: pointer;
    line-height: 1.6;
}
.btn-claim:hover, .btn-claim-district:hover { background: #4caf50; color: #fff; }

/* Inline claim confirmation panel */
.claim-panel {
    margin-top: 10px;
    padding: 12px;
    background: #f0f8ff;
    border: 1px solid #b3dff5;
    border-radius: 6px;
    font-size: 0.88em;
}
.claim-panel-name  { font-size: 1.05em; margin-bottom: 4px; }
.claim-panel-desc  { color: #555; margin: 4px 0; }
.claim-panel-earn  { color: #0077aa; margin: 3px 0; font-style: italic; }
.claim-panel-price { font-weight: bold; color: #0099cc; margin: 4px 0; }
.claim-panel-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn-confirm-claim {
    padding: 6px 14px; background: #4caf50; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 0.9em;
}
.btn-confirm-claim:hover:not(:disabled) { background: #388e3c; }
.btn-confirm-claim:disabled { opacity: 0.5; cursor: default; }
.btn-cancel-claim {
    padding: 6px 10px; background: none; color: #888;
    border: 1px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 0.9em;
}
.claim-panel-status { margin-top: 6px; min-height: 18px; }
.claim-flag { font-size: 1.3em; }

/* Two-option claim panel layout */
.claim-options {
    display: flex;
    gap: 12px;
    margin: 10px 0;
    flex-wrap: wrap;
}
.claim-option {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
}
.claim-option-activate {
    background: #e3f2fd;
    border-color: #90caf9;
}
.claim-option-title {
    font-weight: bold;
    font-size: 0.95em;
    margin-bottom: 4px;
}
.claim-option-desc {
    font-size: 0.82em;
    color: #555;
    margin-bottom: 6px;
    line-height: 1.4;
}
.claim-option-earn {
    font-size: 0.8em;
    color: #0077aa;
    font-style: italic;
    margin-bottom: 6px;
}
.claim-option-price {
    font-weight: bold;
    color: #0099cc;
    font-size: 0.9em;
    margin-bottom: 8px;
}
.btn-confirm-activate {
    padding: 6px 14px; background: #1976d2; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 0.9em;
    width: 100%;
}
.btn-confirm-activate:hover:not(:disabled) { background: #1565c0; }
.btn-confirm-activate:disabled { opacity: 0.5; cursor: default; }
.btn-confirm-claim { width: 100%; }
.claim-panel-footer { margin-top: 8px; }

/* Create-node form for L5/L6 */
.create-node-card {
    margin-top: 18px;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px dashed #bbb;
    border-radius: 8px;
    font-size: 0.88em;
}
.create-node-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #444;
}
.create-node-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.create-node-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
}
.btn-open-creator {
    padding: 6px 14px;
    background: #0099cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
}
.btn-open-creator:hover { background: #007aaa; }
.create-node-hint {
    color: #777;
    font-size: 0.82em;
    margin: 0;
    line-height: 1.4;
}

.district-existing { grid-column: 1 / -1; margin-top: 10px; }
.district-existing-title {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Region cards — slightly larger for L2 */
.node-grid.regions-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.regions-grid .node-card { text-align: center; padding: 20px 14px; }
.regions-grid .card-name { justify-content: center; font-size: 1.1em; }
.region-icon { font-size: 2em; }

/* ── L7 item callout banner ── */
.hidden { display: none; }

.level7-callout {
    background: #0d2b45;
    border-left: 4px solid #00BFFF;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 10px;
    color: #e0f4ff;
    font-size: 0.95em;
}

/* ── L7 item cards — clickable ── */
.node-card.item-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.node-card.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 191, 255, 0.25);
}
.btn-detail {
    display: inline-block;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid #00BFFF;
    color: #00BFFF;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    text-decoration: none;
    margin-top: 4px;
}
.btn-detail:hover { background: #00BFFF; color: #fff; }

/* ── Country flag images ──────────────────────────────────── */
.country-flag-img {
    width: 40px;
    height: 28px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.12);
    display: block;
}
.region-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
}

/* ── L7 item card cover image ─────────────────────────────── */
.card-cover {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #1a1a1a;
}
.card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── L5/L6 create-node image row ──────────────────────────── */
.create-node-image-row {
    margin-top: 8px;
}
.create-node-image-label {
    font-size: 0.82em;
    color: #888;
}

/* ── L7 item create form ──────────────────────────────────── */
.item-create-card {
    max-width: 700px;
}
.item-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}
.item-form-row label {
    font-size: 0.88em;
    font-weight: 600;
    color: #444;
}
.item-form-row input[type="text"],
.item-form-row input[type="number"],
.item-form-row select,
.item-form-row textarea {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.item-form-row input[type="file"] {
    font-size: 0.88em;
}
.item-form-hint {
    font-size: 0.8em;
    color: #999;
}
.item-req {
    color: #e53935;
    font-weight: bold;
}
.item-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
    margin-bottom: 8px;
}
.item-details-grid > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.item-details-grid label {
    font-size: 0.82em;
    font-weight: 600;
    color: #555;
}
.item-details-grid input,
.item-details-grid select {
    padding: 5px 7px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.88em;
    width: 100%;
    box-sizing: border-box;
}
.item-gallery-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    min-height: 0;
}
.btn-open-item-creator {
    margin-top: 12px;
    padding: 9px 22px;
    background: #00BFFF;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
}
.btn-open-item-creator:hover { background: #009bcc; }
.btn-open-item-creator:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 480px) {
    .item-details-grid { grid-template-columns: 1fr; }
}
