/* ═══════════════════════════════════════════════════════════════════
   Vinted Scraper — Dark Theme UI
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0f0f13;
    --bg-secondary: #1a1a24;
    --bg-card: #1e1e2e;
    --bg-card-hover: #262640;
    --bg-input: #16161f;
    --border: #2a2a3d;
    --border-hover: #3d3d5c;
    --text-primary: #e8e8f0;
    --text-secondary: #9494a8;
    --text-muted: #65657a;
    --accent: #7c6aef;
    --accent-hover: #9585f5;
    --accent-glow: rgba(124, 106, 239, 0.25);
    --success: #3dd68c;
    --danger: #ef4444;
    --danger-hover: #f87171;
    --info: #38bdf8;
    --price-bg: rgba(124, 106, 239, 0.9);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────────── */

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Toggle Switch ─────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; margin-top: 0.5rem; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-input); transition: .4s; border: 1px solid var(--border);
}
.slider:before {
  position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background-color: var(--text-secondary); transition: .4s;
}
input:checked + .slider { background-color: var(--success); border-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); background-color: #fff; }
.slider.round { border-radius: 24px; }
.slider.round:before { border-radius: 50%; }

/* ── Navbar ────────────────────────────────────────────────────── */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo { font-size: 1.5rem; }

.nav-title {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
    margin-left: 2rem;
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-glow);
}

.nav-icon { font-size: 1rem; }

/* ── Container ─────────────────────────────────────────────────── */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Buttons ───────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-accent {
    background: rgba(61, 214, 140, 0.15);
    color: var(--success);
    border: 1px solid rgba(61, 214, 140, 0.3);
}
.btn-accent:hover {
    background: rgba(61, 214, 140, 0.25);
    border-color: var(--success);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Badges ────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-info {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
}

.badge-dim {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.badge-success {
    background: rgba(61, 214, 140, 0.15);
    color: var(--success);
}

/* ── Cards ─────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition);
}

/* ── Dashboard ─────────────────────────────────────────────────── */

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dashboard-title-row h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select {
    appearance: none;
    background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239494a8' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

.filter-group select:hover { border-color: var(--border-hover); }
.filter-group select:focus { border-color: var(--accent); outline: none; }

/* ── Items Grid ────────────────────────────────────────────────── */

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.item-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    color: var(--text-primary);
    text-decoration: none;
}

.item-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-glow);
}

.item-image-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-input);
}

.item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.item-card:hover .item-image {
    transform: scale(1.06);
}

.item-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.3;
}

.item-price-badge {
    position: absolute;
    bottom: 0.6rem;
    left: 0.6rem;
    background: var(--price-bg);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.item-info {
    padding: 0.85rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.item-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.item-brand, .item-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.4rem;
}

.item-user {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.item-search-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: rgba(124, 106, 239, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Searches Page ─────────────────────────────────────────────── */

.searches-header {
    margin-bottom: 1.5rem;
}

.searches-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.form-card {
    margin-bottom: 2rem;
}

.form-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* ── Searches List ─────────────────────────────────────────────── */

.searches-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-card {
    transition: border-color var(--transition);
}

.search-card:hover {
    border-color: var(--border-hover);
}

.search-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.search-card-info { flex: 1; min-width: 0; }

.search-label {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.search-url {
    font-size: 0.78rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.search-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-card-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.search-status {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    min-height: 0;
    transition: all var(--transition);
}

.search-status:empty {
    margin-top: 0;
}

/* ── Empty State ───────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Toast ─────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Spinner ───────────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}

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

/* ── Button Group ──────────────────────────────────────────────── */

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Scheduler Bar ─────────────────────────────────────────────── */

.scheduler-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.9rem;
    background: rgba(61, 214, 140, 0.08);
    border: 1px solid rgba(61, 214, 140, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--success);
}

.scheduler-bar.hidden {
    display: none;
}

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

.scheduler-dot.pulse {
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(61, 214, 140, 0); }
}

.hidden { display: none; }

/* ── Responsive ────────────────────────────────────────────────── */

/* ── Brainrot Button ───────────────────────────────────────────── */

.btn-brainrot {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    border: none;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

.btn-brainrot:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    color: #fff;
}

/* Show only on mobile (≤768px) */
.mobile-only {
    display: none;
}

/* ── Item Date ─────────────────────────────────────────────────── */

.item-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ── Card Selection & Heart ────────────────────────────────── */

.item-card-wrap {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Selected state — highlight border */
.item-card-wrap.selected > .item-card {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), var(--shadow-lg);
}

/* Heart button */
.heart-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    font-size: 1.1rem;
}

/* Show heart on card selection */
.item-card-wrap.selected .heart-btn,
.item-card-wrap:hover .heart-btn {
    opacity: 1;
    transform: scale(1);
}

/* Heart pop animation when liked */
.heart-btn.liked {
    animation: heartPop 0.35s ease;
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .container { padding: 1rem; }
    .navbar { padding: 0 1rem; }
    .items-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
    .search-card-header { flex-direction: column; }
    .search-card-actions { align-self: flex-start; }
    .form-row { flex-direction: column; }
    .dashboard-controls { flex-direction: column; align-items: flex-start; }
    .mobile-only { display: inline-flex; }

    /* Always show heart on mobile since there's no hover */
    .heart-btn { opacity: 0.7; transform: scale(1); }
    .item-card-wrap.selected .heart-btn { opacity: 1; }
}

/* ── Auth Pages ───────────────────────────────────────────── */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 150px);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.auth-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-alert-success {
    background: rgba(61, 214, 140, 0.1);
    color: var(--success);
    border: 1px solid rgba(61, 214, 140, 0.2);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.auth-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.text-muted { color: var(--text-muted); }

/* ── Navbar User ───────────────────────────────────────────────── */

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-username {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .menu-btn {
        display: block;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-card);
        padding: 1.5rem;
        margin-left: 0;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5);
        z-index: 1000;
        align-items: stretch;
        gap: 1rem;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .nav-user {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border);
    }
    
    .nav-username {
        display: block;
    }
}

