/* ============================================
   Affiliate Link Manager — Spreadsheet UI
   Dark Theme with Glassmorphism
   ============================================ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);

    --shopee-color: #ee4d2d;
    --shopee-bg: rgba(238, 77, 45, 0.08);
    --shopee-border: rgba(238, 77, 45, 0.2);

    --lazada-color: #0f146d;
    --lazada-text: #6e78ff;
    --lazada-bg: rgba(110, 120, 255, 0.08);
    --lazada-border: rgba(110, 120, 255, 0.2);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --gradient-bg: linear-gradient(180deg, #0a0e1a 0%, #111827 100%);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background: var(--gradient-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Header --- */
#app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
}

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

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

.logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.browser-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    transition: background var(--transition-normal);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse-dot 2s infinite;
}

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

/* --- Main --- */
#app-main {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Toolbar --- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-left label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

.row-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; animation: none; }

.btn-sm { padding: 5px 10px; font-size: 0.75rem; }

.btn-primary { background: var(--gradient-primary); color: white; }
.btn-primary:hover { opacity: 0.9; box-shadow: var(--shadow-glow); }

.btn-glow {
    box-shadow: var(--shadow-glow);
    animation: glow-pulse 2s infinite;
}

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 12px var(--accent-glow); }
    50% { box-shadow: 0 0 24px var(--accent-glow); }
}

.btn-glass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-glass:hover { background: var(--bg-glass-hover); }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover { background: var(--bg-glass); color: var(--text-primary); }

.btn-accent {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.btn-accent:hover { background: rgba(99, 102, 241, 0.25); }

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-info {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}
.btn-info:hover {
    background: rgba(6, 182, 212, 0.25);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

/* --- Inputs --- */
.input-styled, .select-styled {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.8rem;
    outline: none;
    transition: border-color var(--transition-fast);
}
.input-styled:focus, .select-styled:focus { border-color: var(--border-focus); }

.input-sm { width: 60px; }
.select-sm { width: auto; }

.select-styled {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

.badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--accent-glow);
    color: var(--accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ==========================================
   SPREADSHEET TABLE
   ========================================== */

.spreadsheet-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.spreadsheet-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 240px);
}

.spreadsheet-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.spreadsheet-scroll::-webkit-scrollbar-track { background: transparent; }
.spreadsheet-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.spreadsheet {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 1100px;
}

/* --- Column widths --- */
.spreadsheet .col-num-header { width: 36px; }
.spreadsheet .col-url-header { width: 320px; }
.spreadsheet .col-header { width: 110px; }
.spreadsheet .col-del-header { width: 32px; }

/* --- Group Headers --- */
.col-group-row th {
    padding: 8px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 12;
    background: rgba(17, 24, 39, 0.95);
}

.col-group-shopee {
    color: var(--shopee-color);
    background: var(--shopee-bg) !important;
    border-left: 2px solid var(--shopee-border);
}

.col-group-lazada {
    color: var(--lazada-text);
    background: var(--lazada-bg) !important;
    border-left: 2px solid var(--lazada-border);
}

/* --- Column Headers --- */
.col-header-row th {
    padding: 6px 6px;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 33px;
    z-index: 11;
    background: rgba(17, 24, 39, 0.95);
}

.col-header-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.col-name {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: text;
    padding: 1px 4px;
    border-radius: 3px;
    outline: none;
    min-width: 40px;
    text-align: center;
}

.col-name:focus {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

/* --- Mode Toggle Buttons --- */
.col-mode-toggle {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 1px;
}

.mode-btn {
    width: 26px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all var(--transition-fast);
    padding: 0;
}

.mode-btn:hover { background: rgba(255, 255, 255, 0.1); }

.mode-btn.active {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

/* Shopee columns subtle tint */
.col-shopee {
    background: var(--shopee-bg) !important;
    border-left: 1px solid rgba(238, 77, 45, 0.08);
}

.col-lazada {
    background: var(--lazada-bg) !important;
    border-left: 1px solid rgba(110, 120, 255, 0.08);
}

/* --- Table Body --- */
.spreadsheet tbody tr {
    transition: background var(--transition-fast);
}

.spreadsheet tbody tr:hover {
    background: var(--bg-glass-hover);
}

.spreadsheet tbody td {
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

/* Row number */
.cell-num {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 4px;
    background: rgba(0, 0, 0, 0.15);
}

/* Cell input */
.cell-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 7px 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    outline: none;
    transition: background var(--transition-fast);
}

.cell-input:focus {
    background: rgba(99, 102, 241, 0.08);
    box-shadow: inset 0 0 0 1px var(--border-focus);
}

.cell-input::placeholder {
    color: rgba(255, 255, 255, 0.15);
    font-family: var(--font-family);
    font-size: 0.72rem;
}

.cell-input.cell-url {
    font-size: 0.75rem;
}

/* Auto-filled cells (fix/seq) */
.cell-input.auto-filled {
    color: var(--text-muted);
    font-style: italic;
}

.cell-input.auto-filled:focus {
    color: var(--text-primary);
    font-style: normal;
}

/* Shopee / Lazada cell tints */
td.cell-shopee { background: rgba(238, 77, 45, 0.02); }
td.cell-lazada { background: rgba(110, 120, 255, 0.02); }

/* Status indicators in row */
.row-status {
    width: 4px;
    min-width: 4px;
}

tr.row-done { border-left: 3px solid var(--success); }
tr.row-processing { border-left: 3px solid var(--info); background: var(--info-bg) !important; }
tr.row-error { border-left: 3px solid var(--danger); background: var(--danger-bg) !important; }

/* Delete row button */
.cell-del {
    text-align: center;
    padding: 0;
}

.btn-del-row {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    padding: 0;
    opacity: 0;
}

.spreadsheet tbody tr:hover .btn-del-row {
    opacity: 1;
}

.btn-del-row:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* Row slide-out animation */
@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); height: auto; }
    to { opacity: 0; transform: translateX(20px); height: 0; overflow: hidden; }
}

/* ==========================================
   BOTTOM PANEL
   ========================================== */

.bottom-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.bottom-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
}

.bottom-left, .bottom-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Progress --- */
.progress-section {
    padding: 12px 16px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 100px;
    transition: width 0.4s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.results-list::-webkit-scrollbar { width: 4px; }
.results-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-item.status-done { border-left: 3px solid var(--success); }
.result-item.status-processing { border-left: 3px solid var(--info); }
.result-item.status-error { border-left: 3px solid var(--danger); }

.result-icon { font-size: 0.9rem; flex-shrink: 0; }
.result-content { flex: 1; min-width: 0; }
.result-url { color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-info { color: var(--text-secondary); font-size: 0.72rem; }

/* --- Toast --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    animation: toastIn 0.2s ease, toastOut 0.2s ease 2.8s forwards;
    border: 1px solid var(--border-color);
}

.toast-success { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.2); }
.toast-error { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.2); }
.toast-info { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.2); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* --- Spinner --- */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==========================================
   DEBUG CONSOLE / LOG PANEL
   ========================================== */

.log-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.log-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.log-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.log-count {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-weight: 500;
}

.log-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-toggle {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.log-toggle input {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

.log-body {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.log-body.collapsed {
    max-height: 0;
    overflow: hidden;
}

.log-body::-webkit-scrollbar { width: 6px; }
.log-body::-webkit-scrollbar-track { background: transparent; }
.log-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.log-entries {
    padding: 4px 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.6;
}

.log-entry {
    display: flex;
    gap: 6px;
    padding: 1px 12px;
    transition: background 0.1s;
    align-items: flex-start;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-time {
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 72px;
}

.log-level {
    flex-shrink: 0;
    min-width: 50px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    padding: 1px 0;
}

.log-level.level-DEBUG { color: #6ee7b7; }
.log-level.level-INFO { color: #93c5fd; }
.log-level.level-WARNING { color: #fcd34d; }
.log-level.level-ERROR { color: #fca5a5; }

.log-module {
    color: var(--accent-hover);
    flex-shrink: 0;
    min-width: 70px;
}

.log-message {
    color: var(--text-secondary);
    word-break: break-word;
    flex: 1;
}

/* Error messages stand out */
.log-entry.entry-ERROR .log-message {
    color: #fca5a5;
}

.log-entry.entry-WARNING .log-message {
    color: #fcd34d;
}

/* Animate new entries */
.log-entry.new-entry {
    animation: logFadeIn 0.3s ease;
}

@keyframes logFadeIn {
    from { opacity: 0; background: rgba(99, 102, 241, 0.1); }
    to { opacity: 1; background: transparent; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { flex-wrap: wrap; }
    #app-main { padding: 8px 8px; }
    .log-controls { flex-wrap: wrap; }
}


/* ============================================
   Override Link & Status Columns
   ============================================ */

/* Override columns header */
.col-group-override {
    background: rgba(168, 85, 247, 0.12) !important;
    color: #c084fc;
    font-weight: 600;
    border-bottom: 2px solid rgba(168, 85, 247, 0.3);
}

.col-override .col-header-inner .col-name {
    color: #c084fc;
}

.col-status-header,
.col-status .col-header-inner .col-name {
    color: var(--text-secondary);
}

/* Override link input cells */
.cell-override {
    background: rgba(168, 85, 247, 0.04);
}

.cell-override-link {
    font-size: 0.75rem !important;
    color: #c084fc !important;
}

.cell-override-link::placeholder {
    color: rgba(168, 85, 247, 0.3) !important;
    font-size: 0.7rem !important;
}

/* Status column */
.cell-status {
    text-align: center;
    min-width: 100px;
}

/* Status badges */
.status-badge {
    display: inline-block;
    font-size: 0.72rem;
}

[class^="badge-"] {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending { color: var(--text-muted); }
.badge-processing { color: var(--info); }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-extra { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-broken { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warn { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-skipped { background: var(--warning-bg); color: var(--warning); }
.badge-error { background: var(--danger-bg); color: var(--danger); }


/* ============================================
   Row Status Styling
   ============================================ */

tr.row-done td { background: rgba(16, 185, 129, 0.04); }
tr.row-processing td { background: rgba(99, 102, 241, 0.06); }
tr.row-error td { background: rgba(239, 68, 68, 0.06); }
tr.row-skipped td { background: rgba(245, 158, 11, 0.04); opacity: 0.7; }


/* ============================================
   Result Details (commission / broken info)
   ============================================ */

.result-details {
    width: 100%;
    padding: 4px 0 4px 28px;
    margin-top: 4px;
    border-top: 1px solid var(--border-color);
}

.result-detail {
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 1px 0;
    line-height: 1.4;
}

.result-item {
    flex-wrap: wrap;
}


/* ============================================
   Delete Row Button
   ============================================ */

.col-del-header {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
}

.cell-del {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: center;
    padding: 0 !important;
}

.btn-del-row {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
}

.btn-del-row:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    opacity: 1;
    transform: scale(1.2);
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); max-height: 50px; }
    to   { opacity: 0; transform: translateX(-30px); max-height: 0; }
}

/* Duplicate URL highlight */
.cell-duplicate {
    border-color: var(--warning) !important;
    box-shadow: 0 0 0 1px var(--warning), 0 0 8px rgba(245, 158, 11, 0.25) !important;
    animation: duplicatePulse 2s ease-in-out infinite;
}

.row-duplicate {
    background: rgba(245, 158, 11, 0.06) !important;
}

.row-duplicate .cell-num {
    color: var(--warning) !important;
    font-weight: 700;
}

@keyframes duplicatePulse {
    0%, 100% { box-shadow: 0 0 0 1px var(--warning), 0 0 8px rgba(245, 158, 11, 0.2); }
    50%      { box-shadow: 0 0 0 1px var(--warning), 0 0 14px rgba(245, 158, 11, 0.4); }
}

/* ============================================
   Header Navigation Tabs
   ============================================ */
.header-nav {
    display: flex;
    gap: 12px;
    margin-left: auto;
    margin-right: 20px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-glass);
    border-color: var(--border-color);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

/* Adjust header actions alignment when nav is added */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================
   Product Review Generator Dashboard
   ============================================ */
.review-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1600px;
    margin: 24px auto;
    padding: 0 24px;
}

@media (max-width: 1100px) {
    .review-container {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.panel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.panel-card h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.input-styled, .select-styled, .textarea-styled {
    width: 100%;
    padding: 11px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.input-styled:focus, .select-styled:focus, .textarea-styled:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: rgba(0, 0, 0, 0.3);
}

.textarea-styled {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Drag and Drop Image Upload */
.upload-drag-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all var(--transition-normal);
}

.upload-drag-area:hover, .upload-drag-area.drag-over {
    border-color: var(--accent);
    background: var(--bg-glass-hover);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.05);
}

.upload-drag-area .icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: block;
}

.upload-drag-area p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.upload-drag-area span {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.upload-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.preview-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    animation: previewFadeIn 0.3s ease;
}

@keyframes previewFadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-card .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: background 0.15s ease;
}

.preview-card .remove-btn:hover {
    background: #ef4444;
}

.preview-card .image-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 3px;
    color: white;
    font-weight: 600;
    pointer-events: none;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 1;
}

.preview-card .image-badge.scraped {
    background: rgba(124, 58, 237, 0.85); /* Purple accent */
}

.preview-card .image-badge.manual {
    background: rgba(16, 185, 129, 0.85); /* Emerald success */
}


/* Generation Progress UI */
.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.step-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.step-item.pending {
    opacity: 0.4;
}

.step-item.running {
    border-color: var(--accent-focus);
    background: var(--bg-glass-hover);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.08);
}

.step-item.success {
    border-color: rgba(16, 185, 129, 0.15);
    background: rgba(16, 185, 129, 0.03);
    color: var(--success);
}

.step-item.error {
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.03);
    color: var(--danger);
}

.step-item .step-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.step-item .step-loading {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.step-item .step-text {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Results Section Layout */
.results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.result-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .result-gallery {
        grid-template-columns: 1fr;
    }
}

.result-image-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 1 / 1;
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: var(--shadow-sm);
}

.result-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.result-image-card .image-overlay {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%);
    padding: 16px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.result-image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.1);
}

.result-image-card:hover .image-overlay {
    opacity: 1;
}

.result-image-card .image-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.image-actions {
    display: flex;
    gap: 6px;
}

.btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-icon-sm:hover {
    background: white;
    color: black;
    transform: scale(1.1);
}

.caption-wrapper {
    margin-top: 10px;
    position: relative;
}

.caption-textarea {
    width: 100%;
    height: 240px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 16px;
    resize: none;
    line-height: 1.6;
    outline: none;
    transition: border-color 0.2s;
}

.caption-textarea:focus {
    border-color: var(--accent);
}

.caption-copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.caption-copy-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--accent);
}

/* Lightbox styles */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 13, 0.95);
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    display: block;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* ============================================
   Server Queue Status & Banner Styles
   ============================================ */
.queue-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.queue-status-header h2 {
    margin-bottom: 0 !important;
    font-size: 1.2rem !important;
}

.queue-badge {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.queue-idle-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 10px 0;
}

.status-indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse-dot 2s infinite;
}

/* Queue Grid when jobs exist */
.queue-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.queue-active-card, .queue-waiting-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.queue-active-card h3, .queue-waiting-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-job-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.active-job-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent-hover);
}

.active-job-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.active-job-step-msg {
    font-size: 0.9rem;
    color: var(--warning);
    margin-top: 4px;
}

/* Progress bar inside active job details */
.active-job-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.active-job-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.4s ease;
}

/* Waiting List items */
.waiting-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.waiting-list::-webkit-scrollbar {
    width: 6px;
}

.waiting-list::-webkit-scrollbar-track {
    background: transparent;
}

.waiting-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.waiting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.waiting-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.waiting-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.waiting-item-pos {
    background: var(--accent);
    color: white;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.waiting-item-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.waiting-item-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 1px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.waiting-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Alert Banner styling */
.alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 16px;
    margin-bottom: 8px;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(245, 158, 11, 0.25); box-shadow: 0 0 4px rgba(245, 158, 11, 0.05); }
    50% { border-color: rgba(245, 158, 11, 0.5); box-shadow: 0 0 12px rgba(245, 158, 11, 0.15); }
}

.alert-banner-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.alert-banner-content {
    flex: 1;
}

.alert-banner-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--warning);
    margin-bottom: 2px;
}

.alert-banner-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* My Jobs Selector styles for Review Generator */
.my-jobs-list {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.job-badge-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    min-width: 160px;
    max-width: 220px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.job-badge-card:hover {
    border-color: var(--accent-hover);
    background: rgba(255, 255, 255, 0.05);
}

.job-badge-card.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.job-badge-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-badge-status {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.job-status-queued {
    color: var(--warning);
}

.job-status-running {
    color: var(--info);
}

.job-status-success {
    color: var(--success);
}

.job-status-error {
    color: var(--danger);
}


