/* ── Palia Stores Tracker — Frontend CSS ── */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Exo+2:wght@300;400;600;700&display=swap');

#pst2-app {
    --pst2-bg:        #0d0820;
    --pst2-bg-card:   #160d30;
    --pst2-bg-sidebar:#120a28;
    --pst2-accent:    #4dd9ff;
    --pst2-accent2:   #22b8d9;
    --pst2-green:     #2dd36f;
    --pst2-gold:      #f0b429;
    --pst2-red:       #ff6b6b;
    --pst2-text:      #e0d0f8;
    --pst2-muted:     #7d6898;
    --pst2-border:    #2e1f50;
    --pst2-font-d:    'Rajdhani', sans-serif;
    --pst2-font-b:    'Exo 2', sans-serif;

    background: var(--pst2-bg);
    color: var(--pst2-text);
    font-family: var(--pst2-font-b);
    min-height: 300px;
    padding: 24px 20px;
    border-radius: 12px;
    box-sizing: border-box;
}

/* ── Page header ── */
#pst2-app .pst2-page-header {
    margin-bottom: 24px;
}
#pst2-app .pst2-page-title {
    font-family: var(--pst2-font-d);
    font-size: 2em;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--pst2-accent);
}
#pst2-app .pst2-page-subtitle {
    font-size: 14px;
    color: var(--pst2-muted);
    margin: 0;
}

/* ── Buttons ── */
#pst2-app .pst2-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--pst2-font-b);
    padding: 8px 16px;
    transition: opacity .15s;
    text-decoration: none;
    background: var(--pst2-bg-card);
    color: var(--pst2-text);
    border: 1px solid var(--pst2-border);
}
#pst2-app .pst2-btn:hover { opacity: .8; }
#pst2-app .pst2-btn-back  { color: var(--pst2-accent); border-color: var(--pst2-accent); }
#pst2-app .pst2-btn-nav   { color: var(--pst2-accent); border-color: var(--pst2-accent); font-size: 13px; }

/* ── Nav bar ── */
#pst2-app .pst2-nav-bar {
    margin-bottom: 20px;
}

/* ── Notice ── */
#pst2-app .pst2-notice {
    background: rgba(77, 217, 255, .1);
    border: 1px solid var(--pst2-accent);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--pst2-accent);
    margin-bottom: 20px;
}
#pst2-app .pst2-empty {
    color: var(--pst2-muted);
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

/* ── Area grid ── */
#pst2-app .pst2-area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Area card ── */
#pst2-app .pst2-area-card {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform .2s, box-shadow .2s;
    border: 1px solid var(--pst2-border);
}
#pst2-app .pst2-area-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 28px rgba(0,0,0,.5);
}

/* Gradient overlay */
#pst2-app .pst2-area-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.75) 100%);
    z-index: 1;
}

/* Area name */
#pst2-app .pst2-area-name {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 2;
    font-family: var(--pst2-font-d);
    font-size: 1.3em;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* Store count badge */
#pst2-app .pst2-area-count-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    background: rgba(0,0,0,.6);
    color: #fff;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* Area placeholder colors (when no map image) */
#pst2-app .pst2-area-color-0 { background: linear-gradient(135deg, #1a3a2a 0%, #2d6a4f 100%); }
#pst2-app .pst2-area-color-1 { background: linear-gradient(135deg, #0a2a4a 0%, #1565c0 100%); }
#pst2-app .pst2-area-color-2 { background: linear-gradient(135deg, #2a0a4a 0%, #7b2d8b 100%); }
#pst2-app .pst2-area-color-3 { background: linear-gradient(135deg, #0a3a3a 0%, #00838f 100%); }
#pst2-app .pst2-area-color-4 { background: linear-gradient(135deg, #3a2a0a 0%, #f57f17 50%, #bf360c 100%); }
#pst2-app .pst2-area-color-5 { background: linear-gradient(135deg, #1a1a3a 0%, #283593 50%, #4a148c 100%); }

/* ── Area detail page ── */
#pst2-app .pst2-area-title {
    font-family: var(--pst2-font-d);
    font-size: 2em;
    font-weight: 700;
    color: var(--pst2-accent);
    margin: 0 0 4px;
}
#pst2-app .pst2-area-subtitle {
    font-size: 13px;
    color: var(--pst2-muted);
    margin: 0 0 20px;
}
#pst2-app .pst2-area-map {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 24px;
    display: block;
}

/* ── Store grid ── */
#pst2-app .pst2-store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* ── Store card ── */
#pst2-app .pst2-store-card {
    background: var(--pst2-bg-card);
    border: 1px solid var(--pst2-border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    position: relative;
    display: flex;
    flex-direction: column;
}
#pst2-app .pst2-store-card:hover {
    transform: translateY(-3px);
    border-color: var(--pst2-accent);
    box-shadow: 0 6px 20px rgba(77, 217, 255, .18);
}
#pst2-app .pst2-store-card.pst2-store-visited {
    opacity: .75;
}
#pst2-app .pst2-visited-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: var(--pst2-green);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
#pst2-app .pst2-store-card-img-wrap {
    position: relative;
    width: 100%;
    height: 100px;
    background: rgba(0,0,0,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#pst2-app .pst2-store-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#pst2-app .pst2-store-card-icon {
    position: absolute;
    font-size: 2.5em;
    opacity: .25;
}
#pst2-app .pst2-store-card-icon-only {
    position: static;
    opacity: .5;
    font-size: 2.5em;
}
#pst2-app .pst2-store-card-body {
    padding: 10px 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#pst2-app .pst2-store-card-name {
    font-family: var(--pst2-font-d);
    font-size: 1em;
    font-weight: 700;
    color: var(--pst2-text);
    line-height: 1.2;
}
#pst2-app .pst2-store-type-badge {
    display: inline-block;
    font-size: 10px;
    color: var(--pst2-muted);
    background: rgba(255,255,255,.06);
    border-radius: 4px;
    padding: 2px 6px;
    align-self: flex-start;
}
#pst2-app .pst2-store-owner {
    font-size: 11px;
    color: var(--pst2-muted);
}

/* ── Detail view layout ── */
#pst2-app .pst2-detail-title {
    font-family: var(--pst2-font-d);
    font-size: 2em;
    font-weight: 700;
    color: var(--pst2-accent);
    margin: 0 0 20px;
}
#pst2-app .pst2-detail-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}
#pst2-app .pst2-detail-sidebar {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#pst2-app .pst2-detail-main {
    flex: 1;
    min-width: 0;
}

/* ── Sidebar ── */
#pst2-app .pst2-sidebar-img {
    width: 100%;
    border-radius: 10px;
    display: block;
}
#pst2-app .pst2-sidebar-img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--pst2-bg-card);
    border: 1px solid var(--pst2-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
    color: var(--pst2-muted);
}
#pst2-app .pst2-sidebar-name {
    font-family: var(--pst2-font-d);
    font-size: 1.2em;
    font-weight: 700;
    color: var(--pst2-text);
}
#pst2-app .pst2-info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
#pst2-app .pst2-info-table td {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    vertical-align: top;
}
#pst2-app .pst2-info-label {
    color: var(--pst2-muted);
    padding-right: 10px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
#pst2-app .pst2-npc-link {
    color: var(--pst2-accent);
    text-decoration: none;
}
#pst2-app .pst2-npc-link:hover { text-decoration: underline; }

/* ── Visited label ── */
#pst2-app .pst2-visited-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pst2-muted);
    cursor: pointer;
    padding: 10px 12px;
    background: var(--pst2-bg-card);
    border: 1px solid var(--pst2-border);
    border-radius: 8px;
    transition: border-color .15s;
}
#pst2-app .pst2-visited-label input { accent-color: var(--pst2-green); }
#pst2-app .pst2-visited-label.active {
    color: var(--pst2-green);
    border-color: var(--pst2-green);
}

/* ── Tabs ── */
#pst2-app .pst2-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--pst2-border);
    margin-bottom: 20px;
}
#pst2-app .pst2-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--pst2-muted);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--pst2-font-b);
    font-weight: 600;
    padding: 10px 18px;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
#pst2-app .pst2-tab:hover { color: var(--pst2-text); }
#pst2-app .pst2-tab.active {
    color: var(--pst2-accent);
    border-bottom-color: var(--pst2-accent);
}

/* ── Tab content ── */
#pst2-app .pst2-tab-empty {
    color: var(--pst2-muted);
    font-size: 14px;
    font-style: italic;
    padding: 20px 0;
}
#pst2-app .pst2-store-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--pst2-text);
    margin: 0 0 16px;
}
#pst2-app .pst2-content {
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 500px;
    overflow: auto;
    background: rgba(0,0,0,.35);
    border-radius: 8px;
    padding: 12px;
    color: var(--pst2-text);
    border: 1px solid var(--pst2-border);
}

/* ── Inventory table ── */
#pst2-app .pst2-inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
#pst2-app .pst2-inventory-table th {
    text-align: left;
    padding: 8px 12px;
    background: rgba(255,255,255,.06);
    color: var(--pst2-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--pst2-border);
}
#pst2-app .pst2-inventory-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    vertical-align: middle;
}
#pst2-app .pst2-inventory-table tbody tr:nth-child(odd) td {
    background: rgba(255,255,255,.03);
}
#pst2-app .pst2-inventory-table tbody tr:hover td {
    background: rgba(77, 217, 255, .06);
}

/* ── Prev/Next nav ── */
#pst2-app .pst2-detail-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--pst2-border);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    #pst2-app .pst2-area-grid {
        grid-template-columns: 1fr;
    }
    #pst2-app .pst2-store-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    #pst2-app .pst2-detail-layout {
        flex-direction: column;
        gap: 20px;
    }
    #pst2-app .pst2-detail-sidebar {
        flex: none;
        width: 100%;
    }
    #pst2-app .pst2-sidebar-img-placeholder {
        aspect-ratio: auto;
        height: 120px;
    }
}
