/* =========================================================
   Fekrati.tn — Style principal
   ========================================================= */
:root {
  --primary: #6d28d9;
  --primary-light: #8b5cf6;
  --primary-dark: #4c1d95;
  --accent: #f59e0b;
  --success: #16a34a;
  --danger: #dc2626;
  --bg: #f8f7fc;
  --text: #1e1b2e;
  --text-muted: #6b7280;
  --card-bg: #ffffff;
  --border: #e5e2f0;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(76, 29, 149, 0.08);
  --shadow-hover: 0 20px 40px rgba(76, 29, 149, 0.16);
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5 { font-family: var(--font-heading); font-weight: 700; line-height: 1.25; }
a { text-decoration: none; color: inherit; transition: all .2s ease; }
img { max-width: 100%; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: none; cursor: pointer; transition: all .25s cubic-bezier(.4,0,.2,1);
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 8px 20px rgba(109,40,217,.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(109,40,217,.45); }
.btn-ghost { background: transparent; color: var(--primary); border: 2px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); background: #f3effd; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 2px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 16px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 24px; }
.logo { font-family: var(--font-heading); font-weight: 800; font-size: 1.4rem; display: flex; align-items: center; gap: 8px; color: var(--primary-dark); }
.logo-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.logo-dot { color: var(--accent); }

.main-nav { display: flex; align-items: center; gap: 32px; font-weight: 600; }
.main-nav > a:hover { color: var(--primary); }
.nav-dropdown { position: relative; cursor: pointer; }
.nav-dropdown > span { display: flex; align-items: center; gap: 6px; }
.dropdown-menu {
  position: absolute; top: 130%; left: 0; background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  min-width: 200px; padding: 8px; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all .2s ease; z-index: 50;
}
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a { display: block; padding: 10px 14px; border-radius: 8px; font-weight: 500; }
.dropdown-menu a:hover { background: #f3effd; color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.burger { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--primary-dark); }

.user-menu { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 8px; background: #f3effd; border: none; border-radius: 999px; padding: 6px 14px 6px 6px; cursor: pointer; font-weight: 600; }
.avatar-btn img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-dropdown {
  position: absolute; right: 0; top: 120%; background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  min-width: 200px; padding: 8px; opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .2s ease; z-index: 50;
}
.user-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; font-weight: 500; }
.user-dropdown a:hover { background: #f3effd; color: var(--primary); }

/* ---------- Flash messages ---------- */
.flash { max-width: 1200px; margin: 16px auto 0; padding: 14px 20px; border-radius: 12px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* ---------- Hero ---------- */
.hero {
  position: relative; padding: 90px 0 70px; overflow: hidden;
  background: radial-gradient(circle at 20% 20%, #ede9fe, transparent 60%), radial-gradient(circle at 80% 0%, #fef3c7, transparent 50%), var(--bg);
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 3rem; margin-bottom: 20px; }
.hero h1 .highlight { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-muted); font-size: 1.15rem; margin-bottom: 32px; max-width: 520px; }
.hero-actions { display: flex; gap: 16px; }
.hero-visual { position: relative; }
.floating-card {
  position: absolute; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 18px;
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .9rem; animation: float 4s ease-in-out infinite;
}
.hero-graphic { width: 100%; border-radius: 24px; box-shadow: var(--shadow-hover); }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-14px);} }

/* ---------- Sections génériques ---------- */
.section { padding: 70px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-head h2 { font-size: 2.1rem; margin-bottom: 12px; }
.section-head p { color: var(--text-muted); }
.badge-tag { display: inline-block; padding: 6px 16px; border-radius: 999px; background: #ede9fe; color: var(--primary); font-weight: 700; font-size: .8rem; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 14px; }

/* ---------- Grille de catégories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.cat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 28px; text-align: center;
  box-shadow: var(--shadow); transition: all .3s ease; border: 1px solid var(--border);
}
.cat-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); border-color: var(--primary-light); }
.cat-card .icon { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.cat-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.cat-card p { color: var(--text-muted); font-size: .85rem; }

/* ---------- Cartes d'articles ---------- */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.article-list { display: flex; flex-direction: column; gap: 20px; }

.article-card {
  background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  border: 1px solid var(--border); transition: all .3s ease; display: flex; flex-direction: column;
}
.article-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.article-card .thumb { position: relative; height: 190px; overflow: hidden; }
.article-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.article-card:hover .thumb img { transform: scale(1.08); }
.article-card .cat-chip { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); color: #fff; padding: 5px 14px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.article-card .body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.article-card h3 { font-size: 1.1rem; }
.article-card p.desc { color: var(--text-muted); font-size: .9rem; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--text-muted); margin-top: 6px; }
.stars { color: var(--accent); }

/* Mode liste */
.article-list .article-card { flex-direction: row; }
.article-list .article-card .thumb { width: 260px; height: auto; flex-shrink: 0; }
@media (max-width: 700px) { .article-list .article-card { flex-direction: column; } .article-list .article-card .thumb { width: 100%; height: 190px; } }

/* ---------- Toolbar de recherche/filtres ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 32px; background: #fff; padding: 18px; border-radius: var(--radius); box-shadow: var(--shadow); }
.toolbar form { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; }
.toolbar input, .toolbar select { padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border); font-family: inherit; font-size: .9rem; }
.toolbar input[type=text] { flex: 1; min-width: 180px; }
.view-toggle { display: flex; gap: 6px; background: #f3effd; border-radius: 10px; padding: 4px; }
.view-toggle button { border: none; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--text-muted); }
.view-toggle button.active { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,.08); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1.5px solid var(--border); font-weight: 600; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Formulaires ---------- */
.form-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; max-width: 520px; margin: 60px auto; }
.form-card h2 { text-align: center; margin-bottom: 8px; }
.form-card .sub { text-align: center; color: var(--text-muted); margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-family: inherit; font-size: .95rem; transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.captcha-box { display: flex; align-items: center; gap: 14px; background: #f3effd; padding: 14px; border-radius: 10px; }
.captcha-box .op { font-family: var(--font-heading); font-weight: 800; font-size: 1.3rem; color: var(--primary-dark); letter-spacing: 2px; }
.form-footer { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--text-muted); }

/* ---------- Article détail ---------- */
.article-hero { position: relative; height: 380px; border-radius: var(--radius); overflow: hidden; margin-bottom: -60px; }
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
.article-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.75), transparent 60%); }
.article-hero-content { position: absolute; bottom: 24px; left: 32px; right: 32px; color: #fff; z-index: 2; }
.article-hero-content h1 { font-size: 2rem; margin-bottom: 10px; }
.article-body-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 48px; margin-top: 0; position: relative; z-index: 3; }
.article-content { font-size: 1.05rem; line-height: 1.85; margin-top: 24px; }
.article-content img { border-radius: 12px; margin: 18px 0; cursor: zoom-in; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.tag { background: #f3effd; color: var(--primary); padding: 5px 14px; border-radius: 999px; font-size: .8rem; font-weight: 600; }

/* ---------- Étoiles interactives ---------- */
.star-rating { display: inline-flex; gap: 4px; font-size: 1.4rem; color: #d1d5db; cursor: pointer; }
.star-rating i.active, .star-rating i:hover { color: var(--accent); }

/* ---------- Commentaires ---------- */
.comments-section { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 32px; }
.comment { display: flex; gap: 14px; margin-bottom: 22px; }
.comment img.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-body { background: #f8f7fc; border-radius: 14px; padding: 14px 18px; flex: 1; }
.comment-body .meta { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.comment-body .name { font-weight: 700; color: var(--text); }

/* ---------- Cards admin/dashboard ---------- */
.dash-wrap { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.dash-sidebar { background: linear-gradient(180deg, var(--primary-dark), var(--primary)); color: #fff; padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.dash-sidebar .logo { color: #fff; margin-bottom: 30px; padding: 0 8px; }
.dash-sidebar a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; font-weight: 600; color: rgba(255,255,255,.85); margin-bottom: 4px; }
.dash-sidebar a:hover, .dash-sidebar a.active { background: rgba(255,255,255,.15); color: #fff; }
.dash-sidebar .section-label { text-transform: uppercase; font-size: .7rem; letter-spacing: 1px; opacity: .6; margin: 18px 8px 6px; }
.dash-main { padding: 32px 40px; background: var(--bg); }
.dash-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.dash-topbar h1 { font-size: 1.6rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: 16px; padding: 22px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-card .icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; font-family: var(--font-heading); }
.stat-card .label { color: var(--text-muted); font-size: .85rem; }

.card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.card h3 { margin-bottom: 16px; }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: .9rem; }
table.data-table th { color: var(--text-muted); text-transform: uppercase; font-size: .75rem; letter-spacing: .5px; }
table.data-table tr:hover { background: #faf9ff; }

.status-pill { padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.status-actif, .status-valide, .status-publie { background: #dcfce7; color: #166534; }
.status-attente, .status-brouillon, .status-nouveau { background: #fef3c7; color: #92400e; }
.status-refuse, .status-archive { background: #fee2e2; color: #991b1b; }

.icon-btn { background: #f3effd; border: none; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.danger { background: #fee2e2; color: var(--danger); }
.icon-btn:hover { filter: brightness(.95); }

/* ---------- Toggle switch (maintenance) ---------- */
.switch { position: relative; display: inline-block; width: 52px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-toggle { position: absolute; cursor: pointer; inset: 0; background: #d1d5db; border-radius: 999px; transition: .3s; }
.slider-toggle::before { content: ''; position: absolute; height: 20px; width: 20px; left: 4px; bottom: 4px; background: #fff; border-radius: 50%; transition: .3s; }
input:checked + .slider-toggle { background: var(--success); }
input:checked + .slider-toggle::before { transform: translateX(24px); }

/* ---------- Footer ---------- */
.site-footer { background: var(--primary-dark); color: rgba(255,255,255,.85); padding: 60px 0 0; margin-top: 80px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; padding: 0 24px 40px; }
.footer-col h4 { color: #fff; margin-bottom: 14px; font-size: 1rem; }
.footer-col a, .footer-col p { display: block; color: rgba(255,255,255,.7); margin-bottom: 10px; font-size: .9rem; }
.footer-col a:hover { color: #fff; }
.footer-col .logo { margin-bottom: 14px; }
.footer-bottom { text-align: center; padding: 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; color: rgba(255,255,255,.6); }

/* ---------- Animations générales ---------- */
.fade-up { animation: fadeUp .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero p { margin: 0 auto 32px; }
  .hero-actions { justify-content: center; }
  .dash-wrap { grid-template-columns: 1fr; }
  .dash-sidebar { position: relative; height: auto; }
}
@media (max-width: 800px) {
  .main-nav { position: fixed; top: 76px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: flex-start; padding: 20px 24px; box-shadow: var(--shadow); transform: translateY(-150%); transition: transform .3s ease; z-index: 90; }
  .main-nav.open { transform: translateY(0); }
  .burger { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .article-body-card { padding: 24px; }
  .article-hero-content h1 { font-size: 1.4rem; }
}
@media (max-width: 500px) {
  .footer-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.1rem; }
}
