:root {
    --bg: #0a0a0f;
    --surface: #111118;
    --card: #161620;
    --primary: #ff6b35;
    --primary-hover: #ff8055;
    --primary-glow: rgba(255,107,53,0.3);
    --accent: #ff4757;
    --success: #2ed573;
    --text: #ffffff;
    --text2: #888899;
    --text3: #555566;
    --border: rgba(255,255,255,0.06);
    --border2: rgba(255,255,255,0.12);
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 20px 60px rgba(0,0,0,0.6);
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* TOAST */
.toast {
    position: fixed; top: 20px; right: 20px; z-index: 99999;
    background: #1a1a2e; color: #fff; padding: 12px 20px;
    border-radius: 10px; border: 1px solid rgba(255,255,255,0.1);
    font-weight: 500; font-size: 0.85rem;
    transform: translateX(120%); transition: transform 0.35s cubic-bezier(0.175,0.885,0.32,1.275);
}
.toast.show { transform: translateX(0); }

/* MODAL */
.modal {
    display: none; position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,0.95); cursor: pointer;
}
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal img { max-width: 90%; max-height: 90vh; border-radius: var(--radius-lg); }
.modal span { position: absolute; top: 24px; right: 48px; color: #fff; font-size: 40px; cursor: pointer; }

/* ========== AUTH PAGE ========== */
.auth-page {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    background: var(--bg); z-index: 9997; padding: 16px;
}
.auth-container {
    display: flex; width: 100%; max-width: 900px;
    background: var(--card); border-radius: var(--radius-xl);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), var(--shadow);
    animation: fadeUp 0.5s ease;
    min-height: auto;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

.auth-hero {
    flex: 1; background: linear-gradient(160deg, #0f0f1a 0%, #1a1028 40%, #0f1525 100%);
    position: relative; display: flex; align-items: center; justify-content: center; padding: 40px; overflow: hidden;
}
.hero-bg {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(255,107,53,0.08) 0%, transparent 60%),
                radial-gradient(circle at 70% 60%, rgba(255,71,87,0.05) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; text-align: center; }
.hero-icon { font-size: 56px; margin-bottom: 16px; filter: drop-shadow(0 0 20px rgba(255,107,53,0.4)); }
.hero-content h1 { font-size: 1.8rem; font-weight: 800; }
.hero-content h1 span { color: var(--primary); }
.hero-content p { color: var(--text2); margin-top: 8px; font-size: 0.9rem; }
.hero-users { margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 0.8rem; color: var(--text2); }
.hero-users span span { color: var(--primary); font-weight: 700; }

.auth-form-side {
    flex: 1; padding: 30px;
    display: flex; flex-direction: column; background: var(--card);
    overflow-y: auto;
    max-height: 85vh;
}
.auth-tabs { display: flex; gap: 0; background: rgba(255,255,255,0.03); border-radius: 8px; padding: 3px; margin-bottom: 20px; }
.tab {
    flex: 1; padding: 9px; border: none; background: transparent; color: var(--text2);
    border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: var(--transition); font-family: inherit;
}
.tab.active { background: var(--primary); color: #fff; }

.form { display: none; flex-direction: column; gap: 10px; flex: 1; }
.form.active { display: flex; }
.form h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.input-box {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0 12px; transition: var(--transition);
}
.input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,0.1); }
.input-box i { color: var(--text2); font-size: 0.9rem; }
.input-box input, .input-box textarea {
    flex: 1; padding: 8px 0;
    background: transparent; border: none;
    color: #fff; font-size: 0.9rem; font-family: inherit; outline: none;
}
.input-box input::placeholder, .input-box textarea::placeholder { color: #555; }

.btn-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px; background: var(--primary); color: #fff; border: none;
    border-radius: var(--radius); font-weight: 700; font-size: 0.9rem;
    cursor: pointer; font-family: inherit; transition: var(--transition);
    margin-top: 8px;
}
.btn-submit:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 8px 24px var(--primary-glow); }
.btn-outline {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; background: transparent; border: 1px solid var(--border2); color: var(--text);
    border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 0.8rem; font-family: inherit; transition: var(--transition);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.demo-text { text-align: center; font-size: 0.7rem; color: #555; margin-top: 6px; }

/* ========== APP LAYOUT ========== */
.app-layout { display: flex; height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 260px; background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 16px; gap: 16px; overflow-y: auto;
}
.sidebar-header { font-size: 1.1rem; font-weight: 800; }
.sidebar-header span { color: var(--primary); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.side-btn {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: transparent; border: none; color: var(--text2);
    border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 0.85rem;
    font-family: inherit; transition: var(--transition); text-align: left; width: 100%;
}
.side-btn:hover { background: rgba(255,255,255,0.04); color: #fff; }
.side-btn.active { background: var(--primary); color: #fff; }
.side-btn i { width: 20px; text-align: center; }
.btn-highlight { color: var(--primary); }
.btn-highlight:hover { background: var(--primary); color: #fff; }
.sidebar-stats { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.side-stat { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text2); padding: 4px 12px; }
.side-stat i { width: 16px; color: var(--text3); }
.side-stat.online i { color: #2ed573; font-size: 0.6rem; }
.side-stat.online span { color: #2ed573; font-weight: 700; }
.sidebar-footer { margin-top: auto; }
.whatsapp-side-btn {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: #25D366; color: #fff; border-radius: 8px; text-decoration: none;
    font-weight: 600; font-size: 0.85rem; transition: var(--transition);
}
.whatsapp-side-btn:hover { background: #1ebe57; }

/* MAIN CONTENT */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
    display: flex; align-items: center; gap: 16px; padding: 10px 20px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.topbar-search { flex: 1; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 20px; padding: 0 14px; }
.topbar-search i { color: var(--text3); font-size: 0.8rem; }
.topbar-search input {
    flex: 1; padding: 8px 0; background: transparent; border: none; color: #fff; font-size: 0.8rem; font-family: inherit; outline: none;
}
.topbar-user { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.8rem; }
.logout-btn { background: none; border: none; color: #666; cursor: pointer; font-size: 0.9rem; }
.logout-btn:hover { color: var(--accent); }
.content-area { flex: 1; overflow-y: auto; padding: 20px; }
.section { display: none; animation: fadeUp 0.3s ease; }
.section.active { display: block; }
.section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section h2 i { color: var(--primary); }

/* PRODUCTS GRID */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.product-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; transition: var(--transition); cursor: pointer;
}
.product-card:hover { border-color: rgba(255,107,53,0.4); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,0.5); }
.product-img { height: 170px; overflow: hidden; position: relative; background: #1a1a2e; }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: var(--transition); }
.product-card:hover .product-img img { transform: scale(1.04); }
.product-body { padding: 12px; }
.product-body h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 3px; }
.product-body .desc { color: var(--text2); font-size: 0.72rem; line-height: 1.4; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-footer { display: flex; justify-content: space-between; align-items: center; }
.price { font-size: 1rem; font-weight: 800; color: var(--primary); }
.stock { font-size: 0.65rem; color: var(--success); background: rgba(46,213,115,0.1); padding: 2px 7px; border-radius: 10px; }
.product-actions { display: flex; gap: 5px; margin-top: 8px; }
.product-actions button { flex: 1; padding: 7px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.7rem; font-family: inherit; transition: var(--transition); }
.btn-buy { background: #25D366; color: #fff; }
.btn-buy:hover { background: #1ebe57; }
.btn-delete { background: transparent; border: 1px solid var(--accent) !important; color: var(--accent); }
.btn-delete:hover { background: var(--accent); color: #fff; }

/* POSTS */
.posts-feed { display: flex; flex-direction: column; gap: 14px; }
.post-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px; transition: var(--transition);
}
.post-card:hover { border-color: rgba(255,107,53,0.3); }
.post-img { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius); margin-bottom: 12px; cursor: pointer; background: #1a1a2e; }
.post-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.post-header h3 { font-size: 1rem; font-weight: 700; }
.post-date { color: var(--text2); font-size: 0.65rem; }
.post-author { display: inline-block; background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 12px; font-size: 0.7rem; font-weight: 600; margin-bottom: 8px; }
.post-content { color: var(--text2); line-height: 1.6; margin-bottom: 12px; white-space: pre-wrap; font-size: 0.82rem; }
.post-actions-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.btn-like {
    display: flex; align-items: center; gap: 5px; padding: 6px 14px;
    background: transparent; border: 1px solid var(--accent); color: var(--accent);
    border-radius: 16px; cursor: pointer; font-weight: 600; font-size: 0.75rem; transition: var(--transition); font-family: inherit;
}
.btn-like:hover, .btn-like.liked { background: var(--accent); color: #fff; }
.comments-block { border-top: 1px solid var(--border); padding-top: 12px; }
.comments-block h4 { font-size: 0.75rem; font-weight: 700; margin-bottom: 8px; }
.comment { background: rgba(255,255,255,0.02); padding: 8px; border-radius: 6px; margin-bottom: 5px; }
.c-user { font-weight: 700; color: var(--primary); font-size: 0.7rem; }
.c-text { color: var(--text2); font-size: 0.75rem; margin-top: 2px; }

/* COMMENT FORM */
.comment-form {
    display: flex; align-items: center; gap: 6px; margin-top: 8px; height: 34px;
}
.comment-form input {
    flex: 1; height: 100%; padding: 0 12px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 17px; color: #fff; font-size: 0.72rem; font-family: inherit; outline: none; line-height: 34px;
}
.comment-form input:focus { border-color: var(--primary); }
.comment-form input::placeholder { color: #555; }
.comment-form button {
    height: 100%; padding: 0 14px; background: var(--primary); color: #fff;
    border: none; border-radius: 17px; font-weight: 600; font-size: 0.72rem;
    cursor: pointer; white-space: nowrap; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.comment-form button:hover { background: var(--primary-hover); }

/* ENHANCED FORMS */
.enhanced-form {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 32px; max-width: 700px; margin: 0 auto; box-shadow: var(--shadow);
}
.enhanced-form .form-header { text-align: center; margin-bottom: 28px; }
.enhanced-form .form-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; gap: 8px; }
.enhanced-form .form-header h2 i { color: var(--primary); }
.enhanced-form .form-header p { color: var(--text2); font-size: 0.85rem; margin-top: 6px; }
.enhanced-form .field { margin-bottom: 20px; }
.enhanced-form .field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.enhanced-form .field label i { margin-right: 4px; color: var(--primary); }
.enhanced-form input, .enhanced-form textarea {
    width: 100%; padding: 12px 14px; background: rgba(255,255,255,0.03);
    border: 1px solid var(--border); border-radius: var(--radius); color: #fff;
    font-size: 0.9rem; font-family: inherit; transition: var(--transition);
}
.enhanced-form input:focus, .enhanced-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,0.15); outline: none; }
.enhanced-form input::placeholder, .enhanced-form textarea::placeholder { color: var(--text3); }
.enhanced-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.file-upload.enhanced label {
    display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px;
    background: rgba(255,255,255,0.02); border: 2px dashed var(--border); border-radius: var(--radius);
    cursor: pointer; transition: var(--transition); font-size: 0.85rem; color: var(--text2);
}
.file-upload.enhanced label:hover { border-color: var(--primary); color: var(--primary); background: rgba(255,107,53,0.05); }
.preview-img { width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--radius); margin-top: 10px; border: 1px solid var(--border); background: #1a1a2e; }
.submit-btn.enhanced {
    width: auto; padding: 12px 32px; background: var(--primary); color: #fff; border: none;
    border-radius: var(--radius); font-weight: 700; font-size: 1rem; cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; align-self: flex-start;
}
.submit-btn.enhanced:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 8px 20px var(--primary-glow); }

/* SETTINGS */
.settings-container { display: flex; gap: 24px; max-width: 800px; margin: 0 auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.settings-sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 0; display: flex; flex-direction: column; }
.settings-tab { background: transparent; border: none; color: var(--text2); padding: 12px 20px; text-align: left; font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: var(--transition); font-family: inherit; }
.settings-tab:hover { background: rgba(255,255,255,0.03); color: #fff; }
.settings-tab.active { background: rgba(255,107,53,0.1); color: var(--primary); font-weight: 600; border-left: 3px solid var(--primary); }
.settings-content { flex: 1; padding: 24px; }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-panel h3 { font-size: 1.2rem; margin-bottom: 20px; font-weight: 700; }
.profile-picture-section { display: flex; justify-content: center; margin-bottom: 24px; }
.profile-picture-wrapper { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.profile-pic.large { width: 100px; height: 100px; font-size: 3rem; border-radius: 50%; background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); overflow: hidden; }
.profile-pic.large img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#profileImageUpload { display: none; }
.change-photo-btn { font-size: 0.8rem; color: var(--primary); cursor: pointer; font-weight: 600; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.input-box { width: 100%; padding: 10px 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius); color: #fff; font-size: 0.9rem; font-family: inherit; }
textarea.input-box { resize: vertical; }
.btn-delete-account { width: 100%; padding: 12px; background: transparent; border: 1px solid var(--accent); color: var(--accent); border-radius: var(--radius); font-weight: 600; cursor: pointer; transition: var(--transition); font-family: inherit; }
.btn-delete-account:hover { background: var(--accent); color: #fff; }

/* CONTACT MODAL */
.contact-modal { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.8); align-items: center; justify-content: center; }
.contact-modal.active { display: flex; }
.contact-card { background: var(--card); padding: 24px; border-radius: var(--radius-lg); text-align: center; border: 1px solid var(--border); max-width: 360px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.contact-card h3 { font-size: 1rem; }
.contact-card p { color: var(--text2); font-size: 0.85rem; }

/* WHATSAPP FLOAT */
.whatsapp-float {
    position: fixed; bottom: 20px; right: 20px; z-index: 9996;
    width: 50px; height: 50px; background: #25D366; color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; text-decoration: none; box-shadow: 0 6px 20px rgba(37,211,102,0.3);
    transition: var(--transition); animation: bounce 3s infinite;
}
.whatsapp-float:hover { transform: translateY(-3px) scale(1.05); }
@keyframes bounce { 0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)} }

/* ========== MOBILE (tous les téléphones) ========== */
@media (max-width: 480px) {
    body { font-size: 14px; }

    .auth-page { padding: 0; }
    .auth-container { flex-direction: column; max-width: 100%; min-height: 100vh; border-radius: 0; }
    .auth-hero { padding: 20px 16px; flex: none; }
    .hero-icon { font-size: 32px; margin-bottom: 6px; }
    .hero-content h1 { font-size: 1.3rem; }
    .hero-content p { font-size: 0.78rem; }
    .hero-users { font-size: 0.7rem; gap: 8px; }
    .auth-form-side { padding: 16px; max-height: none; overflow-y: visible; }
    .tab { font-size: 0.8rem; padding: 8px; }
    .form h2 { font-size: 1.1rem; }
    .form { gap: 8px; }
    .input-box input { font-size: 0.85rem; padding: 10px 0; }
    .btn-submit { padding: 12px; font-size: 0.9rem; }

    .sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 200; width: 80%; max-width: 300px; transition: left 0.3s ease; }
    .sidebar.open { left: 0; }
    .menu-toggle { display: block; }

    .topbar { padding: 8px 12px; gap: 8px; }
    .topbar-search input { font-size: 0.78rem; }
    .topbar-user { font-size: 0.78rem; }

    .content-area { padding: 12px; }
    .section h2 { font-size: 1rem; }

    .products-grid { grid-template-columns: 1fr; gap: 10px; }
    .product-img { height: 160px; }
    .product-body h3 { font-size: 0.88rem; }
    .product-body .desc { font-size: 0.72rem; }
    .price { font-size: 0.95rem; }
    .product-actions button { padding: 7px; font-size: 0.7rem; }

    .post-card { padding: 14px; }
    .post-header h3 { font-size: 0.92rem; }
    .post-content { font-size: 0.8rem; }
    .btn-like { padding: 5px 12px; font-size: 0.72rem; }

    .comment-form { height: 32px; }
    .comment-form input { font-size: 0.7rem; }
    .comment-form button { padding: 0 12px; font-size: 0.7rem; }

    .enhanced-form { padding: 20px; max-width: 100%; }
    .enhanced-form input, .enhanced-form textarea { font-size: 0.85rem; }
    .row-2 { grid-template-columns: 1fr; }
    .submit-btn.enhanced { width: 100%; }

    .settings-container { flex-direction: column; }
    .settings-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .settings-tab { white-space: nowrap; }

    .whatsapp-float { width: 48px; height: 48px; font-size: 1.2rem; bottom: 16px; right: 16px; }
}