/* ========================================
   DROP PANEL — Custom styles v2
   Bold, modern admin panel design
   Green accent, reference-matching
   ======================================== */

:root {
    --primary: #22C55E;
    --primary-hover: #16A34A;
    --primary-light: #86EFAC;
    --primary-subtle: #F0FDF4;
    --sidebar-width: 260px;
    --sidebar-bg: #FFFFFF;
    --body-bg: #F5F7FA;
    --card-border: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: var(--body-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; }
label, .form-label { font-weight: 600; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    left: 0; top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

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

.logo-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 2px 8px rgba(34,197,94,0.3);
}

.logo-icon-lg { width: 56px; height: 56px; font-size: 1.75rem; }

.sidebar-nav { padding: 0.75rem 0.5rem; }

.sidebar-nav .nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 1rem; margin: 2px 0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem; font-weight: 600;
    transition: all 0.2s;
}

.sidebar-nav .nav-item:hover {
    background: var(--primary-subtle); color: var(--primary);
}

.sidebar-nav .nav-item.active {
    background: var(--primary-subtle); color: var(--primary); font-weight: 700;
}

.sidebar-nav .nav-item i { font-size: 1.2rem; width: 22px; text-align: center; }

.sidebar-footer { background: var(--body-bg); }
.avatar { font-size: 1.6rem; color: var(--text-muted); }

/* ---- Main content ---- */
.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }

.top-bar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.page-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; }

/* ---- Cards ---- */
.card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    background: #fff;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 700;
}

.card-body { padding: 1.25rem; }

/* Stat cards */
.stat-card { transition: all 0.2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.08); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}

.stat-value {
    font-size: 1.75rem; font-weight: 800;
    line-height: 1.2; letter-spacing: -0.02em;
}

/* ---- Buttons ---- */
.btn { font-weight: 600; border-radius: var(--radius-sm); }

.btn-success {
    background: var(--primary); border-color: var(--primary); font-weight: 700;
}
.btn-success:hover {
    background: var(--primary-hover); border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(34,197,94,0.3);
}

.btn-outline-success { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-outline-success:hover { background: var(--primary); border-color: var(--primary); }

/* ---- Table ---- */
.table { margin-bottom: 0; }

.table th {
    background: #F9FAFB;
    font-weight: 700; font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 0.875rem 0.75rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #F3F4F6;
    font-weight: 500;
}

.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #F9FAFB; }

.domain-name { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; }

.domain-category {
    display: inline-block;
    font-size: 0.7rem; font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    background: #EEF2FF;
    color: #4338CA;
    margin-top: 3px;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.domain-desc {
    font-size: 0.78rem; color: var(--text-muted); font-weight: 500;
    max-width: 350px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-top: 2px;
}

.domain-sources-inline {
    font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px;
}
.domain-sources-inline span { font-weight: 600; color: var(--text-muted); }

/* Source badge favicons (table headers) */
.badge-favicon {
    width: 22px; height: 22px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Source favicons (filter pills) */
.source-favicon {
    width: 16px; height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 2px;
}

/* Check/cross icons */
.check-yes { color: var(--primary); font-size: 1.25rem; }
.check-no  { color: #D1D5DB; font-size: 1.25rem; }

/* Sortable headers */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--primary); }
.sortable.active { color: var(--primary); }

/* ---- Filters ---- */
.filter-group { display: flex; align-items: center; gap: 0.375rem; }
.filter-group label {
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); white-space: nowrap;
}
.filter-input { border-radius: var(--radius-xs); font-weight: 500; }

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(34,197,94,0.15); }

/* Source toggles — pill style */
.source-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: #fff; cursor: pointer;
    transition: all 0.2s;
    font-size: 0.82rem; font-weight: 600; user-select: none;
}
.source-toggle:hover { border-color: var(--primary-light); background: var(--primary-subtle); }
.source-toggle.active { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary); }
.source-toggle .form-check-input { margin: 0; cursor: pointer; }

.sources-section { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

.add-source-btn {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    border: 1.5px dashed var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
}
.add-source-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-subtle); }

/* Hidden sources dropdown */
.sources-dropdown {
    position: absolute; z-index: 50;
    background: #fff; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    padding: 0.5rem;
    min-width: 180px;
}
.sources-dropdown .source-option {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-xs);
    cursor: pointer; font-size: 0.85rem; font-weight: 600;
    transition: background 0.15s;
}
.sources-dropdown .source-option:hover { background: var(--primary-subtle); }

/* ---- Pagination ---- */
.pagination .page-link {
    border-radius: var(--radius-xs); margin: 0 2px;
    color: var(--text-secondary); border: 1px solid var(--border-color);
    font-weight: 600;
}
.pagination .page-item.active .page-link {
    background: var(--primary); border-color: var(--primary); font-weight: 700;
}

/* ---- Tasks list ---- */
.tasks-list .task-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #F3F4F6;
    display: flex; align-items: center; justify-content: space-between;
    transition: background 0.15s;
}
.tasks-list .task-item:hover { background: #F9FAFB; }
.tasks-list .task-item:last-child { border-bottom: none; }

.task-status {
    display: inline-flex; align-items: center; gap: 0.375rem;
    font-size: 0.8rem; font-weight: 700;
    padding: 0.3rem 0.75rem; border-radius: 20px;
}
.task-status.processing { background: #FEF3C7; color: #92400E; }
.task-status.completed  { background: #D1FAE5; color: #065F46; }
.task-status.failed     { background: #FEE2E2; color: #991B1B; }
.task-status.pending    { background: #E0E7FF; color: #3730A3; }

.task-progress { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }

/* ---- Login page ---- */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #F0FDF4 0%, var(--body-bg) 100%);
}
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
    background: #fff; border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
}
.login-card h4 { font-weight: 800; font-size: 1.5rem; }

/* ---- Forms ---- */
.form-control, .form-select { font-weight: 500; border-radius: var(--radius-xs); border-color: var(--border-color); }
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(34,197,94,0.15);
}
.form-text { font-weight: 500; color: var(--text-muted); }

/* ---- Modal ---- */
.modal-content { border-radius: var(--radius); box-shadow: 0 25px 50px rgba(0,0,0,0.12); }
.modal-header { border-bottom: 1px solid var(--border-color); padding: 1.25rem 1.5rem; }
.modal-title { font-weight: 800; }

.detail-row {
    display: flex; justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid #F3F4F6;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-secondary); font-weight: 600; }
.detail-value { font-weight: 700; }

.links-list { list-style: none; padding: 0; margin: 0; }
.links-list li { padding: 0.375rem 0; border-bottom: 1px solid #F9FAFB; }
.links-list li a { color: var(--primary); text-decoration: none; font-size: 0.8125rem; font-weight: 500; word-break: break-all; }
.links-list li a:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ---- Misc ---- */
.alert { border-radius: var(--radius-sm); font-weight: 500; }
.progress { height: 6px; border-radius: 3px; background: #E5E7EB; }
.progress-bar { background: var(--primary); border-radius: 3px; }

textarea.form-control {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8125rem; line-height: 1.7; font-weight: 500;
}

.empty-state { padding: 3rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state p { font-weight: 600; }

.badge { font-weight: 700; border-radius: var(--radius-xs); }

.form-switch .form-check-input { width: 2.25em; height: 1.25em; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Number formatting */
.num-highlight { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Action button */
.btn-action {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color); background: #fff;
    color: var(--text-secondary); padding: 0; cursor: pointer;
    transition: all 0.15s;
}
.btn-action:hover { background: var(--primary-subtle); border-color: var(--primary); color: var(--primary); }

/* Save/Bookmark button */
.btn-save.saved { background: #FEF3C7; border-color: #F59E0B; color: #D97706; }
.btn-save.saved:hover { background: #FDE68A; border-color: #F59E0B; color: #B45309; }
.btn-save:not(.saved):hover { color: #F59E0B; border-color: #F59E0B; background: #FFFBEB; }

/* Price refresh progress bar */
.price-progress {
    padding: 12px 16px;
    background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
    border-bottom: 1px solid #D1FAE5;
}
.price-progress-text {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}
.price-progress-count {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.price-progress-updated {
    font-weight: 700;
    font-size: 0.82rem;
    color: #16A34A;
    white-space: nowrap;
}

/* Price cell flash animation on update */
@keyframes priceFlash {
    0% { background: #D1FAE5; }
    100% { background: transparent; }
}
.price-flash {
    animation: priceFlash 0.6s ease;
}
