/* ======= Variables & Reset ======= */
:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1a202c;
    --color-text-muted: #718096;
    --color-primary: #3182ce;
    --color-primary-dark: #2b6cb0;
    --color-success: #38a169;
    --color-warning: #d69e2e;
    --color-danger: #e53e3e;
    --color-new: #9f7aea;
    --color-fav: #ed8936;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

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

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

/* ======= Navbar ======= */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.nav-subtitle {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

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

.nav-links a {
    color: var(--color-text-muted);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-primary);
    background: rgba(49, 130, 206, 0.1);
}

/* ======= Container ======= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ======= Buttons ======= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: var(--color-surface);
}

.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); }
.btn-secondary { background: var(--color-border); color: var(--color-text); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-fav { background: transparent; border: 1px solid var(--color-fav); color: var(--color-fav); }
.btn-fav-active, .btn-fav:hover { background: var(--color-fav); color: white; }
.btn-dismiss { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-muted); }
.btn-dismiss:hover { background: var(--color-danger); color: white; border-color: var(--color-danger); }

/* ======= Stats Bar ======= */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card.big { padding: 1.5rem; }
.stat-card.stat-new { border-left: 4px solid var(--color-new); }
.stat-card.stat-fav { border-left: 4px solid var(--color-fav); }

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ======= Filters ======= */
.filters-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.filter-group input,
.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--color-primary);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

/* ======= Annonce Cards ======= */
.results-count {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

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

.annonce-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    display: flex;
    gap: 1rem;
    padding: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.15s;
}

.annonce-card:hover { box-shadow: var(--shadow-md); }
.annonce-card.annonce-new { border-left: 4px solid var(--color-new); }
.annonce-card.annonce-fav { border-left: 4px solid var(--color-fav); }

.annonce-image {
    flex-shrink: 0;
    width: 160px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--color-bg);
}

.annonce-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.annonce-content { flex: 1; min-width: 0; }

.annonce-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.annonce-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.annonce-title a {
    color: var(--color-text);
    text-decoration: none;
}

.annonce-title a:hover { color: var(--color-primary); }

.annonce-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.annonce-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

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

.detail-price {
    font-weight: 700;
    color: var(--color-text);
    font-size: 1.1rem;
}

.detail-ppm {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.annonce-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.annonce-actions {
    display: flex;
    gap: 0.5rem;
}

/* ======= Badges ======= */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pap { background: #fef3c7; color: #92400e; }
.badge-bienici { background: #dbeafe; color: #1e40af; }
.badge-leboncoin { background: #fce7f3; color: #9d174d; }
.badge-seloger { background: #d1fae5; color: #065f46; }
.badge-new { background: #ede9fe; color: #5b21b6; }
.badge-fav { background: #fef3c7; color: #92400e; }

/* ======= Detail Page ======= */
.detail-header { margin-bottom: 1rem; }
.back-link { font-weight: 500; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.detail-image img {
    width: 100%;
    border-radius: var(--radius);
}

.detail-info h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.detail-badges { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.detail-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.detail-stat-label { font-size: 0.8rem; color: var(--color-text-muted); }

.detail-location {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.detail-meta { font-size: 0.85rem; color: var(--color-text-muted); }

/* ======= Config & Stats Pages ======= */
.config-page h1, .stats-page h1 { margin-bottom: 1.5rem; }

.config-sections {
    display: grid;
    gap: 1.5rem;
}

.config-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.config-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.config-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--color-text-muted); }
.form-group input {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1rem;
}

.config-note { font-size: 0.85rem; color: var(--color-text-muted); font-style: italic; margin-top: 0.5rem; }

.zones-list, .sites-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.zone-tag, .site-tag {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Stats charts */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stats-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.stats-section h2 { font-size: 1rem; margin-bottom: 1rem; }

.stats-chart { display: flex; flex-direction: column; gap: 0.5rem; }

.bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bar-label { min-width: 80px; font-size: 0.8rem; font-weight: 500; }
.bar-value { min-width: 30px; text-align: right; font-weight: 600; font-size: 0.9rem; }

.bar {
    flex: 1;
    height: 24px;
    background: var(--color-bg);
    border-radius: 12px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 12px;
    min-width: 8px;
    transition: width 0.3s;
}

.bar-fill-blue { background: #4299e1; }
.bar-fill-green { background: #48bb78; }

/* ======= Empty State ======= */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--color-text-muted);
}

.empty-state p { margin-bottom: 0.5rem; }

/* ======= Footer ======= */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
}

/* ======= Responsive ======= */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; gap: 0.75rem; }
    .nav-links { order: 3; width: 100%; justify-content: center; }
    .nav-actions { order: 2; margin-left: auto; }
    
    .annonce-card { flex-direction: column; }
    .annonce-image { width: 100%; height: 180px; }
    
    .detail-grid { grid-template-columns: 1fr; }
    .stats-overview { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
}
