/* PHOTO VIEWER — Uses shared CSS variables from base.css */

body.photo-viewer {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================================
   TOOLBAR — Matches main app header
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.toolbar h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.toolbar select,
.toolbar button {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.toolbar button:hover { background: var(--bg-shelf); }

.toolbar button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.toolbar .sep {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.toolbar label {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
}

.toolbar input[type="checkbox"] { accent-color: var(--accent); }

/* ============================================================
   LAYOUT
   ============================================================ */
.main-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.photos-grid {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: scroll;
    gap: 8px;
    padding: 8px;
    align-items: flex-start;
    cursor: grab;
}

.photos-grid.dragging { cursor: grabbing; }

/* ============================================================
   PHOTO CARDS
   ============================================================ */
.photo-card {
    position: relative;
    background: #0a0c12;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: visible;
    flex-shrink: 0;
    text-align: center;
}

.photo-card .photo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.photo-card .photo-title {
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.photo-card .photo-stats {
    color: var(--text-secondary);
    font-size: 10px;
    white-space: nowrap;
}

.photo-card .photo-stats strong { color: var(--text-primary); }

/* ============================================================
   CANVAS / IMAGE OVERLAY
   ============================================================ */
.canvas-inner {
    position: relative;
    display: inline-block;
}

.canvas-inner img {
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.canvas-inner svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ============================================================
   BOUNDING BOXES (SVG)
   ============================================================ */
.bbox-product {
    pointer-events: all;
    cursor: pointer;
    transition: opacity 0.15s;
}

.bbox-product:hover { opacity: 1 !important; }

.bbox-shelf {
    pointer-events: all;
    cursor: pointer;
}

.bbox-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* ============================================================
   SIDE PANEL — Inline right panel (Actions + Analytics)
   ============================================================ */
.side-panel {
    width: 0;
    min-width: 0;
    background: var(--bg-card);
    border-left: none;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, min-width 0.25s ease, border-left 0.25s ease;
}

.side-panel.open {
    width: 420px;
    min-width: 420px;
    border-left: 1px solid var(--border);
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.side-panel-tabs {
    display: flex;
    flex: 1;
}

.side-panel-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.side-panel-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}

.side-panel-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.side-panel-tab[data-tab="actions"].active {
    color: #f59e0b;
    border-bottom-color: #f59e0b;
}

.tab-badge,
#actionsBadge {
    display: inline-block;
    background: rgba(245,158,11,0.3);
    color: #f59e0b;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

.side-panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.15s;
}

.side-panel-close:hover {
    color: var(--text-primary);
    background: var(--bg-dark);
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    font-size: 12px;
    min-height: 0;
}

#tabActions {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel-body .field { margin-bottom: 8px; }

.side-panel-body .field-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.side-panel-body .field-value {
    color: var(--text-primary);
    word-break: break-word;
}

.side-panel-body .empty-state {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    margin-top: 40px;
}

#tabAnalytics {
    padding: 16px;
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-left: auto;
    font-size: 11px;
    color: var(--text-secondary);
}

.stats-bar span { white-space: nowrap; }
.stats-bar strong { color: var(--text-primary); }

/* ============================================================
   ZOOM CONTROLS
   ============================================================ */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.zoom-controls button {
    width: 28px;
    height: 28px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.zoom-controls .zoom-label {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

/* ============================================================
   BACK LINK
   ============================================================ */
.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.back-link:hover { text-decoration: underline; }

/* ============================================================
   PRODUCT LIST
   ============================================================ */
.product-list {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.product-list h3 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.product-list-item {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.1s;
}

.product-list-item:hover { background: rgba(74,158,255,0.1); }
.product-list-item.selected { background: rgba(74,158,255,0.18); }

.product-list-item .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.product-list-item .thumb {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 3px;
    background: var(--bg-shelf);
    flex-shrink: 0;
}

.product-list-item.not-in-plano {
    border-left: 3px solid var(--accent-red);
}

.product-list-item.out-of-shelf {
    border-left: 3px solid var(--accent-orange);
    opacity: 0.7;
}

/* ============================================================
   SEARCH INPUT
   ============================================================ */
.search-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 12px;
    margin-bottom: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--text-secondary); }
.search-input:focus { border-color: var(--accent); }

/* ============================================================
   DETAIL VIEW — Header, Thumb, Dims
   ============================================================ */
.detail-thumb {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--bg-shelf);
    border: 1px solid var(--border);
}

.detail-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.detail-header-info { flex: 1; }

.dims-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    font-size: 11px;
}

.dims-grid .dim-label { color: var(--text-secondary); font-size: 10px; }
.dims-grid .dim-value { color: var(--text-primary); font-family: monospace; }

/* ============================================================
   TAGS — Metadata labels
   ============================================================ */
.tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 3px;
}

.tag-brand { background: rgba(74,158,255,0.15); color: var(--accent); }
.tag-category { background: var(--bg-dark); color: var(--accent-green); border: 1px solid var(--border); }
.tag-price { background: rgba(250,204,21,0.12); color: #facc15; }
.tag-photo { background: rgba(74,158,255,0.15); color: #facc15; }

/* ============================================================
   STATUS TAGS — Planogram comparison (shared base)
   ============================================================ */
.tag-plano,
.tag-photo-f,
.tag-alert,
.tag-oos {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    margin-right: 3px;
}

.tag-plano  { background: rgba(52,211,153,0.12);  color: var(--accent-green);  border: 1px solid rgba(52,211,153,0.25); }
.tag-photo-f{ background: rgba(74,158,255,0.15);   color: var(--accent); }
.tag-alert  { background: rgba(239,68,68,0.12);    color: var(--accent-red);    border: 1px solid rgba(239,68,68,0.25); }
.tag-oos    { background: rgba(245,158,11,0.12);   color: var(--accent-orange); border: 1px solid rgba(245,158,11,0.25); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.filter-btn {
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.filter-btn:hover { background: var(--bg-shelf); color: var(--text-primary); }

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.filter-counts {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ============================================================
   VIEW TOGGLE — Matches s-toggle from components.css
   ============================================================ */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    padding: 5px 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}

.view-toggle button.active {
    background: var(--accent);
    color: #fff;
}

.view-toggle button:not(.active):hover {
    background: var(--bg-shelf);
    color: var(--text-primary);
}

/* ============================================================
   ACTIONS CONTENT (inside side panel)
   ============================================================ */

.actions-summary {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.actions-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.actions-stat-row strong { color: var(--text-primary); }

.actions-filters {
    padding: 10px 20px;
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.actions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.action-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    transition: background 0.15s;
}

.action-card:hover { background: rgba(74,158,255,0.06); }

.action-card.apri-high { border-left: 3px solid #ef4444; }
.action-card.apri-med { border-left: 3px solid #f59e0b; }
.action-card.apri-low { border-left: 3px solid var(--text-secondary); }

.action-rank {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 20px;
    text-align: center;
    padding-top: 2px;
}

.action-body { flex: 1; min-width: 0; }

.action-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.action-lost-sales {
    font-size: 13px;
    color: #f59e0b;
    margin-bottom: 5px;
}

.action-lost-sales strong {
    color: #fbbf24;
    font-weight: 700;
}

.action-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.action-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.action-stats strong { color: var(--text-primary); }

.action-size {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.action-priority {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

.action-priority.apri-high { background: rgba(239,68,68,0.15); color: #ef4444; }
.action-priority.apri-med { background: rgba(245,158,11,0.15); color: #f59e0b; }
.action-priority.apri-low { background: rgba(148,163,184,0.15); color: #94a3b8; }

.apri-high { color: #ef4444; }
.apri-med { color: #f59e0b; }
.apri-low { color: #94a3b8; }

#actionsBadge { margin-left: 4px; }

/* ============================================================
   SALES / METER LEGEND
   ============================================================ */
.spm-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    padding: 3px 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    white-space: nowrap;
}

.spm-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ============================================================
   SETTINGS DROPDOWN
   ============================================================ */
.settings-dropdown {
    position: relative;
}

.settings-btn {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.settings-btn:hover {
    background: var(--bg-shelf);
    border-color: var(--accent);
}

.settings-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    padding: 12px;
    min-width: 280px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: all 0.2s ease;
}

.settings-menu.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.settings-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.settings-section label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.settings-section label:hover {
    color: var(--accent);
}

.settings-section input[type="checkbox"] {
    accent-color: var(--accent);
}

.settings-section .view-toggle {
    margin-top: 6px;
}

.settings-section .zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.settings-section .zoom-controls button {
    flex: 1;
}

.settings-section .zoom-controls .zoom-label {
    flex: 0 0 auto;
}

/* ============================================================
   MINI PLANOGRAM UNDER PHOTO
   ============================================================ */
.plano-bay-section {
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
}

.plano-bay-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plano-mini {
    padding: 6px;
    min-height: 40px;
    overflow: hidden;
}

.plano-mini .br-bay {
    border-radius: 4px;
}

.plano-mini .br-bay-header {
    padding: 4px 8px;
    font-size: 10px;
    display: none;
}

.plano-mini .br-bay-footer {
    padding: 2px 6px;
    font-size: 9px;
}

.plano-mini .br-bay-body {
    overflow: visible;
}

.plano-mini .br-shelf-label {
    font-size: 8px;
}

.plano-mini .product-block:hover {
    transform: none;
    box-shadow: none;
}

.plano-loading {
    text-align: center;
    color: var(--text-secondary);
    font-size: 10px;
    padding: 12px;
    font-style: italic;
}

