* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: #f7f8fa;
    color: #222;
    line-height: 1.5;
}

/* ---- Store sub-nav ---- */
.store-subnav {
    background: #0d47a1;
    color: #fff;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.store-subnav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.store-subnav-name {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.store-title {
    font-weight: 700;
    font-size: 0.97em;
}

.store-location {
    font-size: 0.85em;
    opacity: 0.8;
}

.store-subnav-url {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    font-size: 0.8em;
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.store-subnav-url:hover {
    color: #fff;
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.45);
}

.store-subnav-copy-icon,
.store-subnav-check-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.store-subnav-check-icon {
    display: none;
}

.store-subnav-url.copied {
    color: #8fe6ac;
    background: rgba(143,230,172,0.14);
    border-color: rgba(143,230,172,0.55);
}

.store-subnav-url.copied .store-subnav-copy-icon {
    display: none;
}

.store-subnav-url.copied .store-subnav-check-icon {
    display: inline;
}

.store-subnav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.store-subnav-map {
    font-size: 0.82em;
    color: rgba(255,255,255,0.9);
    text-decoration: underline;
    white-space: nowrap;
}

.store-subnav-map:hover {
    color: #fff;
}

.store-subnav-edit {
    font-size: 0.82em;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    padding: 3px 9px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.store-subnav-edit:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ---- Main layout ---- */
.store-page-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .store-page-body { grid-template-columns: 1fr; }
}

/* ---- Sidebar ---- */
.sidebar .card {
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 18px;
}

.sidebar .card h3 {
    margin: 0 0 12px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
}

.sidebar .card p {
    margin: 0 0 8px;
    font-size: 0.95em;
}

.sidebar .card p:last-child { margin-bottom: 0; }

.map-link {
    display: block;
    margin-top: 10px;
    padding: 9px 14px;
    background: #1565C0;
    color: #fff;
    text-align: center;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.92em;
    font-weight: 600;
    transition: background 0.15s;
}

.map-link:hover { background: #0d47a1; }

.hours-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    padding: 3px 0;
    border-bottom: 1px solid #f0f0f0;
}

.hours-row:last-child { border-bottom: none; }

.hours-row .day { color: #555; }

/* ---- Inventory panel ---- */
.inventory-panel h2 {
    margin: 0 0 16px;
    font-size: 1.2em;
    font-weight: 600;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.95em;
    outline: none;
}

.search-bar input:focus {
    border-color: #1565C0;
    box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
}

/* ---- Category groups ---- */
.category-group {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    margin-bottom: 18px;
    overflow: hidden;
}

.category-group-header {
    padding: 11px 16px;
    background: #f0f4ff;
    font-weight: 600;
    font-size: 0.93em;
    color: #1a3a6b;
    border-bottom: 1px solid #dce6f5;
}

.category-group-header .parent-cat {
    font-weight: 400;
    color: #6a84aa;
    margin-right: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fb;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #777;
    padding: 8px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f2f2f2;
    font-size: 0.93em;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7f9ff; }

.item-name { font-weight: 500; }

.item-sub {
    font-size: 0.83em;
    color: #888;
    margin-top: 1px;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: 600;
}

.badge-new   { background: #e8f5e9; color: #2e7d32; }
.badge-good  { background: #e3f2fd; color: #1565C0; }
.badge-fair  { background: #fff8e1; color: #f57f17; }
.badge-poor  { background: #fce4ec; color: #c62828; }
.badge-other { background: #f3f3f3; color: #555; }

.qty-badge {
    font-size: 0.88em;
    font-weight: 600;
    color: #1565C0;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.empty-state p { margin: 8px 0 0; font-size: 0.95em; }

/* ---- Footer ---- */
.store-footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 0.82em;
    color: #aaa;
    border-top: 1px solid #eaeaea;
    margin-top: 20px;
}

/* ---- Photo thumbnails ---- */
.photo-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.photo-thumb-btn {
    width: 100%;
    height: 52px;
    overflow: hidden;
    display: block;
    border-radius: 4px;
    cursor: pointer;
    line-height: 0;
    outline: none;
}

.photo-thumb-btn:focus-visible {
    outline: 2px solid #1565C0;
    outline-offset: 2px;
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: block;
    transition: opacity 0.15s;
}

.photo-thumb-btn:hover .photo-thumb {
    opacity: 0.82;
}

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
}

.lightbox-fullsize-link {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82em;
    text-decoration: underline;
}

.lightbox-fullsize-link:hover { color: #fff; }

.lightbox-close {
    position: fixed;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.75;
    z-index: 9001;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 3rem;
    line-height: 1;
    cursor: pointer;
    padding: 16px 14px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.15s;
    user-select: none;
}

.lightbox-nav:hover:not(:disabled) { background: rgba(255, 255, 255, 0.28); }
.lightbox-nav:disabled { opacity: 0.2; cursor: default; }

.empty-photos-box {
    border: 2px dashed #ddd;
    border-radius: 6px;
    padding: 18px 12px;
    text-align: center;
    color: #bbb;
    font-size: 0.88em;
    margin-bottom: 10px;
}

.empty-photos-box p { margin: 0; }

.quick-upload-form {
    margin-top: 10px;
}

.upload-count {
    font-size: 0.78em;
    color: #888;
    margin-top: 4px;
}

.quick-upload-name {
    display: none;
    font-size: 0.82em;
    color: #555;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ---- Hidden (JS filter) ---- */
.item-row.hidden { display: none; }
.category-group.hidden { display: none; }
