/* ═══════════════════════════════════════════════════════════
   PriceDb — Futuristic Dark Theme
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #1f2a42;
    --bg-input: #0f1629;
    --border-color: #1e2d4a;
    --border-glow: #3b82f6;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #8899b0;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --danger: #ef4444;
    --cyan: #06b6d4;
    --purple: #8b5cf6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── LAYOUT ── */
.app-layout {
    display: flex;
    height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 240px;
    min-width: 240px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--accent), transparent);
    opacity: 0.3;
}

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

.sidebar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.sidebar-brand small {
    display: block;
    font-size: 0.6rem;
    letter-spacing: 3px;
    -webkit-text-fill-color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 16px 12px 6px;
    margin: 0;
}

.sidebar .nav-link {
    color: var(--text-secondary);
    border-radius: 8px;
    margin-bottom: 2px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
}

.sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.1));
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
}

#monitor-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.monitor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.monitor-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
    animation: pulse-dot 2s infinite;
}

.monitor-dot.error {
    background: var(--danger);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── MAIN CONTENT ── */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--bg-primary);
}

#view-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* ── CARDS ── */
.card, .panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.card:hover { border-color: rgba(59, 130, 246, 0.2); }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ── PAGE HEADER ── */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── SEARCH BAR ── */
.search-bar {
    position: relative;
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ── TABLES ── */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: #ffffff !important;
    --bs-table-bg: transparent !important;
    --bs-table-color: #ffffff !important;
    --bs-table-striped-bg: transparent !important;
    --bs-table-hover-bg: transparent !important;
    --bs-table-border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
}

.table thead th {
    background: #0d1325 !important;
    border: none;
    padding: 10px 14px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted) !important;
    font-weight: 600;
    white-space: nowrap;
}

.table thead th:first-child { border-radius: 8px 0 0 8px; }
.table thead th:last-child { border-radius: 0 8px 8px 0; }

.table tbody tr {
    transition: background 0.15s ease;
    background-color: var(--bg-card) !important;
}

.table tbody tr:nth-of-type(odd) {
    background-color: #151d30 !important;
}

.table tbody tr:hover {
    background-color: #1c2a45 !important;
}

.table tbody td {
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    vertical-align: middle;
    color: #ffffff !important;
    background-color: inherit !important;
}

/* ── EAN LINKS ── */
.ean-link {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
    font-weight: 600;
    color: var(--cyan) !important;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.ean-link:hover {
    color: var(--accent-hover) !important;
    text-decoration: none;
}

/* ── BADGES ── */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge.bg-success { background: rgba(16, 185, 129, 0.15) !important; color: var(--success) !important; }
.badge.bg-warning { background: rgba(245, 158, 11, 0.15) !important; color: var(--warning) !important; }
.badge.bg-danger { background: rgba(239, 68, 68, 0.15) !important; color: var(--danger) !important; }
.badge.bg-secondary { background: rgba(148, 163, 184, 0.1) !important; color: var(--text-muted) !important; }
.badge.bg-info { background: rgba(6, 182, 212, 0.15) !important; color: var(--cyan) !important; }

/* ── PRICE HIGHLIGHT ── */
.price-best {
    color: var(--success);
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
}

.price-normal {
    color: #ffffff;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
}

/* ── STAT CARDS ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    transition: border-color 0.3s ease, transform 0.2s ease;
}

.stat-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-value.blue { color: var(--accent); }
.stat-value.green { color: var(--success); }
.stat-value.cyan { color: var(--cyan); }
.stat-value.purple { color: var(--purple); }

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── BUTTONS ── */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 18px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #3b82f6);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    box-shadow: 0 0 20px var(--success-glow);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    border-color: var(--warning);
    color: #000;
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-secondary:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
}

.btn-outline-danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
    background: transparent;
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.btn-outline-info {
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan);
    background: transparent;
}

.btn-outline-info:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--cyan);
}

.btn-group .btn { border-radius: 8px; margin-right: 6px; }

/* ── FORM CONTROLS ── */
.form-control, .form-select {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
    outline: none;
}

.form-control::placeholder { color: var(--text-muted) !important; }

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-text {
    color: var(--text-muted) !important;
    font-size: 0.75rem;
}

/* ── ALERTS ── */
.alert {
    border-radius: 10px;
    border: 1px solid;
    font-size: 0.85rem;
}

.alert-info {
    background: rgba(59, 130, 246, 0.08) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    color: var(--accent-hover) !important;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
    color: var(--success) !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08) !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
    color: var(--warning) !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: var(--danger) !important;
}

.alert-secondary {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

/* ── PAGINATION ── */
.pagination .page-link {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px !important;
    margin: 0 2px;
}

.pagination .page-link:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ── TOAST NOTIFICATIONS ── */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    max-width: 400px;
    background: var(--bg-card) !important;
    border: 1px solid var(--accent) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4), 0 0 20px var(--accent-glow);
    animation: slideIn 0.3s ease-out;
    border-radius: 10px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── BEST PRICE TOAST ── */
.toast-best-price {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    max-width: 450px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #042f1a, #0a3d23) !important;
    border: 1px solid var(--success) !important;
    border-left: 4px solid var(--success) !important;
    color: #ffffff !important;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 30px var(--success-glow), 0 0 60px rgba(16, 185, 129, 0.1);
    animation: slideIn 0.3s ease-out, pulseGlow 2s ease-in-out 3;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 30px var(--success-glow); }
    50% { box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 50px rgba(16, 185, 129, 0.4); }
}

/* ── DETAIL ROW ── */
.detail-row td {
    border-bottom: 1px solid var(--border-color) !important;
}

.detail-row .bg-light {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.detail-row pre {
    background: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

.detail-row details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.8rem;
}

/* ── HR ── */
hr {
    border-color: var(--border-color) !important;
    opacity: 0.5;
}

/* ── CLOSE BUTTON ── */
.btn-close {
    filter: invert(1) brightness(0.7);
}

/* ── INPUT GROUP ── */
.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

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

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ── GLOW EFFECTS ── */
.glow-line {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--cyan));
    border-radius: 2px;
    margin-bottom: 20px;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .sidebar { width: 60px; min-width: 60px; }
    .sidebar .nav-link span { display: none; }
    .sidebar-brand, .nav-section-label, .sidebar-brand small { display: none; }
    .sidebar-header { padding: 12px; }
    .sidebar .nav-link { justify-content: center; padding: 10px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
