:root {
    --primary: #2563eb; --secondary: #1e40af; --accent: #f97316;
    --bg-light: #f3f4f6; --text-dark: #1f2937; --text-light: #6b7280; --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1); --shadow-hover: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background-color: var(--bg-light); color: var(--text-dark); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Globális Form Control */
.form-control { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    font-size: 0.95rem; 
    font-family: inherit; 
    box-sizing: border-box; 
    color: var(--text-dark);
    background-color: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.form-control:disabled { background-color: #f3f4f6; cursor: not-allowed; }

/* --- HEADER & NAV --- */
nav { display: flex; justify-content: space-between; align-items: center; height: 70px; }
.desktop-user-menu { display: flex; align-items: center; }
.user-greeting { margin-right: 15px; font-weight: 600; color: var(--text-dark); }
.mobile-only { display: none; }
.hamburger { display: none; background: none; border: none; font-size: 24px; color: var(--primary); cursor: pointer; padding: 5px 10px; }
header { background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.logo img { max-height: 50px; display: block; object-fit: contain; }

.nav-buttons { display: flex; align-items: center; }
.btn { padding: 10px 20px; border-radius: 50px; font-weight: 600; cursor: pointer; transition: 0.3s; border: none; display: inline-block; font-size: 14px; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #ea580c; transform: translateY(-2px); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; padding: 8px 18px; }

/* --- HERO SECTION --- */
.hero { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; padding: 60px 0; margin-bottom: 40px; }
.hero h1 { font-size: 2.5rem; margin-bottom: 10px; line-height: 1.2; }
.hero p { font-size: 1.2rem; margin-bottom: 30px; opacity: 0.9; }
.search-bar { background: var(--white); padding: 10px; border-radius: 50px; display: flex; max-width: 600px; margin: 0 auto; box-shadow: var(--shadow-hover); }
.search-bar input { border: none; flex: 1; padding: 10px 20px; outline: none; font-size: 16px; border-radius: 50px; }

/* --- KATEGÓRIÁK --- */
.section-title { font-size: 1.8rem; margin-bottom: 30px; border-left: 5px solid var(--accent); padding-left: 15px; }
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; margin-bottom: 60px; }
.cat-card { background: var(--white); padding: 20px; border-radius: 12px; text-align: center; box-shadow: var(--shadow); transition: 0.3s; cursor: pointer; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.cat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.cat-card .cat-icon { width: 48px; height: 48px; object-fit: contain; margin-bottom: 10px; }
.cat-card h3 { font-size: 14px; font-weight: 600; }

/* --- LISTING KÁRTYÁK --- */
.featured-grid { display: grid; grid-template-columns: 1fr; gap: 30px; margin-bottom: 60px; }
@media(min-width: 992px) { .featured-grid { grid-template-columns: 1fr 1fr; } }

.listing-card-featured, .listing-card { background: var(--white); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: 0.3s; position: relative; }
.listing-card-featured:hover, .listing-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

/* Nagy kártya (Kiemelt) */
.listing-card-featured { display: flex; flex-direction: column; }
@media(min-width: 992px) { .listing-card-featured { flex-direction: row; min-height: 250px; } }
.listing-card-featured img { width: 100%; height: 220px; object-fit: cover; flex-shrink: 0; }
@media(min-width: 992px) { .listing-card-featured img { width: 45%; height: auto; min-height: 100%; } }

/* Kis kártya (Legfrissebb) */
.latest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 25px; margin-bottom: 60px; }
.listing-card .listing-img-box { height: 180px; overflow: hidden; }
.listing-card img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.listing-card:hover img { transform: scale(1.1); }

.listing-info, .listing-info-featured { padding: 20px; display: flex; flex-direction: column; justify-content: center; width: 100%; flex-grow: 1; }

.listing-link::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 1; }

/* A helyszín linkje legyen a kártya linkje fölött */
.listing-loc-link { position: relative; z-index: 5; transition: 0.2s; }
.listing-loc-link:hover { color: var(--primary) !important; }

.tag-category { display: inline-block; background: #f0f4f8; color: #4b5563; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 50px; margin-bottom: 10px; text-decoration: none; position: relative; z-index: 2; transition: 0.2s; }
.tag-category:hover { background: #e2e8f0; color: var(--primary); }

.listing-name { font-size: 16px; font-weight: 600; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0; }
.listing-cost { font-size: 18px; color: var(--primary); font-weight: 700; margin-top: auto; display: flex; justify-content: space-between; }
.price-large { font-size: 1.5rem; color: var(--primary); font-weight: 700; margin: 10px 0; }
.fav-icon { color: #cbd5e1; cursor: pointer; transition: 0.2s; position: relative; z-index: 2; }
.fav-icon:hover { color: #ef4444; }

/* --- SEO & FOOTER --- */
.seo-wrapper { background: var(--white); padding: 50px 40px; border-radius: 16px; box-shadow: var(--shadow); margin: 60px 0; }
.seo-wrapper h1 { color: var(--primary); font-size: 2rem; margin-bottom: 15px; text-align: center; }
.seo-wrapper h2 { font-size: 1.5rem; margin-top: 30px; margin-bottom: 15px; }
.seo-wrapper p { color: #4b5563; margin-bottom: 15px; }
.seo-wrapper ul { padding-left: 20px; margin-bottom: 15px; color: #4b5563; }
.seo-wrapper a { color: var(--primary); font-weight: 600; }

footer { background: #f8fafc; padding: 40px 0; margin-top: 50px; border-top: 1px solid #e2e8f0; text-align: center; color: #64748b; font-size: 0.9rem; }
.footer-menu { margin-bottom: 15px; }
.footer-menu a { color: #64748b; text-decoration: none; margin: 0 5px; transition: 0.2s; }
.footer-menu a:hover { color: var(--primary); }

/* --- MOBIL SZABÁLYOK JAVÍTÁSA (768px alatt) --- */
@media (max-width: 768px) {
    header { position: relative !important; top: auto !important; }
    #mobile-user-dropdown { position: absolute; top: 70px; }
    nav.nav-logged-out { flex-wrap: wrap; height: auto !important; padding: 15px 0; justify-content: center; }
    .nav-logged-out .logo { flex: 0 0 100%; display: flex; justify-content: center; margin-bottom: 15px; }
    nav.nav-logged-in { flex-wrap: nowrap !important; height: 70px !important; justify-content: space-between; }
    .desktop-user-menu { display: none !important; }
    .hamburger { display: block !important; order: 3; position: relative; z-index: 101; }
    .btn-publish { order: 2; margin-left: auto !important; margin-right: 10px !important; }
    .btn-publish span { display: none; }
    #mobile-user-dropdown { display: block !important; position: absolute; left: 0; width: 100%; background: #ffffff; box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 999; max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; pointer-events: none; }
    header:has(.nav-logged-out) #mobile-user-dropdown { top: 125px; }
    #mobile-user-dropdown.active { max-height: 600px !important; pointer-events: auto !important; border-top: 1px solid #f1f5f9; }
    .mobile-menu-header { padding: 18px 25px; background: #f8fafc; font-size: 0.9rem; color: var(--primary); font-weight: 700; border-bottom: 1px solid #f1f5f9; }
    #mobile-user-dropdown a { display: flex !important; align-items: center; padding: 16px 25px; color: var(--text-dark); text-decoration: none; font-weight: 500; border-bottom: 1px solid #f8fafc; transition: background 0.2s; font-size: 1rem; }
    #mobile-user-dropdown a i { width: 30px; font-size: 1.2rem; color: var(--primary); margin-right: 10px; text-align: center; }
    .logout-link { color: #ef4444 !important; margin-top: 5px; }
    .logout-link i { color: #ef4444 !important; }
}

/* --- RESPONSIVE TABLE --- */
.responsive-table { width: 100%; border-collapse: collapse; }
.responsive-table thead tr { background: #f8fafc; border-bottom: 2px solid #f1f5f9; text-align: left; }
.responsive-table th, .responsive-table td { padding: 15px; border-bottom: 1px solid #f1f5f9; }

/* --- MY ADS PAGE (HIRDETÉSKEZELŐ) --- */
.myad-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; }
.myad-title { font-weight: 700; color: var(--text-dark); margin-bottom: 2px; }
.myad-meta { font-size: 0.85rem; color: var(--text-light); }
.action-buttons { display: flex; gap: 8px; }
.btn-action { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: all 0.2s ease; cursor: pointer; }
.btn-view { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-view:hover { background: var(--primary); color: #fff !important; }
.btn-delete { border: 2px solid #ef4444; color: #ef4444; background: transparent; }
.btn-delete:hover { background: #ef4444; color: #fff !important; }
.btn-edit { border: 2px solid #10b981; color: #10b981; background: transparent; }
.btn-edit:hover { background: #10b981; color: #fff !important; }
.btn-highlight { border: 2px solid #f59e0b; color: #f59e0b; background: transparent; }
.btn-highlight:hover { background: #f59e0b; color: #fff !important; }
.btn-extend { border: 2px solid #0284c7; color: #0284c7; background: transparent; }
.btn-extend:hover { background: #0284c7; color: #fff !important; }

/* Státusz kapszulák */
.status-pill { padding: 4px 10px; border-radius: 50px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; display: inline-block; }
.status-active { background: #dcfce7; color: #166534; }
.status-draft { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.status-pending { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }
.status-expired { background: #fee2e2; color: #991b1b; }

@media (max-width: 768px) {
    .responsive-table thead { display: none; }
    .responsive-table tr { display: flex; flex-direction: column; margin-bottom: 20px; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; background: #fff; box-shadow: var(--shadow); }
    .responsive-table td { display: flex; justify-content: space-between; align-items: center; padding: 10px 5px; border-bottom: 1px solid #f1f5f9; }
    .responsive-table td:before { content: attr(data-label); font-weight: 700; color: var(--text-light); font-size: 0.8rem; }
    .responsive-table td[data-label="Hirdetés adatai"] { order: 1; display: block; border-bottom: none; }
    .responsive-table td[data-label="Hirdetés adatai"]:before { display: none; }
    .responsive-table td[data-label="Kép"] { order: 2; justify-content: center; padding: 10px 0; }
    .responsive-table td[data-label="Kép"]:before { display: none; }
    .responsive-table .myad-thumb { width: 100%; max-width: 250px; height: auto; }
    .responsive-table td[data-label="Státusz"] { order: 3; }
    .responsive-table td[data-label="Műveletek"] { order: 4; border-bottom: none; }
}

/* --- AUTH OLDALAK --- */
#page-auth .auth-container { max-width: 500px; margin: 50px auto; background: var(--white); padding: 40px; border-radius: 16px; box-shadow: var(--shadow); }
#page-auth h1 { text-align: center; color: var(--primary); margin-bottom: 30px; font-size: 2rem; }
#page-auth .form-group { margin-bottom: 20px; text-align: left; }
#page-auth .form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-dark); }
#page-auth .btn-submit { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: 0.3s; }
#page-auth .btn-submit:hover { background: var(--secondary); }
#page-auth .auth-links { text-align: center; margin-top: 20px; font-size: 0.9rem; }
#page-auth .alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: 500; text-align: center; }

/* --- DETAILS OLDAL (Részletes hirdetés) --- */
#page-details .details-grid { display: grid; grid-template-columns: 1fr; gap: 30px; margin-bottom: 50px; }
@media (min-width: 992px) { 
    #page-details .details-grid { 
        grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); 
    } 
}

#page-details .main-image { width: 100%; height: auto; border-radius: 12px; object-fit: cover; box-shadow: var(--shadow); }
@media (min-width: 992px) { #page-details .main-image { height: 500px; object-fit: contain; background-color: #f1f5f9; } }
#page-details .content-box { background: var(--white); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); margin-bottom: 25px; }
#page-details .gallery-thumbs img:hover { border-color: var(--primary) !important; opacity: 0.8; }

.highlight-banner { background-color: var(--accent); color: #ffffff; text-align: center; padding: 15px; font-weight: 700; font-size: 1.3rem; text-transform: uppercase; letter-spacing: 2px; border-radius: 12px; margin-bottom: 25px; box-shadow: 0 4px 10px rgba(249, 115, 22, 0.2); border: 1px solid rgba(255,255,255,0.2); }

.seller-box { background: #ffffff; border-radius: 12px; padding: 25px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); margin-bottom: 20px; }
.user-block { display: flex; align-items: center; margin-bottom: 25px; gap: 15px; }
.user-avatar { width: 65px; height: 65px; background: #e5e7eb; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 28px; flex-shrink: 0; }
.user-details { overflow: hidden; }
.user-details h4 { margin: 0; font-weight: 700; font-size: 1.2rem; color: #1f2937; line-height: 1.2; word-break: break-word; }
.user-details small { color: #4b5563; font-size: 0.9rem; display: block; margin-top: 5px; }

.contact-btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: 14px 10px; border-radius: 10px; border: none; font-weight: 700; font-size: 1.05rem; cursor: pointer; transition: 0.3s; margin-bottom: 12px; color: #ffffff !important; text-decoration: none; text-align: center; }
.contact-btn i { margin-right: 10px; font-size: 1.2rem; flex-shrink: 0; }
.btn-tel { background: #22c55e !important; }
.btn-tel:hover { background: #16a34a !important; }
.btn-msg { background: #2563eb !important; }
.btn-msg:hover { background: #1d4ed8 !important; }

/* --- SZŰRŐDOBOZ (Kategória oldal kereső) --- */
.filter-box { background: var(--white); padding: 25px; border-radius: 16px; margin-bottom: 40px; box-shadow: var(--shadow); }
.filter-form { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; }
.filter-group { flex: 1; min-width: 200px; }
.filter-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-dark); font-size: 0.9rem; }
.filter-price-inputs { display: flex; gap: 8px; }

/* --- KIEMELT SZALAG (RIBBON) --- */
.listing-card-featured { position: relative; overflow: hidden; }
.ribbon-wrapper { width: 150px; height: 150px; overflow: hidden; position: absolute; top: -10px; left: -10px; z-index: 10; pointer-events: none; }
.ribbon-text { font-size: 13px; font-weight: 700; color: #fff; text-transform: uppercase; text-align: center; line-height: 34px; transform: rotate(-45deg); width: 200px; display: block; background: var(--accent); background: linear-gradient(#f97316 0%, #ea580c 100%); box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1); position: absolute; top: 30px; left: -50px; letter-spacing: 1px; }

/* --- EGYÉB & GYORSKERESŐ JAVÍTÁS --- */
.search-bar-wrapper { position: relative; width: 100%; max-width: 600px; margin: 0 auto; }
#search-suggestions { position: absolute; top: 100%; left: 10px; right: 10px; background: #fff; border-radius: 0 0 15px 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 1000; display: none; overflow: hidden; border: 1px solid #e2e8f0; border-top: none; }

.search-result-item { 
    display: flex !important; 
    align-items: center; 
    padding: 10px 15px; 
    border-bottom: 1px solid #f1f5f9; 
    transition: 0.2s; 
    text-decoration: none !important;
    position: relative;
    z-index: 20;
}
.search-result-item:hover { background: #f8fafc; }

.result-img { width: 45px; height: 45px; flex-shrink: 0; margin-right: 12px; }
.result-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }

/* JAVÍTÁS: Szöveg megjelenítése flexboxban */
.result-title { 
    flex: 1; 
    min-width: 0;
    font-size: 0.95rem; 
    font-weight: 600; 
    color: var(--text-dark) !important; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 40px 0 60px; flex-wrap: wrap; }
.page-link { display: flex; align-items: center; justify-content: center; min-width: 45px; height: 45px; padding: 0 15px; background: #ffffff; color: #1f2937; text-decoration: none; font-weight: 600; border-radius: 10px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); transition: all 0.2s ease; border: none; font-size: 1rem; }
.page-link.active { background: #2563eb; color: #ffffff; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3); }

.alert-danger { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; }
.alert-success { background:#dcfce7; color:#166534; border:1px solid #bbf7d0; }