:root {
    --bg:           #121212;
    --surface:      #1e1e1e;
    --surface-alt:  #252525;
    --border:       #333;
    --text:         #e0e0e0;
    --text-muted:   #888;
    --accent:       #28a745;
    --accent-hover: #218838;
    --danger:       #dc3545;
    --link:         #6ea8fe;
    --primary:       #007bff;
    --primary-hover: #0056b3;
    --warning:       #f0a500;
}

* { box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--link); }

h1 { margin-bottom: 0.5rem; }

/* --- Filter form --- */
.filter-form {
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.filter-section { margin-bottom: 1rem; }
.filter-section label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.filter-section textarea {
    width: 100%; max-width: 100%; padding: 0.5rem;
    border: 1px solid var(--border); border-radius: 4px;
    font-family: inherit; background: var(--surface-alt); color: var(--text);
}
.filter-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.filter-row select,
.filter-row input {
    padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px;
    background: var(--surface-alt); color: var(--text); max-width: 100%;
}
.filter-row select { white-space: normal; height: auto; min-height: 2.5rem; }
.filter-row input[type="text"] { flex: 1; min-width: 120px; }
.filter-row input[type="number"] { width: 60px; max-width: 60px; }
.filter-row input.plz-input { flex: 0 0 auto; width: 70px; min-width: 70px; }
.filter-row .filter-remove-btn {
    padding: 0.5rem; background: var(--surface-alt); color: var(--text);
    border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
    min-width: 2.5rem; font-size: 1.2rem; font-weight: bold; line-height: 1; flex-shrink: 0;
}
.filter-row .filter-checkbox { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.filter-row.disabled { opacity: 0.5; }
.filter-distance-inputs { display: flex; flex-wrap: wrap; }
.add-filter-btns { display: flex; gap: 10px; margin: 10px 0; }
.add-filter-btns button {
    padding: 0.5rem 1rem; background: var(--surface-alt); color: var(--text);
    border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
}
.add-filter-btns button:hover { opacity: 0.8; }
.filter-form button[type="submit"] {
    padding: 0.5rem 1rem; background: var(--accent); color: white;
    border: none; border-radius: 4px; cursor: pointer; font-size: 1rem;
}
.filter-form button[type="submit"]:hover { background: var(--accent-hover); }

/* --- Stats indicator --- */
.stats-indicator {
    font-size: 0.85rem; color: var(--text-muted);
    margin: 0.5rem 0 1rem 0;
}
.stats-indicator a { color: var(--text-muted); text-decoration: underline; }

/* --- Ad items --- */
.item {
    background: var(--surface); margin: 10px 0; padding: 10px;
    border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; align-items: flex-start;
}
.image { width: 100px; height: 100px; object-fit: cover; margin-right: 15px; border-radius: 4px; }
.clickable-area { display: flex; align-items: center; flex: 1; cursor: pointer; }
.content { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.heading { flex: 1; }
.contacts { display: flex; flex-direction: column; gap: 4px; margin-left: 15px; }
.details {
    display: none; width: 100%; padding-top: 10px;
    border-top: 1px solid var(--border); margin-top: 10px;
}
.old-ad { color: var(--text-muted); }

/* --- Contact buttons --- */
.contact-btn {
    padding: 6px 8px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 16px; text-decoration: none; display: inline-flex;
    align-items: center; transition: opacity 0.2s; background: transparent;
}
.contact-btn:hover { opacity: 0.8; }
.contact-btn img { width: 20px; height: 20px; }

/* --- Gallery --- */
.gallery {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    gap: 10px; padding: 10px 0;
}
.gallery img {
    flex-shrink: 0; height: 300px; width: auto; max-width: 80vw;
    scroll-snap-align: start; border-radius: 4px;
}

/* --- Stats page --- */
.stats-summary {
    background: var(--surface); padding: 1rem; border-radius: 8px;
    margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.stats-summary p { margin: 0.3rem 0; }
.stats-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.stats-table th {
    text-align: left; padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--border); color: var(--text-muted); font-weight: 600;
}
.stats-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.stats-table tr:last-child td { border-bottom: none; }
.status-completed { color: var(--accent); }
.status-timeout   { color: var(--warning); }
.status-error     { color: var(--danger); }

/* --- Login page --- */
.login-wrapper {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 2rem);
    margin: -1rem;
    padding: 1rem;
}
.login-container {
    background: var(--surface); padding: 2rem; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4); text-align: center;
    max-width: 400px; width: 100%;
}
.login-container h1 { margin-bottom: 1rem; }
.login-container form { display: flex; flex-direction: column; }
.login-container label { margin-bottom: 0.5rem; text-align: left; font-size: 18px; }
.login-container input {
    padding: 0.5rem; margin-bottom: 1rem;
    border: 1px solid var(--border); border-radius: 4px;
    font-size: 18px; background: var(--surface-alt); color: var(--text);
}
.login-container button {
    padding: 0.75rem; background: var(--primary); color: white;
    border: none; border-radius: 4px; cursor: pointer; font-size: 18px;
}
.login-container button:hover { background: var(--primary-hover); }
.login-container ul { list-style: none; padding: 0; color: var(--danger); }
.remember-me { display: flex; align-items: center; margin-bottom: 1rem; text-align: left; }
.remember-me input { width: auto; margin: 0 0.5rem 0 0; }

/* --- Responsive --- */
@media (max-width: 768px) {
    body { font-size: 14px; }
    .contact-btn img { width: 40px !important; height: 40px !important; }
    .filter-row { gap: 5px; }
    .filter-row select { font-size: 13px; padding: 0.4rem; min-width: 80px; }
    .filter-row input[type="text"] { min-width: 80px; font-size: 13px; }
    .filter-row input[type="number"] { width: 40px; max-width: 50px; font-size: 13px; }
    .filter-row input.plz-input { width: 60px; min-width: 60px; }
    .stats-table th, .stats-table td { padding: 0.4rem 0.5rem; font-size: 13px; }
}
