:root {
    --bg: #f4f6f8;
    --card: #fff;
    --text: #1a1f2e;
    --muted: #5c667a;
    --accent: #0d6efd;
    --best: #198754;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --site-width: 1140px;
    --site-gutter: 1.25rem;
}

/* ==========================================================================
   Google AdSense Side Rail Clearance (Reclame Laterale Desktop)
   Permite spațiu de gardă (min. 180px - 190px pe fiecare parte) între 1200px și 1536px
   astfel încât reclamele Google Side Rail (160px lățime) să aibă spațiu dedicat și
   să nu intre în coliziune cu elementele din pagină la derulare (scroll).
   ========================================================================== */
@media (min-width: 1200px) and (max-width: 1536px) {
    :root {
        --site-width: min(1040px, calc(100vw - 380px));
    }
}


* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: var(--site-width);
    margin: 0 auto;
    padding-left: var(--site-gutter);
    padding-right: var(--site-gutter);
}

.container-fluid {
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-sizing: border-box;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--card);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.filters input,
.filters select,
.filters button,
.admin-form input,
.admin-form select,
.admin-form button {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.filters input[type="search"] {
    flex: 1;
    min-width: 180px;
}

.filters button,
.admin-form button {
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
}

.filters button:hover,
.admin-form button:hover {
    filter: brightness(1.05);
}

.btn-link {
    align-self: center;
    color: var(--accent);
    text-decoration: none;
}

.results-meta {
    color: var(--muted);
    margin: 0 0 1rem;
}

.product-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.product-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.product-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
}

.brand,
.category {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-right: 0.5rem;
}

.best-price {
    margin: 1rem 0;
    padding: 0.75rem;
    background: #ecfdf3;
    border-radius: 8px;
}

.best-price .label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
}

.best-price strong {
    font-size: 1.4rem;
    color: var(--best);
}

.savings {
    font-size: 0.9rem;
    color: var(--best);
    margin: 0 0 0.75rem;
}

.offers {
    list-style: none;
    margin: 0;
    padding: 0;
}

.offers li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

.offers li.is-best {
    font-weight: 600;
}

.offers a {
    grid-column: 1 / -1;
    color: var(--accent);
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state a {
    color: var(--accent);
}

/* Admin */
.admin-page {
    width: 100%;
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 0;
}

.admin-page-wide {
    max-width: 100%;
}

.admin-card {
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.admin-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.admin-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.admin-form select,
.admin-form textarea {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1e7dd;
    color: #0f5132;
}

.alert-error {
    background: #f8d7da;
    color: #842029;
}

.admin-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
}

.admin-nav::-webkit-scrollbar {
    display: none;
}

.admin-nav a {
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.admin-nav a.is-active {
    font-weight: 700;
    text-decoration: underline;
}

.admin-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.admin-tile {
    display: block;
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
}

.admin-tile:hover {
    border-color: var(--accent);
}

.admin-tile h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.stats-list {
    margin: 0;
    padding-left: 1.25rem;
}

.admin-form textarea {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
}

.toggle-row,
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.btn-warning {
    background: #b45309;
    color: #fff;
    border: none;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.mapping-table,
.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.mapping-table th,
.mapping-table td,
.preview-table th,
.preview-table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.65rem;
    text-align: left;
}

.mapping-table select {
    width: 100%;
    padding: 0.4rem;
}

.required {
    color: #c0392b;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.form-actions {
    margin-top: 1rem;
}

.btn-link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.code-block {
    background: #1a1f2e;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.offline-page {
    /* legacy — folosește .offline-layout din temă */
}

.product-card img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.card-image-link {
    display: block;
}

.product-card h2 a {
    color: inherit;
    text-decoration: none;
}

.product-card h2 a:hover {
    color: var(--accent);
}

.btn-detail {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.product-detail-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr 1.2fr;
}

@media (max-width: 768px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
    }
}

.product-main-image {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.gallery-thumbs img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.feed-tag {
    font-size: 0.75rem;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

.actions-cell {
    white-space: normal;
}

.actions-cell a,
.actions-cell form {
    display: inline-block;
    margin: 0.15rem 0.5rem 0.15rem 0;
}

.mt-1 {
    margin-top: 1rem;
}

.feed-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.import-source-fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0 1rem;
}

.import-source-fieldset legend {
    padding: 0 0.35rem;
    font-weight: 600;
}

.radio-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.35rem 0;
    cursor: pointer;
}

.badge-stale {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.78rem;
    font-weight: 600;
}

.alert-inline-warn a {
    color: #b45309;
}

.category-pick-list {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
}

/* --- Responsive: tablet & phone --- */
@media (max-width: 768px) {
    :root {
        --site-gutter: 1rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters input[type="search"],
    .filters select,
    .filters button,
    .filters .btn-link {
        width: 100%;
        min-width: 0;
    }

    .filters .btn-link {
        text-align: center;
        padding: 0.5rem;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .product-card {
        padding: 1rem;
    }

    .product-card h2 {
        font-size: 0.95rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    .product-card img {
        height: 140px;
    }

    .best-price {
        padding: 0.5rem;
        margin: 0.75rem 0;
    }

    .best-price strong {
        font-size: 1.1rem;
    }

    .btn-detail {
        font-size: 0.85rem;
    }

    .admin-card {
        padding: 1.1rem;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-header-bar__inner {
        flex-wrap: wrap;
        min-height: auto;
        padding: 0.65rem 0;
    }

    .admin-header-bar__actions {
        width: 100%;
        justify-content: flex-end;
    }

    .mapping-table,
    .preview-table {
        font-size: 0.82rem;
    }

    .mapping-table th,
    .mapping-table td,
    .preview-table th,
    .preview-table td {
        padding: 0.4rem 0.5rem;
    }

    .feed-edit-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .feed-edit-actions .btn-detail,
    .feed-edit-actions form {
        width: 100%;
    }

    .feed-edit-actions .btn-detail {
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root {
        --site-gutter: 0.875rem;
    }

    body {
        font-size: 0.95rem;
    }

    .product-grid {
        gap: 0.5rem;
    }

    .product-card {
        padding: 0.75rem;
    }

    .product-card img {
        height: 110px;
    }

    .best-price strong {
        font-size: 1rem;
    }

    .admin-card h1 {
        font-size: 1.25rem;
    }

    .admin-form button,
    .filters button {
        width: 100%;
    }

    .stats-list {
        padding-left: 1rem;
    }

    .import-wizard__label {
        display: none;
    }

    .import-wizard__num {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.8rem;
    }
}

/* --- Import wizard --- */
.import-wizard {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    margin: 1.25rem 0 1.5rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.import-wizard__step {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.import-wizard__step.is-current {
    color: var(--text);
    font-weight: 600;
}

.import-wizard__step.is-done {
    color: var(--accent);
}

.import-wizard__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
}

.import-wizard__step.is-current .import-wizard__num {
    background: var(--accent);
    color: #fff;
}

.import-wizard__step.is-done .import-wizard__num {
    background: #dbeafe;
    color: var(--accent);
}

.import-wizard__sep {
    flex: 1;
    min-width: 0.75rem;
    max-width: 2rem;
    height: 2px;
    background: #cbd5e1;
}

.wizard-nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-top: 1.25rem;
}

.wizard-nav-buttons .btn-link {
    color: var(--muted);
    text-decoration: none;
}

.wizard-nav-buttons .btn-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.btn-import-final {
    font-weight: 600;
}

.import-category-tree__item {
    padding-left: calc(0.5rem + var(--depth, 0) * 1.1rem);
}

.import-category-tree__all {
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.35rem;
}

.import-summary {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 0.35rem 1rem;
    margin: 0 0 1.25rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.import-summary dt {
    font-weight: 600;
    color: var(--muted);
    margin: 0;
}

.import-summary dd {
    margin: 0;
}

.import-summary__cats {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
}

@media (max-width: 768px) {
    .import-summary {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .import-summary dt {
        margin-top: 0.5rem;
    }

    .wizard-nav-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .wizard-nav-buttons .btn-link {
        text-align: center;
    }
}

/* Site categories (frontend) */
.site-categories-strip {
    margin-bottom: 1.5rem;
}

.site-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.site-category-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.site-category-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.site-category-card__img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    background: #f1f5f9;
}

.site-category-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    background: linear-gradient(135deg, #e2e8f0, #f8fafc);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--muted);
}

.site-category-card__name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

.site-category-card__desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.35;
}

.category-hero {
    display: grid;
    grid-template-columns: minmax(120px, 200px) 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.category-hero__img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    background: #e2e8f0;
}

.category-hero__body p {
    margin: 0 0 0.75rem;
    color: var(--text);
    line-height: 1.5;
}

.results-meta {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.catalog-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.catalog-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.catalog-breadcrumb a:hover {
    text-decoration: underline;
}

.catalog-breadcrumb__sep {
    color: var(--muted);
}

.catalog-breadcrumb__current {
    color: var(--text);
    font-weight: 600;
}

.site-categories-strip--sub {
    margin-bottom: 1.25rem;
}

.site-categories-strip__title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.site-category-card--sub {
    padding: 0.7rem;
}

.admin-category-tree__name {
    min-width: 12rem;
}

.badge-muted {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Admin category thumbnails */
.admin-cat-thumb {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #f1f5f9;
}

.admin-cat-thumb--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.category-edit-preview img {
    display: block;
    width: 100%;
    max-width: 220px;
    margin-top: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .category-hero {
        grid-template-columns: 1fr;
    }

    .site-categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .site-categories-grid {
        grid-template-columns: 1fr;
    }
}

/* Căutare live AJAX dropdown */
.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}
.search-wrapper input[type="search"] {
    width: 100%;
    box-sizing: border-box;
}
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 380px;
    overflow-y: auto;
    margin-top: 8px;
    display: none;
}
.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s ease;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover {
    background: #f9fafb;
}
.autocomplete-item__img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 4px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.autocomplete-item__placeholder {
    width: 45px;
    height: 45px;
    background: #e5e7eb;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.autocomplete-item__content {
    flex: 1;
    min-width: 0;
}
.autocomplete-item__name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #111827;
}
.autocomplete-item__brand {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 2px 0 0 0;
    text-transform: uppercase;
}
.autocomplete-item__price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}
.autocomplete-dropdown__footer {
    padding: 10px 14px;
    background: #f9fafb;
    font-size: 0.85rem;
    text-align: center;
    border-top: 1px solid #f3f4f6;
}
.autocomplete-dropdown__footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.autocomplete-dropdown__footer a:hover {
    text-decoration: underline;
}
.autocomplete-empty {
    padding: 20px 14px;
    text-align: center;
    color: #6b7280;
    font-size: 0.95rem;
}
