/* ============================================
   GC Product Manager – Dark Theme
   ============================================ */

:root {
    --bg:        #0f1117;
    --surface:   #1a1d27;
    --surface2:  #222536;
    --border:    #2a2d3d;
    --accent:    #6366f1;
    --accent-h:  #818cf8;
    --success:   #22c55e;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --info:      #38bdf8;
    --text:      #e2e8f0;
    --text-muted:#64748b;
    --text-dim:  #94a3b8;
    --sidebar-w: 220px;
    --radius:    8px;
    --radius-sm: 4px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   Layout
   ============================================ */

#app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#main {
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
}

#view-container {
    padding: 28px 32px;
    min-height: 100%;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 20px;
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.nav-item:hover {
    background: var(--surface2);
    color: var(--text);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-h);
}

.nav-icon {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    font-size: 10px;
    background: var(--surface2);
    color: var(--text-muted);
    padding: 1px 5px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.conn-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conn-unknown .conn-dot  { background: var(--text-muted); }
.conn-ok      .conn-dot  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.conn-error   .conn-dot  { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

/* ============================================
   Page Header
   ============================================ */

.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.3);
}
.btn-success:hover { background: rgba(34, 197, 94, 0.25); }

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   Stats Row (Dashboard)
   ============================================ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-card.stat-warning  { border-color: rgba(245, 158, 11, 0.4); }
.stat-card.stat-danger   { border-color: rgba(239, 68, 68, 0.4); }
.stat-card.stat-success  { border-color: rgba(34, 197, 94, 0.3); }
.stat-card.stat-info     { border-color: rgba(56, 189, 248, 0.3); }

.stat-card.stat-warning  .stat-value { color: var(--warning); }
.stat-card.stat-danger   .stat-value { color: var(--danger); }
.stat-card.stat-success  .stat-value { color: var(--success); }
.stat-card.stat-info     .stat-value { color: var(--info); }

/* ============================================
   Table
   ============================================ */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

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

thead th {
    background: var(--surface);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

tbody td {
    padding: 10px 14px;
    color: var(--text);
    vertical-align: middle;
}

/* ============================================
   Badges
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger);  }
.badge-info    { background: rgba(56,189,248,0.12); color: var(--info);    }
.badge-muted   { background: var(--surface2);       color: var(--text-muted); }

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

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

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: rgba(34,197,94,0.08);  border-color: var(--success); color: var(--success); }
.alert-warning { background: rgba(245,158,11,0.08); border-color: var(--warning); color: var(--warning); }
.alert-danger  { background: rgba(239,68,68,0.08);  border-color: var(--danger);  color: var(--danger); }
.alert-info    { background: rgba(56,189,248,0.08); border-color: var(--info);    color: var(--info); }

/* ============================================
   File Drop Zone
   ============================================ */

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(99,102,241,0.05);
    color: var(--text);
}

.drop-zone-icon { font-size: 32px; margin-bottom: 8px; }
.drop-zone-text { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.drop-zone-hint { font-size: 12px; color: var(--text-muted); }

/* ============================================
   Progress
   ============================================ */

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s;
}

/* ============================================
   Matrix (Slot Manager / Dashboard)
   ============================================ */

.matrix-table th:first-child,
.matrix-table td:first-child {
    background: var(--surface2);
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
}

.matrix-cell {
    min-width: 120px;
    vertical-align: middle;
}

.slot-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.slot-card:hover { border-color: var(--accent); }
.slot-card.slot-ok      { border-color: rgba(34,197,94,0.3); }
.slot-card.slot-oos     { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.05); }
.slot-card.slot-empty   { border-style: dashed; color: var(--text-muted); text-align: center; }
.slot-card.slot-warning { border-color: rgba(245,158,11,0.4); }

.slot-name  { font-weight: 600; color: var(--text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-price { color: var(--text-muted); font-size: 11px; }
.slot-status-icon { float: right; }

/* ============================================
   Kanban (Pipeline)
   ============================================ */

.kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
}

.kanban-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.kanban-col-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-col-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
}

.kanban-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
}

.kanban-card-name {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}

.kanban-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kanban-card-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

/* ============================================
   Fuzzy Match (EAN Matcher)
   ============================================ */

.match-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.match-product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text);
}

.match-candidates {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.match-candidate {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}

.match-candidate:hover { border-color: var(--accent); }
.match-candidate.selected { border-color: var(--success); background: rgba(34,197,94,0.07); }

.match-score {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.score-high   { background: rgba(34,197,94,0.2);  color: var(--success); }
.score-medium { background: rgba(245,158,11,0.2); color: var(--warning); }
.score-low    { background: rgba(239,68,68,0.15); color: var(--danger);  }

.match-candidate-name { flex: 1; }
.match-candidate-ean  { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.match-candidate-price { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.empty-state-text  { font-size: 13px; }

/* ============================================
   Loading
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    padding: 20px 0;
    font-size: 13px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Misc
   ============================================ */

.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.mono         { font-family: 'Consolas', 'Monaco', monospace; font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Tooltip */
[title] { cursor: help; }

/* Produkte View */
.row-selected { background: var(--surface2) !important; outline: 2px solid var(--accent); outline-offset: -2px; }

/* Katalog Tabs */
.tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    margin-top: 16px;
}

.tab-btn {
    padding: 8px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}

.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent-h); border-bottom-color: var(--accent-h); }

.btn-danger {
    background: rgba(239,68,68,.15);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }
