@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700;800&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --navy: #111111;
  --gold: #D4AF37;
  --gold-dark: #8F6C24;
  --border: #efe6c8;
  --bg: #faf8f0;
  --bg-input: #fcfaf2;
  --text: #1c1a12;
  --muted: #8a8470;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(143, 108, 36, .05), 0 10px 28px rgba(143, 108, 36, .07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Manrope', sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: var(--gold-dark); }
h1, h2, h3, .brand { font-family: 'Poppins', sans-serif; }
h2 { margin: 2rem 0 1rem; font-size: 1.1rem; color: var(--navy); }
.muted { color: var(--muted); }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 240px; background: var(--navy); color: #fff; flex-shrink: 0; display: flex; flex-direction: column; padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { margin-bottom: 24px; padding: 0 8px; font-size: 15px; font-weight: 800; color: var(--gold); line-height: 1.2; }
.brand span { display: block; margin-top: 4px; font-size: 11px; font-weight: 600; color: #8c8c8c; letter-spacing: .5px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .side-link { display: flex; align-items: center; padding: 11px 14px; color: #d8d8d8; font-size: 14px; font-weight: 600; border-radius: 8px; transition: all .15s ease; }
.sidebar nav a:hover, .side-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: rgba(212,175,55,.16); color: var(--gold); }
.nav-section { padding: 16px 14px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #777; font-weight: 700; }
.nav-ico { width: 18px; margin-right: 10px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 999px; padding: 0 .55rem; font-size: 11px; font-weight: 700; }
.side-link { font-size: 13px; color: #aaa; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.topbar-left { min-width: 0; flex: 1; }
.admin-topbar h1 { font-size: 18px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--navy); }
.menu-toggle { display: none; background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--navy); }

.admin-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.admin-breadcrumb a { color: var(--muted); }
.admin-breadcrumb a:hover { color: var(--gold-dark); text-decoration: underline; }
.admin-breadcrumb .sep { color: var(--border); }
.admin-breadcrumb .current { color: var(--text); font-weight: 600; }

.topstats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topstats .stat { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; transition: box-shadow .15s ease, transform .15s ease; }
.topstats .stat:hover { box-shadow: 0 4px 12px rgba(143,108,36,.12); transform: translateY(-1px); }
.topstats .stat b { font-size: 13px; color: var(--navy); }
.topstats .stat.blue { background: #eef5fb; border-color: #dceaf6; color: #3e7ba6; }
.topstats .stat.blue b { color: #2a6fa8; }
.topstats .stat.gold { background: #fbf3e0; border-color: #f0e0b0; color: var(--gold-dark); }

.user-menu { position: relative; }
.user-menu > button { display: flex; align-items: center; gap: 10px; background: none; border: none; font-family: inherit; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.user-menu > button:hover { background: var(--bg-input); }
.ident { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; text-align: right; }
.ident b { font-size: 13px; color: var(--navy); }
.ident small { font-size: 11.5px; color: var(--muted); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: var(--gold); font-size: 13px; font-weight: 700; }
.user-menu .menu { display: none; position: absolute; right: 0; top: 100%; margin-top: 6px; min-width: 200px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 24px rgba(0,0,0,.12); overflow: hidden; z-index: 100; }
.user-menu.open .menu { display: block; }
.user-menu .menu a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; color: var(--text); white-space: nowrap; }
.user-menu .menu a:hover { background: var(--bg-input); }
.user-menu .menu hr { border: none; border-top: 1px solid var(--border); }

.admin-content { padding: 28px 32px; flex: 1; max-width: 1200px; width: 100%; }

/* Toast */
.toast { position: fixed; top: 84px; right: 24px; z-index: 200; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 10px; background: #e6f4ea; color: #1e7b34; font-size: 14px; font-weight: 600; box-shadow: 0 10px 24px rgba(0,0,0,.12); animation: toastIn .25s ease; transition: opacity .4s; }
.toast.error { background: #fbeaea; color: var(--danger); }
.toast.hide { opacity: 0; pointer-events: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Cards, forms */
.card { background: #fff; border-radius: 14px; padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.form { display: grid; gap: 16px; max-width: 640px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label.check { display: flex; align-items: center; gap: .5rem; }
input, textarea { font: inherit; font-size: 14px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: #fff; color: var(--text); transition: border-color .15s ease; }
input[type=checkbox] { width: auto; }
input:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,55,.15); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--navy); color: var(--gold); border: none; border-radius: 8px; padding: 11px 18px; font-family: 'Poppins', sans-serif; font-size: 13.5px; font-weight: 700; cursor: pointer; justify-self: start; transition: background .15s ease; }
.btn:hover { background: #2a2a2a; }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn.danger { background: #fbeaea; color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid #f3efe0; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
tr:hover td { background: #fdfbf5; }
tr.unread td { font-weight: 700; }
.actions { display: flex; gap: .5rem; align-items: center; }
.tag { padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; background: #f1efe6; color: var(--muted); }
.tag.ok { background: #e6f4ea; color: #1e7b34; }
.logo-thumb { height: 36px; width: auto; }

/* Dashboard stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stats .stat { background: #fff; border-radius: 14px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: 4px; transition: transform .15s ease; }
.stats .stat:hover { transform: translateY(-2px); }
.stats .stat i { color: var(--gold); font-size: 1.5rem; }
.stats .stat strong { font-family: 'Poppins', sans-serif; font-size: 1.8rem; color: var(--navy); }
.stats .stat span { color: var(--muted); font-size: 12.5px; }

/* Messages */
.message.unread { border-left: 4px solid var(--gold); }
.message header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: baseline; margin-bottom: .75rem; }
.message p { margin-bottom: 1rem; line-height: 1.6; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 1rem; }
.photo { background: #fff; border-radius: 12px; overflow: hidden; display: grid; gap: 8px; padding-bottom: 10px; box-shadow: var(--shadow); }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.photo form { padding: 0 10px; }
.caption { display: flex; gap: 6px; }
.caption input { padding: 7px 10px; font-size: 12.5px; }

/* Login */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-card { background: #fff; padding: 40px; border-radius: 14px; width: min(400px, 92vw); display: grid; gap: 16px; box-shadow: 0 20px 40px rgba(0,0,0,.3); }
.login-card h1 { color: var(--navy); font-size: 20px; text-align: center; }
.login-card .muted { text-align: center; margin-top: -10px; font-size: 13px; }
.login-card .btn { justify-self: stretch; justify-content: center; background: var(--gold); color: var(--navy); padding: 13px; }
.login-card .btn:hover { background: #bd9b2f; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; background: #e6f4ea; color: #1e7b34; }
.alert.error { background: #fbeaea; color: var(--danger); }

@media (max-width: 1100px) { .topstats { display: none; } }
@media (max-width: 900px) {
  .ident { display: none; }
  .menu-toggle { display: block; }
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .admin-topbar { padding: 14px 18px; }
  .admin-content { padding: 20px 16px; }
  table { display: block; overflow-x: auto; }
}

/* Galerie filters, selects */
select { font: inherit; font-size: 14px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: #fff; }
.event-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.5rem 0 0; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 12.5px; font-weight: 600; }
.chip:hover, .chip.active { background: var(--navy); color: var(--gold); border-color: var(--navy); }
.photo-event { padding: 0 10px; }

/* Inscriptions */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 1.5rem; }
.toolbar .event-filter { margin: 0; }
.tag.ko { background: #fbeaea; color: var(--danger); }
.inscription { margin-bottom: 14px; }
.inscription.unread { border-left: 4px solid var(--gold); }
.inscription header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin-bottom: 1rem; }
.details dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; }
.details dd { font-size: 14px; }
.motivation { background: var(--bg-input); border-radius: 8px; padding: 12px 14px; margin-bottom: 1rem; font-size: 14px; line-height: 1.6; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select { width: auto; padding: 7px 10px; font-size: 13px; }

/* Payments */
.pay-status { display: flex; gap: 1rem; align-items: center; border-left: 4px solid var(--border); }
.pay-status.on { border-left-color: var(--gold); }
.pay-status > i { font-size: 1.8rem; color: var(--gold-dark); }
.pay-status p { margin: .15rem 0 0; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.chip.pay { border-color: var(--gold); }
.tag.pay-en_attente { background: #fff3d6; color: #8a5a00; }
.tag.pay-paye { background: #e6f4ea; color: #1e7b34; }
.tag.pay-refuse { background: #fbeaea; color: var(--danger); }
.pay-details { background: var(--bg-input); border-radius: 8px; padding: 12px 14px; margin-bottom: 1rem; }
code { background: #f1efe6; padding: 1px 6px; border-radius: 4px; font-size: .85em; }
@media (max-width: 700px) { .two-cols { grid-template-columns: 1fr; } }

/* Inline date edit */
.date-edit { display: flex; gap: 6px; align-items: center; }
.date-edit input[type=date] { width: auto; padding: 7px 10px; font-size: 13px; }

/* Gallery management */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); position: sticky; top: 76px; z-index: 30; margin-bottom: 10px; }
.bulk-bar select { width: auto; padding: 7px 10px; font-size: 13px; min-width: 190px; }
.bulk-bar .sel-count { color: var(--muted); font-size: 13px; }
.bulk-bar.active { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.save-state { margin-left: auto; font-size: 13px; color: #1e7b34; font-weight: 600; }
.save-state.error { color: var(--danger); }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.hint .bi { color: var(--gold-dark); }
.photo-grid .photo { position: relative; transition: box-shadow .15s; }
.photo-grid .photo.selected { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.photo .pick { position: absolute; top: 8px; left: 8px; z-index: 3; background: rgba(255,255,255,.92); border-radius: 6px; padding: 4px 6px; line-height: 0; cursor: pointer; }
.photo .pick input { width: 16px; height: 16px; accent-color: var(--gold-dark); margin: 0; }
.photo .handle { position: absolute; top: 8px; right: 8px; z-index: 3; background: rgba(17,17,17,.78); color: var(--gold); border-radius: 6px; padding: 4px 6px; cursor: grab; line-height: 1; font-size: 1.1rem; }
.photo .handle:active { cursor: grabbing; }
.photo .num { position: absolute; left: 8px; top: 40px; z-index: 3; background: rgba(17,17,17,.78); color: #fff; border-radius: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; }
.photo .num:empty { display: none; }
.photo .fields { display: grid; gap: 6px; padding: 0 10px; }
.photo .fields input { padding: 7px 9px; font-size: 12.5px; }
.photo .fields input[data-field="designation"] { font-weight: 600; }
.photo .fields input.saving { opacity: .6; }
.photo .fields input.saved { border-color: #1e7b34; box-shadow: 0 0 0 3px rgba(30,123,52,.15); }
.photo .del { margin: 0 10px; justify-self: end; }
.photo.ghost { opacity: .35; }
.photo.chosen { box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.photo-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.react-count { color: var(--muted); font-size: 12px; }
.react-count .bi-heart-fill { color: #e0405f; }
.react-count .bi-heartbreak-fill { color: #6f7fa8; }

/* Page images */
.del-form { margin: 0 10px; justify-self: end; }
.del-form .del { margin: 0; }

/* Payment mode */
.mode-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode { display: flex !important; align-items: flex-start; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: #fff; font-weight: 400; }
.mode.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.25); }
.mode input { width: auto; margin-top: 4px; accent-color: var(--gold-dark); }
.mode strong { display: block; font-size: 14px; }
.mode small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.url-box { display: grid; gap: 6px; padding: 14px 16px; background: var(--bg-input); box-shadow: none; border: 1px dashed var(--border); margin: 0; }
.url-box code { word-break: break-all; font-size: 13px; }
.advanced { margin-top: -.25rem; }
.advanced summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.advanced label { margin-top: 10px; }
@media (max-width: 700px) { .mode-choice { grid-template-columns: 1fr; } }

/* Login alert */
.login-alert { display: none; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; background: #fdecea; color: #a1281c; border: 1px solid #f3b9b2; font-size: 13.5px; line-height: 1.45; }
.login-alert.show { display: flex; animation: login-shake .45s ease; }
.login-alert .bi { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
@keyframes login-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .login-alert.show { animation: none; } }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 2.8rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1.1rem; padding: .4rem .55rem; line-height: 1; }
.pw-toggle:hover { color: var(--gold-dark); }
