/* ============================================
   MISTER ANNUNCI - Stylesheet Principale
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Fredoka+One&display=swap');

:root {
    --primary: #FF6B00;
    --primary-dark: #E05500;
    --primary-light: #FF8A33;
    --secondary: #1B2A4A;
    --secondary-light: #2D4166;
    --accent: #00B894;
    --accent-dark: #009B7D;
    --danger: #E74C3C;
    --warning: #F39C12;
    --success: #27AE60;
    --info: #3498DB;
    --bg: #F0F2F5;
    --bg-card: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --text-muted: #BDC3C7;
    --border: #E1E5EB;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --vetrina-bg: linear-gradient(135deg, #FFF8E1 0%, #FFF3CD 100%);
    --vetrina-border: #FFD54F;
    --urgente-color: #E74C3C;
    --font: 'Nunito', sans-serif;
    --font-display: 'Fredoka One', cursive;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.header {
    background: var(--secondary);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    gap: 20px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo img {
    height: 50px;
    width: auto;
}
.logo-text {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--primary);
    letter-spacing: 0.5px;
}
.logo-text span { color: #FFF; }

/* Search Bar */
.search-bar {
    flex: 1;
    max-width: 600px;
    display: flex;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid transparent;
    transition: var(--transition);
}
.search-bar:focus-within {
    background: rgba(255,255,255,0.15);
    border-color: var(--primary);
}
.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    color: #FFF;
    font-size: 0.95rem;
    outline: none;
}
.search-bar input::placeholder { color: rgba(255,255,255,0.5); }
.search-bar select {
    background: rgba(255,255,255,0.08);
    border: none;
    border-left: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    padding: 0 12px;
    cursor: pointer;
    outline: none;
    max-width: 160px;
}
.search-bar select option { background: var(--secondary); color: #FFF; }
.search-bar button {
    background: var(--primary);
    border: none;
    color: #FFF;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}
.search-bar button:hover { background: var(--primary-dark); }

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.header-actions a, .header-actions button {
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    white-space: nowrap;
}
.header-actions a:hover, .header-actions button:hover {
    background: rgba(255,255,255,0.1);
    color: #FFF;
}
.btn-pubblica {
    background: var(--primary) !important;
    color: #FFF !important;
    font-weight: 700;
    padding: 10px 20px !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.9rem !important;
}
.btn-pubblica:hover { background: var(--primary-dark) !important; transform: translateY(-1px); }

.badge-count {
    background: var(--danger);
    color: #FFF;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

/* Nav Categories */
.nav-categories {
    background: rgba(0,0,0,0.15);
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-categories::-webkit-scrollbar { display: none; }
.nav-categories ul {
    display: flex;
    gap: 0;
    white-space: nowrap;
}
.nav-categories li a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.75);
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}
.nav-categories li a:hover,
.nav-categories li a.active {
    color: #FFF;
    background: rgba(255,255,255,0.05);
    border-bottom-color: var(--primary);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--secondary) 0%, #1a3a5c 50%, var(--secondary-light) 100%);
    padding: 40px 0 50px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,107,0,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: #FFF;
    margin-bottom: 10px;
}
.hero h1 span { color: var(--primary); }
.hero p {
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* Location Selector */
.location-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.location-selector select {
    padding: 12px 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.1);
    color: #FFF;
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 200px;
    outline: none;
    transition: var(--transition);
}
.location-selector select:focus { border-color: var(--primary); }
.location-selector select option { background: var(--secondary); color: #FFF; }

/* ============================================
   CATEGORIES GRID
   ============================================ */
.categories-section { padding: 40px 0; }
.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title i { color: var(--primary); }

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.category-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: var(--shadow);
}
.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.category-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}
.category-card span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--secondary);
    display: block;
}
.category-card .count {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 600;
}

/* ============================================
   ADS LISTINGS
   ============================================ */
.ads-section { padding: 20px 0 40px; }
.ads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.ads-header .results-count {
    font-size: 0.9rem;
    color: var(--text-light);
}
.ads-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ads-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.85rem;
    cursor: pointer;
}
.view-toggle { display: flex; gap: 4px; }
.view-toggle button {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    color: var(--text-light);
}
.view-toggle button.active {
    background: var(--primary);
    color: #FFF;
    border-color: var(--primary);
}

/* Ad Card - List View */
.ads-list { display: flex; flex-direction: column; gap: 12px; }

.ad-card {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
}
.ad-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}
.ad-card.vetrina {
    background: var(--vetrina-bg);
    border: 2px solid var(--vetrina-border);
}
.ad-card.vetrina::before {
    content: 'IN VETRINA';
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #FFB300, #FF8F00);
    color: #FFF;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(255,143,0,0.3);
}
.badge-urgente {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--urgente-color);
    color: #FFF;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    z-index: 2;
    animation: pulse-urgente 2s infinite;
}
@keyframes pulse-urgente {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.ad-card-image {
    width: 240px;
    min-height: 180px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}
.ad-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.ad-card:hover .ad-card-image img { transform: scale(1.05); }
.ad-card-image .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 2.5rem;
}
.ad-card-image .img-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #FFF;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
}

.ad-card-body {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ad-card-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ad-card-body h3 a { color: inherit; }
.ad-card-body h3 a:hover { color: var(--primary); }

.ad-card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ad-card-meta i { margin-right: 4px; color: var(--text-muted); }

.ad-card-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ad-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.ad-price {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--primary);
}
.ad-price.gratuito { color: var(--accent); }

.ad-card-actions { display: flex; gap: 8px; }
.btn-favorite {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-favorite:hover, .btn-favorite.active {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(231,76,60,0.05);
}

/* Grid View */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.ads-grid .ad-card {
    flex-direction: column;
}
.ads-grid .ad-card-image {
    width: 100%;
    height: 200px;
}

/* ============================================
   SIDEBAR / FILTERS
   ============================================ */
.page-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    padding: 24px 0;
}
.sidebar { position: sticky; top: 100px; align-self: start; }

.filter-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.filter-box h4 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--secondary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bg);
}
.filter-box label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 600;
}
.filter-box input,
.filter-box select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    margin-bottom: 12px;
    outline: none;
    transition: var(--transition);
}
.filter-box input:focus,
.filter-box select:focus { border-color: var(--primary); }

.filter-box .price-range {
    display: flex;
    gap: 8px;
    align-items: center;
}
.filter-box .price-range input { margin-bottom: 0; }
.filter-box .price-range span { color: var(--text-muted); }

.filter-categories li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: var(--text);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--bg);
    transition: var(--transition);
}
.filter-categories li a:hover { color: var(--primary); padding-left: 4px; }
.filter-categories li a .count {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    color: var(--text-light);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    text-align: center;
}
.btn-primary { background: var(--primary); color: #FFF; }
.btn-primary:hover { background: var(--primary-dark); color: #FFF; transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: #FFF; }
.btn-secondary:hover { background: var(--secondary-light); color: #FFF; }
.btn-outline {
    background: none;
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #FFF; }
.btn-success { background: var(--accent); color: #FFF; }
.btn-success:hover { background: var(--accent-dark); color: #FFF; }
.btn-danger { background: var(--danger); color: #FFF; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--secondary);
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background: var(--bg-card);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255,107,0,0.1); }
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: 0.78rem; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

textarea.form-control { resize: vertical; min-height: 120px; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* Image Upload */
.image-upload-zone {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
}
.image-upload-zone:hover, .image-upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(255,107,0,0.03);
}
.image-upload-zone i { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 10px; }
.image-upload-zone p { color: var(--text-light); font-size: 0.9rem; }

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.image-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 4/3;
}
.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-preview-item .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(231,76,60,0.9);
    color: #FFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* ============================================
   AD DETAIL PAGE
   ============================================ */
.ad-detail { padding: 24px 0; }
.ad-detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

.ad-gallery {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.ad-gallery-main {
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    position: relative;
    background: #000;
}
.ad-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ad-gallery-thumbs {
    display: flex;
    gap: 4px;
    padding: 8px;
    overflow-x: auto;
}
.ad-gallery-thumbs img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition);
}
.ad-gallery-thumbs img:hover, .ad-gallery-thumbs img.active { opacity: 1; }

.ad-info {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-top: 16px;
}
.ad-info h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary);
    margin-bottom: 16px;
}
.ad-info-price {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 16px;
}
.ad-info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.ad-info-meta .meta-item {
    font-size: 0.85rem;
    color: var(--text-light);
}
.ad-info-meta .meta-item i { color: var(--primary); margin-right: 6px; }
.ad-description { font-size: 0.95rem; line-height: 1.8; color: var(--text); }

/* Seller Sidebar */
.seller-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}
.seller-card .seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.seller-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.3rem;
}
.seller-name { font-weight: 700; font-size: 1rem; }
.seller-since { font-size: 0.78rem; color: var(--text-light); }

/* ============================================
   VETRINA PROMOTION SECTION
   ============================================ */
.vetrina-section {
    background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
    border: 2px solid var(--vetrina-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin: 24px 0;
}
.vetrina-section h2 {
    font-family: var(--font-display);
    color: #F57F17;
    margin-bottom: 8px;
}
.vetrina-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.vetrina-package {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    border: 2px solid var(--border);
    transition: var(--transition);
    position: relative;
}
.vetrina-package:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.vetrina-package.popular {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(255,107,0,0.2);
}
.vetrina-package.popular::before {
    content: 'PIU\' SCELTO';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #FFF;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}
.vetrina-package h3 { font-size: 1rem; margin-bottom: 8px; }
.vetrina-package .price {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 4px;
}
.vetrina-package .duration {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

/* ============================================
   USER DASHBOARD
   ============================================ */
.dashboard { padding: 24px 0; }
.dashboard-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
}
.dashboard-nav {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px;
    position: sticky;
    top: 100px;
    align-self: start;
}
.dashboard-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.dashboard-nav a:hover { background: var(--bg); color: var(--primary); }
.dashboard-nav a.active { background: var(--primary); color: #FFF; }
.dashboard-nav a i { width: 20px; text-align: center; }

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 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-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
}
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--secondary);
}
.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-light);
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 460px;
    padding: 40px;
}
.auth-card .logo-auth {
    text-align: center;
    margin-bottom: 30px;
}
.auth-card .logo-auth img { height: 70px; }
.auth-card h2 {
    font-family: var(--font-display);
    text-align: center;
    color: var(--secondary);
    margin-bottom: 6px;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 0.9rem;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ============================================
   FLASH MESSAGES
   ============================================ */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } }
.flash-success { background: #D4EDDA; color: #155724; border: 1px solid #C3E6CB; }
.flash-error { background: #F8D7DA; color: #721C24; border: 1px solid #F5C6CB; }
.flash-warning { background: #FFF3CD; color: #856404; border: 1px solid #FFEEBA; }
.flash-info { background: #D1ECF1; color: #0C5460; border: 1px solid #BEE5EB; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
}
.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    transition: var(--transition);
}
.pagination a {
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active {
    background: var(--primary);
    color: #FFF;
    border: none;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--secondary);
    color: rgba(255,255,255,0.7);
    padding: 50px 0 20px;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}
.footer h4 {
    font-family: var(--font-display);
    color: #FFF;
    margin-bottom: 16px;
    font-size: 1rem;
}
.footer ul li { margin-bottom: 8px; }
.footer ul li a { color: rgba(255,255,255,0.6); font-size: 0.85rem; }
.footer ul li a:hover { color: var(--primary); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 0.82rem;
}

/* ============================================
   HAMBURGER BUTTON (animated)
   ============================================ */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1002;
    flex-shrink: 0;
}
.hamburger-line {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #FFF;
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    transform-origin: center;
}
.hamburger.is-active .hamburger-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}
.hamburger.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.35s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.mobile-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ============================================
   MOBILE DRAWER
   ============================================ */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    z-index: 1001;
    transform: translateX(-105%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 30px rgba(0,0,0,0.15);
    overflow: hidden;
}
.mobile-drawer.is-open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--secondary);
    flex-shrink: 0;
}
.drawer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #FFF;
    font-family: var(--font-display);
    font-size: 1.1rem;
}
.drawer-logo img { height: 36px; }
.drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #FFF;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.drawer-close:hover { background: rgba(255,255,255,0.2); }

/* Drawer User */
.drawer-user {
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.drawer-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
}
.drawer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.2rem;
    flex-shrink: 0;
}
.drawer-user-details strong {
    display: block;
    font-size: 0.95rem;
    color: var(--secondary);
}
.drawer-user-details small {
    font-size: 0.78rem;
    color: var(--text-light);
}
.drawer-auth {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* CTA */
.drawer-cta-wrap {
    padding: 12px 20px;
    flex-shrink: 0;
}
.drawer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #FFF;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
}
.drawer-cta:hover { background: var(--primary-dark); color: #FFF; }

/* Scrollable area */
.drawer-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Sections */
.drawer-section {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.drawer-section-title {
    padding: 10px 20px 6px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s ease;
    position: relative;
}
.drawer-link:hover { background: var(--bg); color: var(--primary); }
.drawer-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-light);
    flex-shrink: 0;
}
.drawer-link:hover i { color: var(--primary); }
.drawer-link .badge-count {
    margin-left: auto;
}
.drawer-link-danger { color: var(--danger) !important; }
.drawer-link-danger i { color: var(--danger) !important; }

/* Drawer Footer */
.drawer-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.drawer-copy {
    padding: 12px 20px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

/* Mobile Quick Actions (header) */
.mobile-quick-actions {
    display: none;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.mq-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #FFF;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
}
.mq-btn:hover { background: rgba(255,255,255,0.2); color: #FFF; }
.mq-pubblica {
    background: var(--primary) !important;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
}
.mq-badge .badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    line-height: 16px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .page-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .ad-detail-layout { grid-template-columns: 1fr; }
    .dashboard-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Show hamburger & mobile actions */
    .hamburger { display: flex; }
    .mobile-quick-actions { display: flex; }

    /* Hide desktop elements */
    .desktop-actions { display: none !important; }
    .nav-categories { display: none !important; }

    /* Header layout */
    .header-top {
        flex-wrap: wrap;
        gap: 8px;
    }
    .logo { flex: 1; min-width: 0; }
    .logo-text { font-size: 1.1rem; }
    .logo img { height: 38px; }

    /* Search bar - hidden by default on mobile, toggleable */
    .search-bar {
        order: 10;
        flex: 1 1 100%;
        max-width: none;
        display: none;
    }
    .search-bar.mobile-visible {
        display: flex;
        animation: slideDown 0.25s ease;
    }
    .search-cat-select { display: none; }

    /* Content adjustments */
    .hero h1 { font-size: 1.6rem; }
    .hero p { font-size: 0.92rem; }
    .categories-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
    .category-card { padding: 14px 8px; }
    .category-card i { font-size: 1.5rem; }
    .category-card span { font-size: 0.75rem; }
    .ad-card { flex-direction: column; }
    .ad-card-image { width: 100%; min-height: 200px; }
    .ads-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .form-row { flex-direction: column; gap: 0; }
    .auth-card { padding: 24px; }
    .vetrina-packages { grid-template-columns: 1fr; }
    .section-title { font-size: 1.2rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }

    /* Disable body scroll when drawer open */
    body.drawer-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .header-top { padding: 8px 0; }
    .logo-text { font-size: 0.95rem; }
    .logo img { height: 32px; }
    .hero { padding: 20px 0 28px; }
    .hero h1 { font-size: 1.3rem; }
    .hero p { font-size: 0.85rem; }
    .location-selector { gap: 8px; }
    .location-selector select { min-width: 100%; font-size: 0.85rem; padding: 10px 14px; }
    .ad-info-price { font-size: 1.5rem; }
    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 1fr; }
    .ads-grid { grid-template-columns: 1fr; }
    .dashboard-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 360px) {
    .logo-text { display: none; }
    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .mq-btn { width: 34px; height: 34px; font-size: 0.85rem; }
    .mq-pubblica { width: 36px; height: 36px; }
}

/* ============================================
   UTILITY
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
