/* ============================================================
   Kleinanzeigen - Mobile-First CSS
   ============================================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #0a7cff;
    --primary-dark: #0060cc;
    --primary-light: #e6f2ff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f5f5f7;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f0f0f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-height: 56px;
    --bottom-nav-height: 64px;
    --premium-gradient: linear-gradient(135deg, #fbbf24, #f59e0b);
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #3b9eff;
    --primary-dark: #6bb5ff;
    --primary-light: #1a2d42;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --bg: #111113;
    --bg-card: #1c1c1e;
    --text: #f0f0f2;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #2c2c2e;
    --border-light: #232325;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
    color-scheme: dark;
}

[data-theme="dark"] img { opacity: 0.92; }
[data-theme="dark"] .search-hero { background: linear-gradient(135deg, #0a4a8a 0%, #003366 100%); }
[data-theme="dark"] .btn-google { background: var(--bg-card); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .btn-outline { border-color: var(--primary); color: var(--primary); }
[data-theme="dark"] .btn-outline:hover { background: var(--primary-light); }
[data-theme="dark"] .status-pending { background: #423a10; color: #fbbf24; }
[data-theme="dark"] .status-active { background: #0f3320; color: #34d399; }
[data-theme="dark"] .status-blocked { background: #3b1419; color: #f87171; }
[data-theme="dark"] .alert-success { background: #0f3320; color: #6ee7b7; border-color: #166534; }
[data-theme="dark"] .alert-error { background: #3b1419; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .alert-info { background: var(--primary-light); color: var(--primary); border-color: #1e3a5f; }
[data-theme="dark"] .listing-card-wishlist { background: rgba(28,28,30,0.9); }
[data-theme="dark"] .listing-card-wishlist:hover { background: var(--bg-card); }
[data-theme="dark"] .chat-bubble-received { background: var(--border); }
[data-theme="dark"] .card { border: 1px solid var(--border); }

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
}
.theme-toggle:hover { background: var(--bg); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root .theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ============================================================
   Header
   ============================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}
.header-inner {
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: 12px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.logo svg { color: var(--primary); }

.nav-desktop { display: none; margin-left: auto; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.header-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text);
    transition: background 0.2s;
}
.header-icon:hover { background: var(--bg); color: var(--text); }

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.badge-bottom {
    top: -4px;
    right: -4px;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dropdown */
.dropdown { position: relative; }
.dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px 0;
    z-index: 200;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a, .dropdown-header {
    display: block;
    padding: 10px 16px;
    color: var(--text);
    font-size: 0.9rem;
}
.dropdown-menu a:hover { background: var(--bg); color: var(--text); }
.dropdown-header { font-weight: 600; color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.dropdown-menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 8px;
}
.mobile-nav {
    display: none;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
}
.mobile-nav.show { display: block; }
.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
}
.mobile-nav-item:last-child { border-bottom: none; }

/* ============================================================
   Bottom Navigation (Mobile)
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 6px 12px;
    position: relative;
    transition: color 0.2s;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active svg { stroke: var(--primary); }
.bottom-nav-add {
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    margin-top: -16px;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 8px rgba(10,124,255,0.3);
}
.bottom-nav-add span { display: none; }
.bottom-nav-add svg { stroke: #fff; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.4;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-google {
    background: #fff;
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-google:hover { background: var(--bg); color: var(--text); }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10,124,255,0.1);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* Range Slider */
.range-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-body { padding: 16px; }

/* Ad Card */
.listing-card {
    display: flex;
    flex-direction: column;
    position: relative;
}
.listing-card-image {
    position: relative;
    width: 100%;
    padding-top: 66%;
    overflow: hidden;
    background: var(--bg);
}
.listing-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.listing-card:hover .listing-card-image img { transform: scale(1.03); }
.listing-card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.listing-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.listing-card-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 6px;
}
.listing-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: auto;
}
.listing-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}
.badge-premium {
    background: var(--premium-gradient);
    color: #fff;
}
.badge-featured {
    background: var(--primary);
    color: #fff;
}

.listing-card-wishlist {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s;
}
.listing-card-wishlist:hover { background: #fff; transform: scale(1.1); }
.listing-card-wishlist.active svg { fill: var(--danger); stroke: var(--danger); }

/* Ad Grid */
.listing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ============================================================
   Search Section
   ============================================================ */
.search-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #0060cc 100%);
    color: #fff;
    padding: 24px 0;
}
.search-hero h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 16px;
}
.search-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
}
.search-box .form-input, .search-box .form-select {
    border-color: var(--border-light);
}
.search-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.radius-value {
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

/* ============================================================
   Categories
   ============================================================ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--text);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.category-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.category-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

/* ============================================================
   Ad Detail
   ============================================================ */
.listing-detail-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: var(--bg);
    border-radius: var(--radius);
}
.listing-detail-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}
.listing-detail-gallery img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
}
.listing-detail-gallery img.active { border-color: var(--primary); }
.listing-detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}
.listing-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.listing-detail-meta svg { vertical-align: -2px; margin-right: 4px; }
.seller-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
}
.seller-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.seller-info { flex: 1; }
.seller-info strong { display: block; }
.seller-info span { font-size: 0.85rem; color: var(--text-muted); }

/* ============================================================
   Messages
   ============================================================ */
.conversation-list { display: flex; flex-direction: column; }
.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}
.conversation-item:hover { background: var(--bg); }
.conversation-item.unread { background: var(--primary-light); }
.conv-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.conv-content { flex: 1; min-width: 0; }
.conv-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.conv-unread-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--bottom-nav-height) - 80px);
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}
.chat-bubble-sent {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble-received {
    align-self: flex-start;
    background: var(--bg);
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}
.chat-input .form-input { flex: 1; border-radius: 20px; }
.chat-input .btn { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex-shrink: 0; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 16px auto;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bfdbfe; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 24px 0;
}
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-weight: 500;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 24px 0; }
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-link { font-size: 0.9rem; font-weight: 500; }

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-page {
    max-width: 420px;
    margin: 24px auto;
    padding: 0 16px;
}
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow);
}
.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.auth-footer { text-align: center; margin-top: 16px; font-size: 0.9rem; }

/* ============================================================
   Admin
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--primary-light); color: var(--primary); }
.admin-content { flex: 1; padding: 24px; }
.admin-header { margin-bottom: 24px; }
.admin-header h1 { font-size: 1.5rem; font-weight: 700; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.admin-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.admin-table td { padding: 12px 16px; border-top: 1px solid var(--border-light); font-size: 0.9rem; }
.admin-table tr:hover td { background: var(--bg); }

.status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pending { background: #fef3cd; color: #856404; }
.status-active { background: #d4edda; color: #155724; }
.status-blocked { background: #f8d7da; color: #721c24; }

/* ============================================================
   Utilities
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.85rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.p-2 { padding: 16px; }
.gap-1 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 16px; opacity: 0.3; }
.empty-state p { font-size: 1rem; }

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Image Upload */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}
.image-upload:hover { border-color: var(--primary); color: var(--primary); }
.image-upload.dragover { border-color: var(--primary); background: var(--primary-light); }
.image-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-img {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 12px 0;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-muted); }

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    padding: 12px 20px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); }

/* ============================================================
   Responsive - Tablet
   ============================================================ */
@media (min-width: 640px) {
    .listing-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
    .category-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .search-row { flex-direction: row; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .form-row > * { flex: 1; }
}

/* ============================================================
   Responsive - Desktop
   ============================================================ */
@media (min-width: 1024px) {
    body { padding-bottom: 0; }
    .bottom-nav { display: none; }
    .nav-desktop { display: flex; }
    .mobile-menu-toggle { display: none; }

    .listing-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
    .category-grid { grid-template-columns: repeat(6, 1fr); gap: 16px; }

    .search-hero { padding: 40px 0; }
    .search-hero h1 { font-size: 2rem; }
    .search-box { padding: 24px; }

    .listing-detail-layout {
        display: grid;
        grid-template-columns: 1fr 360px;
        gap: 24px;
    }

    .section { padding: 32px 0; }
    .section-title { font-size: 1.4rem; }
    .container { padding: 0 24px; }
}

/* ============================================================
   Responsive - Admin Mobile
   ============================================================ */
@media (max-width: 767px) {
    .admin-sidebar {
        position: fixed;
        left: -240px;
        top: var(--header-height);
        bottom: 0;
        z-index: 99;
        transition: left 0.3s;
    }
    .admin-sidebar.show { left: 0; }
    .admin-content { padding: 16px; }
    .admin-table { font-size: 0.8rem; }
    .admin-table th, .admin-table td { padding: 8px; }
    .hide-mobile { display: none; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    .header, .bottom-nav, .footer, .btn { display: none; }
    body { padding: 0; background: #fff; }
}
