<style>
    body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

/* Anulează orice container wrapper care limitează lățimea */
.container-fluid,
.wrapper,
#wrapper,
.main-wrapper,
.content-wrapper {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Asigură-te că secțiunile colorate merg până la margine */
.full-width-section {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    position: relative;
    left: 0;
    right: 0;
}
</style>
<!DOCTYPE html>
<html lang="ro">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tecro - Platformă Piese Auto</title>
    
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Montserrat:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.0.0/css/flag-icons.min.css">
    
<style>
    :root {
        --primary: #006eff;
        --primary-hover: #e04e00;
        --secondary: #041a24;
        --header-bg: #00071f;
        --header-text: #c9c9c9;
        --header-link: #9d9e9f;
        --header-link-hover: #007bff;
        --topbar-bg: #02001f;
        --topbar-text: #f2f2f2;
        --topbar-link: #94a3b8;
        --topbar-link-hover: #0084ff;
        --button-bg: #0084ff;
        --button-hover: #032549;
        --button-text: #ffffff;
        --button-radius: 8px;
        --border-radius: 8px;
        --body-font: Inter, sans-serif;
        --body-font-size: 14px;
        --heading-font: Montserrat, sans-serif;
        --heading-font-size: 24px;
        --button-font-size: 14px;
    }
    
    * { margin: 0; padding: 0; box-sizing: border-box; }
    
    body {
        font-family: var(--body-font);
        font-size: var(--body-font-size);
        background: #f8fafc;
        color: #1e293b;
    }
    
    /* ========== TOP BAR ========== */
    .top-bar {
        background: var(--topbar-bg) !important;
        color: var(--topbar-text) !important;
        font-size: 12px;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .top-bar a { color: #fff !important; }
    .top-bar a:hover { color: var(--primary) !important; }
    .top-bar .separator { color: #334155; margin: 0 12px; }
    .top-bar-right { display: flex; align-items: center; gap: 15px; justify-content: flex-end; }
    
    /* ========== MAIN HEADER ========== */
    .main-header {
        background: var(--header-bg) !important;
        padding: 15px 0;
        box-shadow: 0 2px 15px rgba(0,0,0,0.05);
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    .main-header a,
    .main-header .logo-text,
    .main-header .navbar-brand {
        color: var(--header-text) !important;
    }
    .logo-img { height: 63px; }
    .logo-text {
        font-size: 22px;
        font-weight: 800;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    
    /* ========== RCA BUTTON ========== */
    @keyframes blink {
        0% { background: #dc2626; box-shadow: 0 0 0px #dc2626; }
        50% { background: #ef4444; box-shadow: 0 0 15px #ef4444; }
        100% { background: #dc2626; box-shadow: 0 0 0px #dc2626; }
    }
    .rca-button {
        background: #dc2626;
        color: white !important;
        padding: 5px 15px;
        border-radius: 30px;
        font-weight: 700;
        font-size: 13px;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        animation: blink 1.5s infinite ease-in-out;
    }
    .rca-button:hover { background: #b91c1c; animation: none; transform: scale(1.02); }
    
    /* ========== LANGUAGE & CURRENCY ========== */
    .lang-btn, .currency-btn {
        background: transparent;
        border: none;
        color: var(--topbar-text) !important;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 5px 10px;
        border-radius: 20px;
        font-size: 12px;
    }
    .lang-btn:hover, .currency-btn:hover {
        background: rgba(255,255,255,0.1);
        color: var(--topbar-link-hover) !important;
    }
    
    /* ========== SEARCH ========== */
    .search-wrapper { display: flex; gap: 10px; align-items: center; }
    .search-select {
        width: 180px;
        padding: 12px 16px;
        border: 1px solid #e2e8f0;
        border-radius: var(--border-radius);
        background: white;
        font-size: 13px;
    }
    .search-input-wrapper { flex: 1; position: relative; }
    .search-input-wrapper i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
    .search-input {
        width: 100%;
        padding: 12px 20px 12px 42px;
        border: 1px solid #e2e8f0;
        border-radius: var(--border-radius);
        font-size: 13px;
        outline: none;
    }
    .search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(248,90,0,0.1); }
    .search-btn {
        background: #0081f8 !important;
        border-radius: var(--button-radius) !important;
        color: var(--button-text) !important;
        font-size: var(--button-font-size) !important;
        border: none;
        padding: 12px 28px;
        font-weight: 600;
        transition: all 0.2s;
    }
    .search-btn:hover { background: var(--button-hover) !important; transform: translateY(-1px); }
    
    /* ========== HEADER ICONS ========== */
    .header-icons { display: flex; align-items: center; gap: 25px; justify-content: flex-end; }
    .icon-text-btn,
    .header-icons a { color: var(--header-link) !important; }
    .icon-text-btn:hover,
    .header-icons a:hover { color: var(--header-link-hover) !important; }
    
    /* ========== CART ========== */
    .cart-wrapper { position: relative; }
    .cart-count {
        position: absolute;
        top: -8px;
        right: -12px;
        background: var(--primary);
        color: white;
        font-size: 10px;
        font-weight: 700;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* ========== BOTTOM MENU ========== */
    .bottom-menu {
        background: var(--secondary);
        padding: 0;
        border-top: 1px solid #3a3a3a;
    }
    .bottom-menu .nav-link {
        color: #cbd5e1;
        padding: 12px 20px;
        font-weight: 500;
        font-size: 13px;
    }
    .bottom-menu .nav-link:hover { color: var(--primary); }
    .bottom-menu .nav-link.active { color: var(--primary); }
    
    /* ========== DROPDOWN ========== */
    .dropdown-container { position: relative; }
    .dropdown-menu-custom {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: white;
        border-radius: 16px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.15), 0 5px 12px rgba(0,0,0,0.05);
        min-width: 240px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10000;
        border: none;
        overflow: hidden;
    }
    .dropdown-menu-custom.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        animation: dropdownFade 0.2s ease;
    }
    .dropdown-menu-custom a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 20px;
        color: #475569;
        text-decoration: none;
        font-size: 12px;
        font-weight: 500;
        color: #000 !important;
        transition: all 0.2s;
    }
    .dropdown-menu-custom a i { width: 24px; font-size: 16px; color: var(--primary); }
    .dropdown-menu-custom a:hover {
        background: #f8fafc;
        color: var(--primary);
        padding-left: 28px;
    }
    .dropdown-divider { margin: 8px 0; background: #eef2ff; height: 1px; }
    
    @keyframes dropdownFade {
        from { opacity: 0; transform: translateY(-15px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    /* ========== CUSTOM DROPDOWN (CONT, GARAJ, COS) ========== */
    .custom-dropdown-container { position: relative; display: inline-block; }
    .custom-dropdown-btn {
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        font-size: 11px;
        color: var(--header-link);
        transition: all 0.3s;
    }
    .custom-dropdown-btn i { font-size: 22px; color: var(--primary); }
    .custom-dropdown-btn:hover { color: var(--header-link-hover); }
    .custom-dropdown-btn:hover i { transform: translateY(-2px); }
    .custom-dropdown-menu {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 12px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.15);
        min-width: 250px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10000;
        border: 1px solid rgba(0,0,0,0.05);
        overflow: hidden;
    }
    .custom-dropdown-menu.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        animation: slideDown 0.25s ease;
    }
    .custom-dropdown-menu a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 18px;
        color: #475569;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s;
    }
    .custom-dropdown-menu a i { width: 24px; font-size: 16px; color: var(--primary); }
    .custom-dropdown-menu a:hover {
        background: #f8fafc;
        color: var(--primary);
        padding-left: 24px;
    }
    .custom-dropdown-divider { height: 1px; background: #eef2ff; margin: 8px 0; }
    .custom-badge {
        background: var(--primary);
        color: white;
        font-size: 10px;
        padding: 2px 8px;
        border-radius: 20px;
        margin-left: auto;
    }
    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-15px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    /* ========== MODAL ========== */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 10000;
        display: none;
        align-items: center;
        justify-content: center;
    }
    .modal-overlay.active { display: flex !important; }
    .modal-window {
        background: white;
        border-radius: 16px;
        max-width: 900px;
        width: 90%;
        max-height: 80vh;
        overflow: hidden;
    }
    .modal-header {
        padding: 20px;
        border-bottom: 1px solid #e2e8f0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .modal-header h3 { margin: 0; font-size: 18px; }
    .modal-close-btn {
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #64748b;
    }
    .modal-close-btn:hover { color: #ef4444; }
    .modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
    
    /* ========== WIZARD STEPS ========== */
    .wizard-steps {
        display: flex;
        justify-content: space-between;
        margin-bottom: 30px;
        padding: 0 20px;
    }
    .wizard-step {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        color: #94a3b8;
        font-size: 12px;
        flex: 1;
    }
    .wizard-step span {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #e2e8f0;
        color: #64748b;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 14px;
    }
    .wizard-step.active span {
        background: #f97316;
        color: white;
    }
    .wizard-step.completed span {
        background: #10b981;
        color: white;
    }
    
    /* ========== BACK BUTTON ========== */
    .wizard-back-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 16px;
        background: #f1f5f9;
        border: none;
        border-radius: 30px;
        color: #475569;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        margin-bottom: 16px;
    }
    .wizard-back-btn:hover {
        background: #e2e8f0;
        color: #1e293b;
        transform: translateX(-2px);
    }
    .wizard-back-btn i {
        font-size: 12px;
    }
    
    .selected-info {
        background: #f8fafc;
        padding: 12px 16px;
        border-radius: 12px;
        margin-bottom: 20px;
        font-size: 13px;
        color: #64748b;
        border-left: 4px solid #f97316;
    }
    
    /* ========== PART CARDS ========== */
    .part-selection-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        max-height: 400px;
        overflow-y: auto;
    }
    .part-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px;
        background: #f8fafc;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s;
        border: 1px solid #eef2ff;
    }
    .part-card:hover {
        background: white;
        border-color: #f97316;
        transform: translateX(4px);
    }
    .part-card i {
        color: #f97316;
        font-size: 20px;
    }
    
    /* ========== BRAND SEARCH ========== */
    .brand-search-wrapper {
        position: relative;
        margin-bottom: 20px;
    }
    .brand-search-wrapper i {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: #94a3b8;
        font-size: 14px;
        z-index: 1;
    }
    .brand-search-input {
        width: 100%;
        padding: 14px 50px 14px 48px;
        border: 2px solid #eef2ff;
        border-radius: 50px;
        font-size: 14px;
        outline: none;
        transition: all 0.2s;
        background: white;
    }
    .brand-search-input:focus {
        border-color: #f97316;
        box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
    }
    .brand-search-clear {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        background: #e2e8f0;
        border: none;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #64748b;
        transition: all 0.2s;
        z-index: 2;
    }
    .brand-search-clear:hover {
        background: #f97316;
        color: white;
    }
    
    /* ========== BRAND GRID ========== */
    .brand-selection-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        max-height: 350px;
        overflow-y: auto;
        padding-right: 4px;
    }
    .brand-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 16px 8px;
        background: #f8fafc;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s;
        border: 1px solid #eef2ff;
    }
    .brand-card:hover {
        background: white;
        border-color: #f97316;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(249,115,22,0.1);
    }
    .brand-card img {
        width: 56px;
        height: 56px;
        object-fit: contain;
    }
    .brand-card span {
        font-size: 12px;
        font-weight: 600;
        color: #1e293b;
        text-align: center;
    }
    
    /* ========== MODEL GROUPS ========== */
    .model-groups-container {
        max-height: 400px;
        overflow-y: auto;
        padding-right: 4px;
    }
    .model-group {
        margin-bottom: 8px;
        border: 1px solid #eef2ff;
        border-radius: 12px;
        overflow: hidden;
        background: white;
    }
    .model-group-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: #f8fafc;
        cursor: pointer;
        transition: all 0.2s;
        border-left: 3px solid #f97316;
    }
    .model-group-header:hover {
        background: #f1f5f9;
    }
    .group-chevron {
        color: #f97316;
        font-size: 12px;
        transition: transform 0.2s;
        width: 16px;
    }
    .group-chevron.rotated {
        transform: rotate(90deg);
    }
    .group-name {
        flex: 1;
        font-weight: 700;
        color: #0f172a;
        font-size: 14px;
    }
    .group-count {
        background: #e2e8f0;
        color: #475569;
        font-size: 11px;
        font-weight: 600;
        padding: 2px 10px;
        border-radius: 30px;
    }
    .model-group-items {
        background: white;
    }
    .model-item, .model-item-single {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px 12px 44px;
        background: white;
        cursor: pointer;
        transition: all 0.2s;
        border-bottom: 1px solid #f1f5f9;
    }
    .model-item:last-child {
        border-bottom: none;
    }
    .model-item-single {
        padding: 12px 16px;
        border: 1px solid #eef2ff;
        border-radius: 12px;
        margin-bottom: 8px;
    }
    .model-item:hover, .model-item-single:hover {
        background: #fef3c7;
        transform: translateX(4px);
    }
    .model-item i, .model-item-single i {
        color: #f97316;
        font-size: 14px;
    }
    .model-item span, .model-item-single span {
        flex: 1;
        font-size: 13px;
        color: #334155;
    }
    .model-item i:last-child, .model-item-single i:last-child {
        color: #94a3b8;
        font-size: 11px;
    }
    .engine-count-badge {
        background: #10b981;
        color: white;
        font-size: 10px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 30px;
        margin-left: 8px;
    }
    .model-item-single .engine-count-badge {
        margin-left: auto;
        margin-right: 8px;
    }
    .filter-info {
        padding: 8px 12px;
        background: #e0f2fe;
        border-radius: 8px;
        margin-bottom: 16px;
        font-size: 12px;
        color: #0369a1;
    }
    .filter-info i {
        margin-right: 6px;
    }
    
    /* ========== ENGINE LISTS ========== */
    .engine-selection-list {
        max-height: 400px;
        overflow-y: auto;
    }
    .engine-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: #f8fafc;
        border-radius: 12px;
        margin-bottom: 8px;
        cursor: pointer;
        transition: all 0.2s;
    }
    .engine-item:hover {
        background: white;
        border-color: #f97316;
        transform: translateX(4px);
    }
    .engine-category {
        padding: 8px 16px;
        background: #0f172a;
        color: white;
        font-weight: 700;
        font-size: 12px;
        border-radius: 6px;
        margin: 12px 0 8px;
    }
    
    /* ========== SCROLLBAR ========== */
    .brand-selection-grid::-webkit-scrollbar,
    .model-groups-container::-webkit-scrollbar,
    .engine-selection-list::-webkit-scrollbar,
    .part-selection-grid::-webkit-scrollbar {
        width: 6px;
    }
    .brand-selection-grid::-webkit-scrollbar-track,
    .model-groups-container::-webkit-scrollbar-track,
    .engine-selection-list::-webkit-scrollbar-track,
    .part-selection-grid::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 10px;
    }
    .brand-selection-grid::-webkit-scrollbar-thumb,
    .model-groups-container::-webkit-scrollbar-thumb,
    .engine-selection-list::-webkit-scrollbar-thumb,
    .part-selection-grid::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }
    .brand-selection-grid::-webkit-scrollbar-thumb:hover,
    .model-groups-container::-webkit-scrollbar-thumb:hover,
    .engine-selection-list::-webkit-scrollbar-thumb:hover,
    .part-selection-grid::-webkit-scrollbar-thumb:hover {
        background: #f97316;
    }
    
    /* ========== MEGA MENU ========== */
    .bottom-menu { position: relative; }
    .desktop-menu { display: block; }
    .dropdown-mega { position: static; }
    .dropdown-mega .dropdown-toggle::after {
        display: inline-block;
        margin-left: 5px;
        vertical-align: middle;
        content: "▼";
        font-size: 10px;
        border: none;
    }
    .mega-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.15);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        z-index: 1000;
        border-top: 3px solid var(--primary);
    }
    .dropdown-mega:hover .mega-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .mega-dropdown-inner { padding: 30px; max-width: 1200px; margin: 0 auto; }
    .mega-dropdown-inner h6 {
        color: var(--primary);
        font-weight: 700;
        margin-bottom: 15px;
        font-size: 14px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    .mega-dropdown-inner ul { list-style: none; padding: 0; margin: 0; }
    .mega-dropdown-inner ul li { margin-bottom: 8px; }
    .mega-dropdown-inner ul li a {
        color: #475569;
        text-decoration: none;
        font-size: 13px;
        transition: all 0.2s;
        display: block;
    }
    .mega-dropdown-inner ul li a:hover { color: var(--primary); transform: translateX(5px); }
    
    /* ========== MOBILE MENU ========== */
    .mobile-menu-toggle {
        display: none;
        flex-direction: column;
        cursor: pointer;
        padding: 15px;
        width: 50px;
        height: 50px;
        justify-content: center;
        align-items: center;
        background: var(--primary);
        border-radius: 8px;
        margin: 10px auto;
    }
    .mobile-menu-toggle .bar {
        width: 25px;
        height: 3px;
        background: white;
        margin: 3px 0;
        transition: all 0.3s;
        border-radius: 3px;
    }
    .mobile-menu-toggle.active .bar:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .mobile-menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle.active .bar:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }
    .mobile-menu {
        display: none;
        background: white;
        border-radius: 12px;
        margin-top: 10px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
    }
    .mobile-menu.show { display: block; max-height: 500px; overflow-y: auto; }
    .mobile-menu ul { list-style: none; padding: 0; margin: 0; }
    .mobile-menu > ul > li { border-bottom: 1px solid #e2e8f0; }
    .mobile-menu > ul > li > a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        color: #1e293b;
        text-decoration: none;
        font-weight: 500;
        gap: 10px;
    }
    .mobile-menu > ul > li > a i:first-child { width: 25px; color: var(--primary); }
    .mobile-menu > ul > li > a .arrow { transition: transform 0.3s; font-size: 12px; }
    .mobile-menu > ul > li.open > a .arrow { transform: rotate(90deg); }
    .mobile-menu .submenu { display: none; background: #f8fafc; padding-left: 45px; }
    .mobile-menu .submenu li a {
        display: block;
        padding: 10px 0;
        color: #475569;
        text-decoration: none;
        font-size: 13px;
    }
    
    /* ========== RESPONSIVE ========== */
    @media (max-width: 992px) {
        .desktop-menu { display: none; }
        .mobile-menu-toggle { display: flex; }
        .mobile-menu { display: block; }
        .header-icons { margin-top: 15px; justify-content: center; }
        .search-wrapper { flex-direction: column; }
        .search-select { width: 100%; }
        .search-btn { width: 100%; }
        .top-bar .row { flex-direction: column; text-align: center; gap: 10px; }
        .top-bar-right { justify-content: center; flex-wrap: wrap; }
    }
    @media (min-width: 993px) {
        .mobile-menu-toggle, .mobile-menu { display: none !important; }
    }
    @media (max-width: 768px) {
        .brand-selection-grid { grid-template-columns: repeat(3, 1fr); }
    }
    @media (max-width: 480px) {
        .brand-selection-grid { grid-template-columns: repeat(2, 1fr); }
        .part-selection-grid { grid-template-columns: 1fr; }
    }
</style>
</head>
<body>

<!-- ============================================ -->
<!-- TOP BAR -->
<!-- ============================================ -->
<div class="top-bar">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-md-5">
                <i class="fas fa-phone-alt me-2"></i> 
                <a href="tel:+402809003434">+40 280 900 3434</a>
                <span class="separator">|</span>
                <i class="fas fa-envelope me-2"></i>
                <a href="mailto:contact@tecro.ro">contact@tecro.ro</a>
                <span class="separator">|</span>
                <i class="fas fa-clock me-2"></i>
                Lun - Vin: 09:00 - 18:00            </div>
            <div class="col-md-3 text-center">
                <a href="https://rca.tecro.ro" target="_blank" class="rca-button">
                    <i class="fas fa-shield-alt"></i> RCA ONLINE
                    <i class="fas fa-bolt"></i>
                </a>
            </div>
            <div class="col-md-4">
                <div class="top-bar-right">
                    <div class="dropdown-container" style="position:relative;"><button class="lang-btn" onclick="toggleLangDropdown()"><i class="fas fa-globe"></i> <span>Română</span><i class="fas fa-chevron-down" style="font-size: 10px; margin-left: 5px;"></i></button><div id="langDropdown" class="dropdown-menu-custom"><a href="?set_lang=ro" style="background:#f85a00;color:white;"><span class="fi fi-ro" style="width:20px; height:15px; border-radius:2px;"></span> Română</a><a href="?set_lang=en" ><span class="fi fi-gb" style="width:20px; height:15px; border-radius:2px;"></span> English</a><a href="?set_lang=it" ><span class="fi fi-it" style="width:20px; height:15px; border-radius:2px;"></span> Italiano</a><a href="?set_lang=fr" ><span class="fi fi-fr" style="width:20px; height:15px; border-radius:2px;"></span> Français</a><a href="?set_lang=es" ><span class="fi fi-es" style="width:20px; height:15px; border-radius:2px;"></span> Español</a><a href="?set_lang=pl" ><span class="fi fi-pl" style="width:20px; height:15px; border-radius:2px;"></span> Polski</a><a href="?set_lang=us" ><span class="fi fi-us" style="width:20px; height:15px; border-radius:2px;"></span> USA English</a><a href="?set_lang=bg" ><span class="fi fi-bg" style="width:20px; height:15px; border-radius:2px;"></span> Български</a></div></div>                    <div class="dropdown-container" style="position:relative;"><button class="currency-btn" onclick="toggleCurrencyDropdown()"><span>lei</span><span style="margin-left: 5px;">RON</span><i class="fas fa-chevron-down" style="font-size: 10px; margin-left: 5px;"></i></button><div id="currencyDropdown" class="dropdown-menu-custom"><a href="?set_currency=RON" style="background:#f85a00;color:white;">lei RON - Lei românesc</a><a href="?set_currency=EUR" >€ EUR - Euro</a><a href="?set_currency=USD" >$ USD - Dolar american</a><a href="?set_currency=GBP" >£ GBP - Liră sterlină</a><a href="?set_currency=PLN" >zł PLN - Zlot polonez</a></div></div>                </div>
            </div>
        </div>
    </div>
</div>

<!-- ============================================ -->
<!-- MAIN HEADER -->
<!-- ============================================ -->
<div class="main-header">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-md-3">
                <a href="https://sitenou.asculta-ma.ro" style="display: flex; align-items: center; gap: 10px; text-decoration: none;">
                    <img src="https://sitenou.asculta-ma.ro/assets/logo.png" alt="Tecro" class="logo-img" onerror="">
                </a>
            </div>
            
            <!-- SEARCH BAR -->
            <div class="col-md-6">
                <div class="search-wrapper">
                    <select id="searchType" class="search-select">
                        <option value="code">🔍 Caută după cod</option>
                                            </select>
                    <div class="search-input-wrapper">
                        <i class="fas fa-search"></i>
                        <input type="text" id="searchInput" class="search-input" placeholder="Introdu cod produs...">
                    </div>
                    <button id="searchButton" class="search-btn">
                        <i class="fas fa-search"></i> Caută                    </button>
                </div>
            </div>
            
            <!-- MODAL PENTRU CAUTARE DUPA DENUMIRE -->
            <div id="searchResultsModal" class="modal-overlay" style="display: none;">
                <div class="modal-window" style="max-width: 900px;">
                    <div class="modal-header">
                        <h3><i class="fas fa-search"></i> <span id="modalSearchTitle">Rezultate pentru</span></h3>
                        <button class="modal-close-btn" onclick="closeSearchModal()">✕</button>
                    </div>
                    <div class="modal-body" id="searchResultsBody">
                        <div class="text-center py-5">
                            <div class="spinner-border text-primary" role="status">
                                <span class="visually-hidden">Se caută piese...</span>
                            </div>
                            <p class="mt-3">Se caută piese...</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- HEADER ICONS -->
            <div class="col-md-3">
                <div class="header-icons">
                    <!-- CONTUL MEU -->
                    <div class="custom-dropdown-container">
                        <button class="custom-dropdown-btn" onclick="toggleCustomDropdown('accountDropdownCustom')">
                            <i class="fas fa-user-circle"></i>
                            <span>Contul meu</span>
                        </button>
                        <div id="accountDropdownCustom" class="custom-dropdown-menu">
                                                            <a href="javascript:void(0)" onclick="openLoginModal()"><i class="fas fa-sign-in-alt"></i> Autentificare</a>
                                <a href="client_register.php"><i class="fas fa-user-plus"></i> Înregistrare</a>
                                <div class="custom-dropdown-divider"></div>
                                <a href="client_forgot.php"><i class="fas fa-key"></i> Am uitat parola</a>
                                                    </div>
                    </div>
                    
                    <!-- GARAJUL MEU - DOAR PREMIUM -->
                                        
                    <!-- COȘUL MEU -->
                    <div class="custom-dropdown-container">
                        <button class="custom-dropdown-btn" onclick="toggleCustomDropdown('cartDropdownCustom')">
                            <i class="fas fa-shopping-cart"></i>
                            <span>Coșul meu</span>
                            <span class="cart-count" id="cartCount">0</span>
                        </button>
                        <div id="cartDropdownCustom" class="custom-dropdown-menu" style="min-width: 350px;">
                            <div id="cartDropdownContentCustom" style="max-height: 400px; overflow-y: auto;">
                                <div style="padding: 30px; text-align: center; color: #94a3b8;">
                                    <i class="fas fa-spinner fa-spin"></i> Se încarcă...                                </div>
                            </div>
                            <div class="custom-dropdown-divider"></div>
                            <a href="/cos" style="display: flex; justify-content: center; background: var(--primary); color: white !important; font-weight: 600; gap: 8px; padding: 12px;">
                                <i class="fas fa-shopping-cart"></i> Vezi coșul                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- ============================================ -->
<!-- BOTTOM MENU - MEGA MENU COMPLET -->
<!-- ============================================ -->
<div class="bottom-menu">
    <div class="container">
        <!-- Desktop Menu -->
        <div class="desktop-menu">
            <ul class="nav justify-content-center">
                <li class="nav-item">
                    <a class="nav-link" href="https://sitenou.asculta-ma.ro">
                        <i class="fas fa-home me-1"></i> Acasă                    </a>
                </li>
                
                <!-- AUTOTURISME -->
                                <li class="nav-item">
                    <a class="nav-link" href="/car_brands_frontend.php">
                        <i class="fas fa-car me-1"></i> Autoturisme                    </a>
                </li>
                                
                <!-- ANVELOPE -->
                <li class="nav-item">
                    <a class="nav-link" href="/anvelope/">
                        <i class="fas fa-circle-notch me-1"></i> Anvelope                    </a>
                </li>
                
                <!-- JANTE -->
                <li class="nav-item">
                    <a class="nav-link" href="/jante/">
                        <i class="fas fa-cog me-1"></i> Jante                    </a>
                </li>
                
                <!-- UNIVERSALE -->
                <li class="nav-item">
                    <a class="nav-link" href="/universale/">
                        <i class="fas fa-box-open me-1"></i> Universale                    </a>
                </li>
                
                <!-- MOTOCICLETE -->
                <li class="nav-item">
                    <a class="nav-link" href="/moto/">
                        <i class="fas fa-motorcycle me-1"></i> Motociclete                    </a>
                </li>
            </ul>
        </div>
        
        <!-- Mobile Menu Toggle -->
        <div class="mobile-menu-toggle" onclick="toggleMobileMenu()">
            <div class="bar"></div>
            <div class="bar"></div>
            <div class="bar"></div>
        </div>
        
        <!-- Mobile Menu -->
        <div class="mobile-menu" id="mobileMenu">
            <ul>
                <li><a href="https://sitenou.asculta-ma.ro"><i class="fas fa-home"></i> Acasă</a></li>
                <li><a href="/car_brands_frontend.php"><i class="fas fa-car"></i> Autoturisme</a></li>
                <li><a href="/anvelope/"><i class="fas fa-circle-notch"></i> Anvelope</a></li>
                <li><a href="/jante/"><i class="fas fa-cog"></i> Jante</a></li>
                <li><a href="/universale/"><i class="fas fa-box-open"></i> Universale</a></li>
                <li><a href="/moto/"><i class="fas fa-motorcycle"></i> Motociclete</a></li>
            </ul>
        </div>
    </div>
</div>

<!-- ============================================ -->
<!-- MODAL POP-UP PENTRU LOGIN -->
<!-- ============================================ -->
<div id="loginModal" class="modal-overlay" style="display: none;">
    <div class="modal-window" style="max-width: 450px;">
        <div class="modal-header">
            <h3><i class="fas fa-sign-in-alt me-2"></i> Autentificare</h3>
            <button class="modal-close-btn" onclick="closeLoginModal()">✕</button>
        </div>
        <div class="modal-body">
            <div id="loginError" class="alert alert-danger" style="display: none;"></div>
            
            <form id="loginForm" onsubmit="submitLogin(event)">
                <div class="mb-3">
                    <label class="form-label">Email</label>
                    <input type="email" name="email" id="loginEmail" class="form-control" required>
                </div>
                <div class="mb-3">
                    <label class="form-label">Parolă</label>
                    <input type="password" name="password" id="loginPassword" class="form-control" required>
                </div>
                <div class="mb-3 form-check">
                    <input type="checkbox" name="remember" class="form-check-input" id="loginRemember">
                    <label class="form-check-label" for="loginRemember">Ține-mă minte</label>
                </div>
                <button type="submit" class="btn btn-primary w-100" id="loginBtn" style="background: #f85a00; border: none; padding: 12px; border-radius: 12px; font-weight: 600;">
                    <i class="fas fa-sign-in-alt me-2"></i>Autentificare
                </button>
            </form>
            
            <hr class="my-4">
            
            <div class="text-center">
                <p>Nu ai cont? <a href="client_register.php" style="color: #f85a00;">Înregistrează-te</a></p>
                <a href="client_forgot.php" style="color: #64748b;">Ți-ai uitat parola?</a>
            </div>
        </div>
    </div>
</div>

<style>
#loginModal .form-control {
    border-radius: 12px;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
}
#loginModal .form-control:focus {
    border-color: #f85a00;
    box-shadow: 0 0 0 3px rgba(248,90,0,0.1);
    outline: none;
}
</style>

<script>
// ============================================
// DROPDOWN-URI PERSONALIZATE
// ============================================
function toggleCustomDropdown(dropdownId) {
    if (event) event.stopPropagation();
    const dropdown = document.getElementById(dropdownId);
    if (!dropdown) return;
    
    const isVisible = dropdown.classList.contains('show');
    document.querySelectorAll('.custom-dropdown-menu').forEach(menu => menu.classList.remove('show'));
    
    if (!isVisible) {
        dropdown.classList.add('show');
        if (dropdownId === 'cartDropdownCustom') loadCartDropdownCustom();
    }
}

// ============================================
// LOGIN MODAL
// ============================================
function openLoginModal() {
    document.getElementById('loginModal').style.display = 'flex';
    document.body.style.overflow = 'hidden';
}

function closeLoginModal() {
    document.getElementById('loginModal').style.display = 'none';
    document.body.style.overflow = '';
    document.getElementById('loginError').style.display = 'none';
}

function submitLogin(e) {
    e.preventDefault();
    
    const email = document.getElementById('loginEmail').value;
    const password = document.getElementById('loginPassword').value;
    const remember = document.getElementById('loginRemember').checked;
    const errorDiv = document.getElementById('loginError');
    const btn = document.getElementById('loginBtn');
    
    btn.innerHTML = '<i class="fas fa-spinner fa-spin me-2"></i>Se procesează...';
    btn.disabled = true;
    
    fetch('/ajax/client_login.php', {
        method: 'POST',
        headers: {'Content-Type': 'application/json'},
        body: JSON.stringify({email, password, remember})
    })
    .then(r => r.json())
    .then(d => {
        if (d.success) {
            closeLoginModal();
            window.location.reload();
        } else {
            errorDiv.textContent = d.message || 'Email sau parolă incorectă!';
            errorDiv.style.display = 'block';
        }
    })
    .catch(() => {
        errorDiv.textContent = 'Eroare la conectare!';
        errorDiv.style.display = 'block';
    })
    .finally(() => {
        btn.innerHTML = '<i class="fas fa-sign-in-alt me-2"></i>Autentificare';
        btn.disabled = false;
    });
}

// Închide modal la click pe overlay
document.getElementById('loginModal').addEventListener('click', function(e) {
    if (e.target === this) {
        closeLoginModal();
    }
});

// Închide cu ESC
document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape' && document.getElementById('loginModal').style.display === 'flex') {
        closeLoginModal();
    }
});

// ============================================
// LIMBĂ ȘI VALUTĂ
// ============================================
function toggleLangDropdown() {
    const dropdown = document.getElementById('langDropdown');
    if (!dropdown) return;
    const isVisible = dropdown.classList.contains('show');
    document.querySelectorAll('.dropdown-menu-custom').forEach(menu => menu.classList.remove('show'));
    if (!isVisible) dropdown.classList.add('show');
}

function toggleCurrencyDropdown() {
    const dropdown = document.getElementById('currencyDropdown');
    if (!dropdown) return;
    const isVisible = dropdown.classList.contains('show');
    document.querySelectorAll('.dropdown-menu-custom').forEach(menu => menu.classList.remove('show'));
    if (!isVisible) dropdown.classList.add('show');
}

// ============================================
// ÎNCHIDE DROPDOWN LA CLICK OUTSIDE
// ============================================
document.addEventListener('click', function(e) {
    if (!e.target.closest('.dropdown-container') && !e.target.closest('.custom-dropdown-container')) {
        document.querySelectorAll('.dropdown-menu-custom, .custom-dropdown-menu').forEach(menu => menu.classList.remove('show'));
    }
});

// ============================================
// COȘ - CU TRADUCERI DIN TEMPLATE
// ============================================
// Traduceri pentru coș din PHP
const cartTexts = {
    loading: 'Se încarcă...',
    empty: 'Coșul tău este gol',
    error: 'Eroare la încărcare',
    quantity: 'Cant',
    total: 'Total',
    remove: 'Șterge',
    error_removing: 'Eroare la ștergere'
};

function updateCartCount() {
    fetch('/ajax/get-cart-count.php')
        .then(r => r.json())
        .then(d => { 
            const c = document.getElementById('cartCount'); 
            if (c) c.textContent = d.count || 0; 
        })
        .catch(e => console.error(e));
}

function loadCartDropdownCustom() {
    const container = document.getElementById('cartDropdownContentCustom');
    if (!container) return;
    
    container.innerHTML = '<div style="padding:30px;text-align:center;"><i class="fas fa-spinner fa-spin"></i> ' + cartTexts.loading + '</div>';
    
    fetch('/ajax/get-cart-items.php')
        .then(r => r.json())
        .then(d => {
            if (d.items && d.items.length) {
                let h = '';
                d.items.forEach(item => {
                    let productUrl = item.url || '#';
                    
                    h += `<div style="display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid #eef2ff;">
                        <a href="${productUrl}" style="flex-shrink:0;">
                            <img src="${item.image}" style="width:50px;height:50px;object-fit:cover;border-radius:8px;" onerror="this.src='/assets/no-image.png'">
                        </a>
                        <div style="flex:1;">
                            <a href="${productUrl}" style="text-decoration:none;color:inherit;">
                                <div style="font-weight:600;font-size:13px;">${escapeHtml(item.name)}</div>
                            </a>
                            <div style="font-size:12px;color:var(--primary);">${item.price}</div>
                            <div style="font-size:11px;color:#64748b;">${cartTexts.quantity}: ${item.quantity}</div>
                        </div>
                        <button onclick="removeFromCart(${item.id})" style="background:none;border:none;color:#94a3b8;cursor:pointer;padding:8px;" title="${cartTexts.remove}">
                            <i class="fas fa-trash-alt"></i>
                        </button>
                    </div>`;
                });
                h += `<div style="padding:12px 16px;background:#f8fafc;font-weight:700;display:flex;justify-content:space-between;">
                    <span>${cartTexts.total}:</span>
                    <span>${d.total} ${d.currency}</span>
                </div>`;
                container.innerHTML = h;
            } else {
                container.innerHTML = `<div style="padding:30px;text-align:center;">
                    <i class="fas fa-shopping-cart" style="font-size:48px;color:#cbd5e1;"></i>
                    <p>${cartTexts.empty}</p>
                </div>`;
            }
        })
        .catch(e => { 
            container.innerHTML = `<div style="padding:30px;text-align:center;">
                <i class="fas fa-exclamation-circle"></i>
                <p>${cartTexts.error}</p>
            </div>`; 
        });
}

function removeFromCart(id) {
    fetch('/ajax/remove-from-cart.php', { 
        method: 'POST', 
        headers: {'Content-Type': 'application/json'}, 
        body: JSON.stringify({id: id})
    })
    .then(r => r.json())
    .then(d => { 
        if (d.success) { 
            loadCartDropdownCustom(); 
            updateCartCount(); 
        } else {
            alert(d.message || cartTexts.error_removing);
        }
    })
    .catch(e => {
        console.error('Error:', e);
        alert(cartTexts.error_removing);
    });
}

function escapeHtml(t) { 
    if (!t) return ''; 
    const d = document.createElement('div'); 
    d.textContent = t; 
    return d.innerHTML; 
}

// ============================================
// SEARCH - CU BACK BUTTON ȘI TRADUCERI
// ============================================
const wizardTexts = {"searching":"Se caut\u0103 piese...","no_parts_found":"Nu s-au g\u0103sit piese pentru","choose_part":"Alege tipul de pies\u0103","back":"\u00cenapoi","back_to_parts":"\u00cenapoi la piese","back_to_brands":"\u00cenapoi la m\u0103rci","back_to_models":"\u00cenapoi la modele","step_part":"Piesa","step_brand":"Marca","step_model":"Model","step_engine":"Motorizare","selected_part":"Pies\u0103 selectat\u0103","choose_brand":"Alege marca","search_brand":"Caut\u0103 marca... (ex: BMW, Audi, Volkswagen)","loading_brands":"Se \u00eencarc\u0103 m\u0103rcile...","no_brands":"Nu exist\u0103 m\u0103rci pentru aceast\u0103 pies\u0103","choose_model":"Alege modelul","search_model":"Caut\u0103 modelul...","loading_models":"Se \u00eencarc\u0103 modelele...","models_available":"Se afi\u0219eaz\u0103 {count} modele cu piese disponibile (din {total} total)","no_models":"Nu exist\u0103 modele cu piese disponibile pentru aceast\u0103 marc\u0103.","engines":"motoriz\u0103ri","models":"modele","choose_engine":"Alege motorizarea","loading_engines":"Se \u00eencarc\u0103 motoriz\u0103rile pentru","no_engines":"Nu exist\u0103 motoriz\u0103ri pentru acest model.","petrol":"Benzin\u0103","diesel":"Motorin\u0103","other":"Altele","error_loading":"Eroare la \u00eenc\u0103rcare","search_results_for":"Rezultate pentru","piece":"Pies\u0103","brand":"Marc\u0103","model":"Model","parts":"piese","part_types":"tipuri de piese","cart_empty":"Co\u0219ul t\u0103u este gol","loading_cart":"Se \u00eencarc\u0103...","error_loading_cart":"Eroare la \u00eenc\u0103rcare","quantity_short":"Cant","total":"Total","view_cart":"Vezi co\u0219ul","remove":"\u0218terge"};

document.getElementById('searchType')?.addEventListener('change', function() {
    const type = this.value;
    const input = document.getElementById('searchInput');
    if (type === 'code') input.placeholder = 'Introdu cod produs...';
    else if (type === 'oe') input.placeholder = 'Introdu cod OE...';
    else if (type === 'name') input.placeholder = 'Scrie filtru ulei sau disc frana';
});

document.getElementById('searchButton')?.addEventListener('click', function() {
    const type = document.getElementById('searchType').value;
    const query = document.getElementById('searchInput').value.trim();
    if (!query) { alert('Introdu un termen de căutare'); return; }
    
    if (type === 'name') {
        searchByName(query);
    } else if (type === 'code') {
        window.location.href = '/search_aftermarket.php?code=' + encodeURIComponent(query) + '&redirect=1';
    } else if (type === 'oe') {
        window.location.href = '/search_oe.php?code=' + encodeURIComponent(query) + '&redirect=1';
    }
});

document.getElementById('searchInput')?.addEventListener('keypress', function(e) {
    if (e.key === 'Enter') document.getElementById('searchButton').click();
});

// Variabile globale pentru wizard
let selectedPart = null;
let selectedBrand = null;
let selectedModel = null;
let currentStep = 1;
let wizardHistory = [];

function searchByName(query) {
    selectedPart = null;
    selectedBrand = null;
    selectedModel = null;
    currentStep = 1;
    wizardHistory = [];
    
    const modal = document.getElementById('searchResultsModal');
    const body = document.getElementById('searchResultsBody');
    const title = document.getElementById('modalSearchTitle');
    
    title.innerHTML = '<i class="fas fa-search"></i> ' + wizardTexts.search_results_for + ' "' + escapeHtml(query) + '"';
    modal.classList.add('active');
    body.innerHTML = '<div class="text-center py-5"><div class="spinner-border" style="color:#f85a00;"></div><p>' + wizardTexts.searching + '</p></div>';
    
    fetch('/search_global_parts.php?action=search&q=' + encodeURIComponent(query))
        .then(r => r.json())
        .then(d => {
            if (d.success && d.parts && d.parts.length) {
                showPartSelection(d.parts);
                wizardHistory.push({ step: 1, type: 'parts', parts: d.parts });
            } else {
                body.innerHTML = '<div class="text-center py-5"><i class="fas fa-search" style="font-size:48px;color:#cbd5e1;"></i><p>' + wizardTexts.no_parts_found + ' "' + escapeHtml(query) + '"</p></div>';
            }
        })
        .catch(e => { 
            body.innerHTML = '<div class="text-center py-5"><i class="fas fa-exclamation-triangle" style="font-size:48px;color:#ef4444;"></i><p>' + wizardTexts.error_loading + '</p></div>'; 
        });
}

function goBack() {
    if (wizardHistory.length <= 1) {
        closeSearchModal();
        return;
    }
    
    wizardHistory.pop();
    const previous = wizardHistory[wizardHistory.length - 1];
    
    switch (previous.step) {
        case 1:
            currentStep = 1;
            if (previous.parts) {
                showPartSelection(previous.parts);
            }
            break;
        case 2:
            currentStep = 2;
            selectPart(selectedPart.pt_id, selectedPart.name);
            break;
        case 3:
            currentStep = 3;
            selectBrand(selectedBrand.id, selectedBrand.name);
            break;
        default:
            closeSearchModal();
    }
}

function goBackToModels() {
    currentStep = 3;
    selectBrand(selectedBrand.id, selectedBrand.name);
}

function showPartSelection(parts) {
    const body = document.getElementById('searchResultsBody');
    const title = document.getElementById('modalSearchTitle');
    
    title.innerHTML = '<i class="fas fa-cube"></i> ' + wizardTexts.choose_part;
    
    let html = '';
    
    if (wizardHistory.length > 1) {
        html += `<button class="wizard-back-btn" onclick="goBack()"><i class="fas fa-arrow-left"></i> ${wizardTexts.back}</button>`;
    }
    
    html += '<div class="wizard-steps">';
    html += '<div class="wizard-step active"><span>1</span> ' + wizardTexts.step_part + '</div>';
    html += '<div class="wizard-step"><span>2</span> ' + wizardTexts.step_brand + '</div>';
    html += '<div class="wizard-step"><span>3</span> ' + wizardTexts.step_model + '</div>';
    html += '<div class="wizard-step"><span>4</span> ' + wizardTexts.step_engine + '</div>';
    html += '</div>';
    
    html += '<div class="part-selection-grid">';
    parts.forEach(part => {
        const ptId = part.pt_ids[0];
        const partName = part.name;
        
        html += `<div class="part-card" onclick="selectPart(${ptId}, '${escapeHtml(partName).replace(/'/g, "\\'")}')">`;
        html += `<i class="fas fa-cube"></i>`;
        html += `<span>${escapeHtml(partName)}</span>`;
        html += `</div>`;
    });
    html += '</div>';
    
    body.innerHTML = html;
}

function selectPart(ptId, partName) {
    selectedPart = { pt_id: ptId, name: partName, pt_ids: [ptId] };
    currentStep = 2;
    
    const body = document.getElementById('searchResultsBody');
    const title = document.getElementById('modalSearchTitle');
    
    title.innerHTML = '<i class="fas fa-car"></i> ' + wizardTexts.choose_brand;
    
    let html = `<button class="wizard-back-btn" onclick="goBack()"><i class="fas fa-arrow-left"></i> ${wizardTexts.back_to_parts}</button>`;
    
    html += '<div class="wizard-steps">';
    html += '<div class="wizard-step completed"><span>✓</span> ' + wizardTexts.step_part + '</div>';
    html += '<div class="wizard-step active"><span>2</span> ' + wizardTexts.step_brand + '</div>';
    html += '<div class="wizard-step"><span>3</span> ' + wizardTexts.step_model + '</div>';
    html += '<div class="wizard-step"><span>4</span> ' + wizardTexts.step_engine + '</div>';
    html += '</div>';
    
    html += `<div class="selected-info">${wizardTexts.selected_part}: <strong>${escapeHtml(partName)}</strong></div>`;
    
    html += `<div class="brand-search-wrapper">`;
    html += `<i class="fas fa-search"></i>`;
    html += `<input type="text" id="brandSearchInput" class="brand-search-input" placeholder="${wizardTexts.search_brand}" autocomplete="off">`;
    html += `<button class="brand-search-clear" id="clearBrandSearch" style="display: none;" onclick="clearBrandSearch()">`;
    html += `<i class="fas fa-times"></i>`;
    html += `</button>`;
    html += `</div>`;
    
    html += '<div class="text-center py-3" id="brandsLoading"><div class="spinner-border" style="color:#f85a00;"></div><p>' + wizardTexts.loading_brands + '</p></div>';
    html += '<div id="brandsContainer" style="display: none;"></div>';
    
    body.innerHTML = html;
    
    wizardHistory.push({ step: 2, type: 'brands', ptId: ptId });
    
    fetch('/search_global_parts.php?action=get_brands&pt_id=' + ptId)
        .then(r => r.json())
        .then(d => {
            const loadingDiv = document.getElementById('brandsLoading');
            const container = document.getElementById('brandsContainer');
            
            if (d.success && d.brands && d.brands.length) {
                let brandsHtml = '<div class="brand-selection-grid" id="brandGrid">';
                d.brands.forEach(brand => {
                    brandsHtml += `<div class="brand-card" data-brand-name="${escapeHtml(brand.brand_name).toLowerCase()}" onclick="selectBrand(${brand.brand_id}, '${escapeHtml(brand.brand_name).replace(/'/g, "\\'")}')">`;
                    brandsHtml += `<img src="/media/brands/${brand.brand_code}.png" onerror="this.style.display='none'">`;
                    brandsHtml += `<span>${escapeHtml(brand.brand_name)}</span>`;
                    brandsHtml += `</div>`;
                });
                brandsHtml += '</div>';
                
                loadingDiv.style.display = 'none';
                container.style.display = 'block';
                container.innerHTML = brandsHtml;
                
                const searchInput = document.getElementById('brandSearchInput');
                const clearBtn = document.getElementById('clearBrandSearch');
                
                if (searchInput) {
                    searchInput.addEventListener('input', function() {
                        const searchTerm = this.value.toLowerCase().trim();
                        const brandCards = document.querySelectorAll('.brand-card');
                        
                        brandCards.forEach(card => {
                            const brandName = card.getAttribute('data-brand-name') || '';
                            card.style.display = (searchTerm === '' || brandName.includes(searchTerm)) ? 'flex' : 'none';
                        });
                        
                        if (clearBtn) clearBtn.style.display = searchTerm ? 'flex' : 'none';
                    });
                    setTimeout(() => searchInput.focus(), 100);
                }
            } else {
                loadingDiv.innerHTML = '<p class="text-center py-3 text-danger">' + wizardTexts.no_brands + '</p>';
            }
        })
        .catch(e => {
            document.getElementById('brandsLoading').innerHTML = '<p class="text-center py-3 text-danger">' + wizardTexts.error_loading + '</p>';
        });
}

function clearBrandSearch() {
    const input = document.getElementById('brandSearchInput');
    if (input) {
        input.value = '';
        input.focus();
        input.dispatchEvent(new Event('input'));
    }
}

function selectBrand(brandId, brandName) {
    selectedBrand = { id: brandId, name: brandName };
    currentStep = 3;
    
    const body = document.getElementById('searchResultsBody');
    const title = document.getElementById('modalSearchTitle');
    
    title.innerHTML = '<i class="fas fa-list"></i> ' + wizardTexts.choose_model;
    
    let html = `<button class="wizard-back-btn" onclick="goBack()"><i class="fas fa-arrow-left"></i> ${wizardTexts.back_to_brands}</button>`;
    
    html += '<div class="wizard-steps">';
    html += '<div class="wizard-step completed"><span>✓</span> ' + wizardTexts.step_part + '</div>';
    html += '<div class="wizard-step completed"><span>✓</span> ' + wizardTexts.step_brand + '</div>';
    html += '<div class="wizard-step active"><span>3</span> ' + wizardTexts.step_model + '</div>';
    html += '<div class="wizard-step"><span>4</span> ' + wizardTexts.step_engine + '</div>';
    html += '</div>';
    
    html += `<div class="selected-info">${wizardTexts.piece}: <strong>${escapeHtml(selectedPart.name)}</strong> | ${wizardTexts.brand}: <strong>${escapeHtml(brandName)}</strong></div>`;
    
    html += `<div class="brand-search-wrapper">`;
    html += `<i class="fas fa-search"></i>`;
    html += `<input type="text" id="modelSearchInput" class="brand-search-input" placeholder="${wizardTexts.search_model}" autocomplete="off">`;
    html += `<button class="brand-search-clear" id="clearModelSearch" style="display: none;" onclick="clearModelSearch()">`;
    html += `<i class="fas fa-times"></i>`;
    html += `</button>`;
    html += `</div>`;
    
    html += '<div class="text-center py-3" id="modelsLoading"><div class="spinner-border" style="color:#f85a00;"></div><p>' + wizardTexts.loading_models + '</p></div>';
    html += '<div id="modelsContainer" style="display: none;"></div>';
    
    body.innerHTML = html;
    
    wizardHistory.push({ step: 3, type: 'models', brandId: brandId });
    
    fetch('/search_global_parts.php?action=get_models_with_engines&brand_id=' + brandId + '&pt_id=' + selectedPart.pt_id)
        .then(r => r.json())
        .then(d => {
            const loadingDiv = document.getElementById('modelsLoading');
            const container = document.getElementById('modelsContainer');
            
            if (d.success && d.models && d.models.length) {
                const grouped = groupModelsByFirstWord(d.models);
                let modelsHtml = '<div class="model-groups-container" id="modelGroupsContainer">';
                
                if (d.total_models > d.models.length) {
                    modelsHtml += `<p class="filter-info"><i class="fas fa-filter"></i> ${wizardTexts.models_available.replace('{count}', d.models.length).replace('{total}', d.total_models)}</p>`;
                }
                
                grouped.forEach((group, idx) => {
                    const groupId = 'modelGroup_' + idx + '_' + Date.now();
                    
                    if (group.models.length === 1) {
                        const model = group.models[0];
                        modelsHtml += `<div class="model-item-single" data-model-name="${escapeHtml(model.model_name).toLowerCase()}" onclick="selectModelAndGo(${model.model_id}, '${escapeHtml(model.model_name).replace(/'/g, "\\'")}')">`;
                        modelsHtml += `<i class="fas fa-car"></i>`;
                        modelsHtml += `<span>${escapeHtml(model.model_name)}</span>`;
                        modelsHtml += `<span class="engine-count-badge">${model.engine_count || 0} ${wizardTexts.engines}</span>`;
                        modelsHtml += `<i class="fas fa-arrow-right"></i>`;
                        modelsHtml += `</div>`;
                    } else {
                        modelsHtml += `<div class="model-group" data-group-name="${escapeHtml(group.name).toLowerCase()}">`;
                        modelsHtml += `<div class="model-group-header" onclick="toggleModelGroup('${groupId}')">`;
                        modelsHtml += `<i class="fas fa-chevron-right group-chevron" id="${groupId}_chevron"></i>`;
                        modelsHtml += `<span class="group-name">${escapeHtml(group.name)}</span>`;
                        modelsHtml += `<span class="group-count">${group.models.length} ${wizardTexts.models}</span>`;
                        modelsHtml += `</div>`;
                        modelsHtml += `<div class="model-group-items" id="${groupId}_items" style="display: none;">`;
                        
                        group.models.sort((a, b) => a.model_name.localeCompare(b.model_name));
                        
                        group.models.forEach(model => {
                            modelsHtml += `<div class="model-item" data-model-name="${escapeHtml(model.model_name).toLowerCase()}" onclick="selectModelAndGo(${model.model_id}, '${escapeHtml(model.model_name).replace(/'/g, "\\'")}')">`;
                            modelsHtml += `<i class="fas fa-car"></i>`;
                            modelsHtml += `<span>${escapeHtml(model.model_name)}</span>`;
                            modelsHtml += `<span class="engine-count-badge">${model.engine_count || 0}</span>`;
                            modelsHtml += `<i class="fas fa-arrow-right"></i>`;
                            modelsHtml += `</div>`;
                        });
                        
                        modelsHtml += `</div>`;
                        modelsHtml += `</div>`;
                    }
                });
                
                modelsHtml += '</div>';
                
                loadingDiv.style.display = 'none';
                container.style.display = 'block';
                container.innerHTML = modelsHtml;
                
                setupModelSearch();
            } else {
                loadingDiv.innerHTML = '<p class="text-center py-3 text-warning">' + wizardTexts.no_models + '</p>';
            }
        })
        .catch(e => {
            document.getElementById('modelsLoading').innerHTML = '<p class="text-center py-3 text-danger">' + wizardTexts.error_loading + '</p>';
        });
}

function setupModelSearch() {
    const searchInput = document.getElementById('modelSearchInput');
    const clearBtn = document.getElementById('clearModelSearch');
    
    if (searchInput) {
        searchInput.addEventListener('input', function() {
            const searchTerm = this.value.toLowerCase().trim();
            const groups = document.querySelectorAll('.model-group');
            const singleItems = document.querySelectorAll('.model-item-single');
            
            singleItems.forEach(item => {
                const modelName = item.getAttribute('data-model-name') || '';
                item.style.display = (searchTerm === '' || modelName.includes(searchTerm)) ? 'flex' : 'none';
            });
            
            groups.forEach(group => {
                const groupName = group.getAttribute('data-group-name') || '';
                const items = group.querySelectorAll('.model-item');
                let hasVisible = false;
                
                items.forEach(item => {
                    const modelName = item.getAttribute('data-model-name') || '';
                    if (searchTerm === '' || modelName.includes(searchTerm) || groupName.includes(searchTerm)) {
                        item.style.display = 'flex';
                        hasVisible = true;
                    } else {
                        item.style.display = 'none';
                    }
                });
                
                group.style.display = hasVisible ? 'block' : 'none';
                
                if (searchTerm !== '' && hasVisible) {
                    const itemsDiv = group.querySelector('.model-group-items');
                    const chevron = group.querySelector('.group-chevron');
                    if (itemsDiv) {
                        itemsDiv.style.display = 'block';
                        if (chevron) chevron.classList.add('rotated');
                    }
                }
            });
            
            if (clearBtn) clearBtn.style.display = searchTerm ? 'flex' : 'none';
        });
        setTimeout(() => searchInput.focus(), 100);
    }
}

function groupModelsByFirstWord(models) {
    const groups = {};
    models.forEach(model => {
        const name = model.model_name || model.name;
        const firstWord = name.trim().split(/\s+/)[0].replace(/[^a-zA-Z0-9ĂÎÂȘȚăîâșț\-]/g, '') || 'OTHER';
        if (!groups[firstWord]) groups[firstWord] = { name: firstWord, models: [] };
        groups[firstWord].models.push(model);
    });
    return Object.values(groups).sort((a, b) => a.name.localeCompare(b.name, 'ro', { sensitivity: 'base' }));
}

function toggleModelGroup(groupId) {
    const items = document.getElementById(groupId + '_items');
    const chevron = document.getElementById(groupId + '_chevron');
    if (items) {
        if (items.style.display === 'none') {
            items.style.display = 'block';
            if (chevron) chevron.classList.add('rotated');
        } else {
            items.style.display = 'none';
            if (chevron) chevron.classList.remove('rotated');
        }
    }
}

function selectModelAndGo(modelId, modelName) {
    selectedModel = { id: modelId, name: modelName };
    closeSearchModal();
    
    const modal = document.getElementById('searchResultsModal');
    const body = document.getElementById('searchResultsBody');
    const title = document.getElementById('modalSearchTitle');
    
    modal.classList.add('active');
    title.innerHTML = '<i class="fas fa-tachometer-alt"></i> ' + wizardTexts.choose_engine;
    body.innerHTML = '<div class="text-center py-5"><div class="spinner-border" style="color:#f85a00;"></div><p>' + wizardTexts.loading_engines + ' ' + escapeHtml(modelName) + '...</p></div>';
    
    fetch('/search_global_parts.php?action=get_engines&model_id=' + modelId + '&pt_id=' + selectedPart.pt_id)
        .then(r => r.json())
        .then(d => {
            if (d.success && d.engines && d.engines.length) {
                if (d.engines.length === 1) {
                    const engine = d.engines[0];
                    redirectToProducts(engine.pc_id);
                } else {
                    showEngineSelection(d.engines);
                }
            } else {
                alert(wizardTexts.no_engines);
                closeSearchModal();
            }
        })
        .catch(e => {
            alert(wizardTexts.error_loading);
            closeSearchModal();
        });
}

function showEngineSelection(engines) {
    currentStep = 4;
    const modal = document.getElementById('searchResultsModal');
    const body = document.getElementById('searchResultsBody');
    const title = document.getElementById('modalSearchTitle');
    
    modal.classList.add('active');
    title.innerHTML = '<i class="fas fa-tachometer-alt"></i> ' + wizardTexts.choose_engine;
    
    let html = `<button class="wizard-back-btn" onclick="goBackToModels()"><i class="fas fa-arrow-left"></i> ${wizardTexts.back_to_models}</button>`;
    
    html += '<div class="wizard-steps">';
    html += '<div class="wizard-step completed"><span>✓</span> ' + wizardTexts.step_part + '</div>';
    html += '<div class="wizard-step completed"><span>✓</span> ' + wizardTexts.step_brand + '</div>';
    html += '<div class="wizard-step completed"><span>✓</span> ' + wizardTexts.step_model + '</div>';
    html += '<div class="wizard-step active"><span>4</span> ' + wizardTexts.step_engine + '</div>';
    html += '</div>';
    
    html += `<div class="selected-info">${wizardTexts.piece}: <strong>${escapeHtml(selectedPart.name)}</strong> | ${wizardTexts.brand}: <strong>${escapeHtml(selectedBrand.name)}</strong> | ${wizardTexts.model}: <strong>${escapeHtml(selectedModel.name)}</strong></div>`;
    
    const petrol = [], diesel = [], other = [];
    engines.forEach(eng => {
        const fuel = (eng.fuel || '').toLowerCase();
        if (fuel.includes('benz') || fuel === 'petrol') petrol.push(eng);
        else if (fuel.includes('diesel') || fuel.includes('motorina')) diesel.push(eng);
        else other.push(eng);
    });
    
    html += '<div class="engine-selection-list">';
    
    if (petrol.length) {
        html += '<div class="engine-category">⛽ ' + wizardTexts.petrol + '</div>';
        petrol.forEach(eng => {
            html += `<div class="engine-item" onclick="redirectToProducts(${eng.pc_id})">`;
            html += `<i class="fas fa-gas-pump"></i>`;
            html += `<span>${escapeHtml(eng.name)}</span>`;
            html += `<i class="fas fa-arrow-right"></i>`;
            html += `</div>`;
        });
    }
    
    if (diesel.length) {
        html += '<div class="engine-category">🛢️ ' + wizardTexts.diesel + '</div>';
        diesel.forEach(eng => {
            html += `<div class="engine-item" onclick="redirectToProducts(${eng.pc_id})">`;
            html += `<i class="fas fa-oil-can"></i>`;
            html += `<span>${escapeHtml(eng.name)}</span>`;
            html += `<i class="fas fa-arrow-right"></i>`;
            html += `</div>`;
        });
    }
    
    if (other.length) {
        html += '<div class="engine-category">🔧 ' + wizardTexts.other + '</div>';
        other.forEach(eng => {
            html += `<div class="engine-item" onclick="redirectToProducts(${eng.pc_id})">`;
            html += `<i class="fas fa-engine"></i>`;
            html += `<span>${escapeHtml(eng.name)}</span>`;
            html += `<i class="fas fa-arrow-right"></i>`;
            html += `</div>`;
        });
    }
    
    html += '</div>';
    body.innerHTML = html;
}

function redirectToProducts(pcId) {
    const url = '/car_products_frontend.php?pc_id=' + pcId + 
                '&pt_ids=' + selectedPart.pt_id + 
                '&nume=' + encodeURIComponent(selectedPart.name) +
                '&mod_id=' + selectedModel.id +
                '&brand=' + encodeURIComponent(selectedBrand.name) +
                '&model=' + encodeURIComponent(selectedModel.name);
    window.location.href = url;
}

function clearModelSearch() {
    const input = document.getElementById('modelSearchInput');
    if (input) {
        input.value = '';
        input.focus();
        input.dispatchEvent(new Event('input'));
    }
}

function closeSearchModal() { 
    document.getElementById('searchResultsModal').classList.remove('active'); 
    wizardHistory = [];
}

document.getElementById('searchResultsModal')?.addEventListener('click', function(e) { 
    if (e.target === this) closeSearchModal(); 
});

document.addEventListener('keydown', function(e) { 
    if (e.key === 'Escape') closeSearchModal(); 
});

// ============================================
// MOBILE MENU
// ============================================
function toggleMobileMenu() {
    const m = document.getElementById('mobileMenu');
    const t = document.querySelector('.mobile-menu-toggle');
    if (m && t) { m.classList.toggle('show'); t.classList.toggle('active'); }
}

function toggleSubmenu(el) {
    if (event) event.preventDefault();
    const p = el.closest('li');
    if (p) {
        p.classList.toggle('open');
        const s = p.querySelector('.submenu');
        if (s) s.style.display = s.style.display === 'block' ? 'none' : 'block';
    }
}

// ============================================
// INIT
// ============================================
document.addEventListener('DOMContentLoaded', function() {
    updateCartCount();
});
</script>

<main class="container my-4">
    <div class="row">
                
        <div class="col-12">
<main class="container my-4">
    <div class="row">
                
        <div class="col-12">
            
            <!-- VIN Search - GRI ÎNCHIS -->
            <div class="full-width-section" style="background: #072848; padding: 1.5rem 0;">
                <div class="container">
                    <div class="row">
                        <div class="col-md-6"></div>
                        <div class="col-md-6"></div>
                    </div>
                </div>
            </div>
            
            <!-- Categorii - ALB -->
            <div class="full-width-section" style="background: #ffffff; padding: 1.5rem 0;">
                <div class="container">
                                    </div>
            </div>
            
            <!-- Tabs - GRI ÎNCHIS -->
            <div class="full-width-section" style="background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1.5rem 0;">
                <div class="container">
                                    </div>
            </div>
            
            <!-- Universale - ALB -->
            <div class="full-width-section" style="background: #ffffff; padding: 1.5rem 0;">
                <div class="container">
                                    </div>
            </div>
            
            <!-- Configurator - GRI ÎNCHIS -->
            <div class="full-width-section" style="background: #072848; padding: 1.5rem 0;">
                <div class="container">
                                    </div>
            </div>
            
            <!-- Motociclete - ALB -->
            <div class="full-width-section" style="background: #ffffff; padding: 1.5rem 0;">
                <div class="container">
                                    </div>
            </div>
            
            <!-- Oferte - GRI ÎNCHIS -->
            <div class="full-width-section" style="background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1.5rem 0;">
                <div class="container">
                                        <div class="alert alert-info text-center">
                        <i class="fas fa-tag me-2"></i> Adaugă o ofertă specială din panoul de administrare.
                    </div>
                                    </div>
            </div>
            
        </div>
        
            </div>
</main>

            </div>
            
                    </div>
    </main>
    
    <footer class="footer-premium">
        <div class="container">
            <div class="row">
                <div class="col-lg-4 col-md-12 mb-4 mb-lg-0">
                    <h4 class="footer-title">TECRO AUTO</h4>
                    <p class="footer-text">Cea mai mare platformă din România pentru piese auto, unelte și accesorii. Peste 500.000 de produse disponibile.</p>
                    <div class="social-icons">
                                                <a href="https://facebook.com" target="_blank" class="social-icon">
                            <i class="fab fa-facebook-f"></i>
                        </a>
                                                <a href="https://instagram.com" target="_blank" class="social-icon">
                            <i class="fab fa-instagram"></i>
                        </a>
                                                <a href="https://tiktok.com" target="_blank" class="social-icon">
                            <i class="fab fa-tiktok"></i>
                        </a>
                                                <a href="https://youtube.com" target="_blank" class="social-icon">
                            <i class="fab fa-youtube"></i>
                        </a>
                                                <a href="https://linkedin.com" target="_blank" class="social-icon">
                            <i class="fab fa-linkedin-in"></i>
                        </a>
                                            </div>
                </div>
                
                <div class="col-lg-2 col-md-4 col-6 mb-4">
                    <h5 class="footer-title">Link-uri</h5>
                    <ul class="footer-links">
                        <li><a href="https://sitenou.asculta-ma.rodespre-noi"><i class="fas fa-chevron-right"></i> Despre noi</a></li>
                        <li><a href="https://sitenou.asculta-ma.rocontact"><i class="fas fa-chevron-right"></i> Contact</a></li>
                        <li><a href="https://sitenou.asculta-ma.rotermeni-si-conditii"><i class="fas fa-chevron-right"></i> Termeni și condiții</a></li>
                        <li><a href="https://sitenou.asculta-ma.ropolitica-de-confidentialitate"><i class="fas fa-chevron-right"></i> Politica de confidențialitate</a></li>
                        <li><a href="https://sitenou.asculta-ma.ro?page=magazin"><i class="fas fa-chevron-right"></i> produse</a></li>
                    </ul>
                </div>
                
                <div class="col-lg-2 col-md-4 col-6 mb-4">
                    <h5 class="footer-title">Suport clienți</h5>
                    <ul class="footer-links">
                        <li><a href="https://sitenou.asculta-ma.rointrebari-frecvente"><i class="fas fa-chevron-right"></i> Întrebări frecvente</a></li>
                        <li><a href="https://sitenou.asculta-ma.roretururi"><i class="fas fa-chevron-right"></i> Retururi</a></li>
                        <li><a href="https://sitenou.asculta-ma.rolivrare"><i class="fas fa-chevron-right"></i> Livrare</a></li>
                        <li><a href="https://sitenou.asculta-ma.roplata"><i class="fas fa-chevron-right"></i> Metodă de plată</a></li>
                        <li><a href="https://sitenou.asculta-ma.ro/admin/"><i class="fas fa-chevron-right"></i> Admin</a></li>
                    </ul>
                </div>
                
                <div class="col-lg-4 col-md-4 mb-4">
                    <h5 class="footer-title">Informații de contact</h5>
                    <div class="contact-info">
                        <div class="contact-item"><i class="fas fa-map-marker-alt"></i> <span>București, România</span></div>
                        <div class="contact-item"><i class="fas fa-phone-alt"></i> <span><a href="tel:0761647971">0761 647 971 </a></span></div>
                        <div class="contact-item"><i class="fas fa-envelope"></i> <span><a href="mailto:contact@autoalmani.ro">contact@autoalmani.ro</a></span></div>
                        <div class="contact-item"><i class="fas fa-clock"></i> <div><div>Luni - Vineri: 09:00 - 18:00</div><div>Sâmbătă: 10:00 - 14:00</div></div></div>
                    </div>
                    
                    <h5 class="footer-title" style="margin-top: 25px;">Newsletter</h5>
                    <p class="footer-text">Abonează-te pentru oferte exclusive</p>
                    <form id="newsletterForm" class="newsletter-form" onsubmit="submitNewsletter(event)">
                        <input type="email" id="newsletterEmail" class="newsletter-input" placeholder="Adresa ta de email" required>
                        <button type="submit" class="newsletter-btn"><i class="fas fa-paper-plane"></i> <span>Abonează-te</span></button>
                    </form>
                    <div id="newsletterMessage" class="newsletter-message"></div>
                </div>
            </div>
            
            <div class="footer-bottom">
                <div class="payment-icons">
                                        <i class="fab fa-cc-visa" title="Plata online"></i>
                                        <i class="fas fa-credit-card" title="Transfer bancar"></i>
                                        <i class="fas fa-truck" title="Ramburs"></i>
                                    </div>
                <p>© 2026 Tecro - Toate drepturile rezervate.</p>
            </div>
        </div>
    </footer>

    <button class="scroll-top-btn" id="scrollTopBtn"><i class="fas fa-arrow-up"></i></button>

    <style>
    .footer-premium {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        color: #e2e8f0;
        padding: 60px 0 20px;
        margin-top: 60px;
        position: relative;
    }
    .footer-premium::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #f97316, #fbbf24, #f97316);
    }
    .footer-title { font-size: 18px; font-weight: 700; color: white; margin-bottom: 20px; position: relative; display: inline-block; }
    .footer-title::after { content: ''; position: absolute; bottom: -8px; left: 0; width: 40px; height: 2px; background: #f97316; }
    .footer-text { color: #94a3b8; font-size: 13px; line-height: 1.6; margin-bottom: 20px; }
    .footer-links { list-style: none; padding: 0; }
    .footer-links li { margin-bottom: 10px; }
    .footer-links a { color: #94a3b8; text-decoration: none; font-size: 13px; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
    .footer-links a:hover { color: #f97316; transform: translateX(4px); }
    .social-icons { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
    .social-icon { width: 36px; height: 36px; background: rgba(255,255,255,0.08); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.25s; color: #94a3b8; text-decoration: none; }
    .social-icon:hover { background: #f97316; color: white; transform: translateY(-3px); }
    .contact-info { margin-top: 20px; }
    .contact-item { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; color: #94a3b8; }
    .contact-item i { width: 20px; color: #f97316; }
    .newsletter-form { display: flex; margin-top: 15px; background: rgba(255,255,255,0.05); border-radius: 50px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
    .newsletter-input { flex: 1; padding: 12px 18px; border: none; background: transparent; color: white; outline: none; }
    .newsletter-input::placeholder { color: #64748b; }
    .newsletter-btn { background: #f97316; border: none; padding: 12px 20px; color: white; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 8px; }
    .newsletter-btn:hover { background: #ea580c; }
    .newsletter-message { margin-top: 12px; font-size: 12px; padding: 8px 12px; border-radius: 10px; display: none; }
    .newsletter-message.success { background: rgba(16,185,129,0.15); color: #10b981; display: block; border-left: 3px solid #10b981; }
    .newsletter-message.error { background: rgba(239,68,68,0.15); color: #ef4444; display: block; border-left: 3px solid #ef4444; }
    .footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 40px; padding-top: 20px; text-align: center; }
    .payment-icons { display: flex; justify-content: center; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
    .payment-icons i { font-size: 28px; color: #64748b; transition: color 0.2s; }
    .payment-icons i:hover { color: #f97316; }
    .scroll-top-btn { position: fixed; bottom: 30px; right: 30px; width: 45px; height: 45px; background: #f97316; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s; border: none; color: white; }
    .scroll-top-btn.visible { opacity: 1; visibility: visible; }
    @media (max-width: 768px) {
        .footer-premium { text-align: center; }
        .footer-title::after { left: 50%; transform: translateX(-50%); }
        .social-icons { justify-content: center; }
        .contact-item { justify-content: center; }
    }
    </style>

    <script>
    const scrollBtn = document.getElementById('scrollTopBtn');
    if (scrollBtn) {
        window.addEventListener('scroll', () => { scrollBtn.classList.toggle('visible', window.scrollY > 300); });
        scrollBtn.addEventListener('click', () => window.scrollTo({ top: 0, behavior: 'smooth' }));
    }
  function submitNewsletter(event) {
    event.preventDefault();
    
    const emailInput = document.getElementById('newsletterEmail');
    const messageDiv = document.getElementById('newsletterMessage');
    const email = emailInput.value.trim();
    
    console.log("Email trimis:", email); // Debug
    
    if (!email) {
        messageDiv.className = 'newsletter-message error';
        messageDiv.innerHTML = '<i class="fas fa-exclamation-circle"></i> Te rugăm să introduci o adresă de email.';
        messageDiv.style.display = 'block';
        setTimeout(function() { messageDiv.style.display = 'none'; }, 3000);
        return;
    }
    
    const submitBtn = document.querySelector('#newsletterForm button');
    const originalText = submitBtn.innerHTML;
    submitBtn.disabled = true;
    submitBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i>';
    
    fetch('/ajax/newsletter-subscribe.php', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ email: email, lang: 'ro' })
    })
    .then(function(response) { 
        return response.json(); 
    })
    .then(function(result) { 
        console.log("Răspuns:", result);
        messageDiv.className = 'newsletter-message ' + (result.success ? 'success' : 'error');
        messageDiv.innerHTML = '<i class="fas fa-' + (result.success ? 'check-circle' : 'exclamation-circle') + '"></i> ' + result.message;
        messageDiv.style.display = 'block';
        if (result.success) emailInput.value = '';
        setTimeout(function() { messageDiv.style.display = 'none'; }, 4000);
    })
    .catch(function(error) {
        console.error("Eroare fetch:", error);
        messageDiv.className = 'newsletter-message error';
        messageDiv.innerHTML = '<i class="fas fa-exclamation-circle"></i> A apărut o eroare. Te rugăm să încerci din nou.';
        messageDiv.style.display = 'block';
        setTimeout(function() { messageDiv.style.display = 'none'; }, 4000);
    })
    .finally(function() {
        submitBtn.disabled = false;
        submitBtn.innerHTML = originalText;
    });
}
    </script>

    
<style>
.chatbot-widget {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}
.chatbot-button {
    width: 60px;
    height: 60px;
    background: #08ba4c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    color: white;
    font-size: 28px;
}
.chatbot-button:hover {
    transform: scale(1.05);
}
.chatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInUp 0.3s ease;
}
.chatbot-window.open {
    display: flex;
}
.chatbot-header {
    background: #08ba4c;
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chatbot-header i {
    font-size: 24px;
}
.chatbot-header h4 {
    margin: 0;
    font-size: 16px;
    flex: 1;
}
.chatbot-close {
    cursor: pointer;
    font-size: 20px;
}
.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
}
.chatbot-message {
    margin-bottom: 15px;
    display: flex;
}
.chatbot-message.bot {
    justify-content: flex-start;
}
.chatbot-message.user {
    justify-content: flex-end;
}
.chatbot-message .message-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 13px;
}
.chatbot-message.bot .message-bubble {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}
.chatbot-message.user .message-bubble {
    background: #08ba4c;
    color: white;
}
.chatbot-input-area {
    display: flex;
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    background: white;
}
.chatbot-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    outline: none;
    font-size: 13px;
}
.chatbot-send {
    background: #08ba4c;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        right: 0;
        height: 400px;
    }
}
</style>

<div class="chatbot-widget">
    <div class="chatbot-button" id="chatbotButton">
        <i class="fas fa-comment-dots"></i>
    </div>
    <div class="chatbot-window" id="chatbotWindow">
        <div class="chatbot-header">
            <i class="fas fa-robot"></i>
            <h4>🤖 Asistent Virtual</h4>
            <i class="fas fa-times chatbot-close" id="chatbotClose"></i>
        </div>
        <div class="chatbot-messages" id="chatbotMessages">
            <div class="chatbot-message bot">
                <div class="message-bubble">
                    Bun venit! Cum te putem ajuta astăzi?                </div>
            </div>
        </div>
        <div class="chatbot-input-area">
            <input type="text" class="chatbot-input" id="chatbotInput" placeholder="Scrie mesajul tău aici...">
            <button class="chatbot-send" id="chatbotSend">
                <i class="fas fa-paper-plane"></i>
            </button>
        </div>
    </div>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    const button = document.getElementById('chatbotButton');
    const windowEl = document.getElementById('chatbotWindow');
    const closeBtn = document.getElementById('chatbotClose');
    const sendBtn = document.getElementById('chatbotSend');
    const input = document.getElementById('chatbotInput');
    const messages = document.getElementById('chatbotMessages');
    
    if (button) {
        button.addEventListener('click', function() {
            windowEl.classList.toggle('open');
        });
    }
    if (closeBtn) {
        closeBtn.addEventListener('click', function() {
            windowEl.classList.remove('open');
        });
    }
    
    function addMessage(text, isUser) {
        const div = document.createElement('div');
        div.className = 'chatbot-message ' + (isUser ? 'user' : 'bot');
        div.innerHTML = '<div class="message-bubble">' + escapeHtml(text) + '</div>';
        messages.appendChild(div);
        messages.scrollTop = messages.scrollHeight;
    }
    
    function escapeHtml(text) {
        const div = document.createElement('div');
        div.textContent = text;
        return div.innerHTML;
    }
    
    function sendMessage() {
        const message = input.value.trim();
        if (!message) return;
        
        addMessage(message, true);
        input.value = '';
        
        fetch('https://sitenou.asculta-ma.roajax/chatbot.php', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ message: message, lang: 'ro' })
        })
        .then(response => response.json())
        .then(data => {
            addMessage(data.reply || 'Sorry, I didn\'t understand that.', false);
        })
        .catch(error => {
            addMessage('Error. Please try again.', false);
        });
    }
    
    if (sendBtn) {
        sendBtn.addEventListener('click', sendMessage);
    }
    if (input) {
        input.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') sendMessage();
        });
    }
});
</script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>