/* ===================================================================
   Sayyar — Social Committee Hub
   Palette: deep teal (structure) + marigold gold (signature accent)
   Type: Fraunces (display) / Manrope (body & UI)
   =================================================================== */

:root{
  --teal-900:#132B4A;
  --teal-800:#193153;
  --teal-700:#274674;
  --gold-500:#D9A02B;
  --gold-400:#E7B84D;
  --maroon-600:#8C2F39;
  --sand-50:#F7F5EF;
  --sand-100:#EFEADD;
  --ink-900:#1B2320;
  --ink-600:#4C5750;
  --line:#E1DACB;
  --white:#FFFFFF;
  --green-ok:#2E7D5B;
  --red-no:#B23A3A;
  --amber:#C08A1E;
  --radius:14px;
  --shadow:0 4px 18px rgba(15,74,67,0.08);
  --font-display:"Fraunces", Georgia, serif;
  --font-body:"Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:var(--font-body);
  background:var(--sand-50);
  color:var(--ink-900);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{font-family:var(--font-display); margin:0; color:var(--teal-900); font-weight:600;}
.hidden{display:none !important;}
button{font-family:var(--font-body); cursor:pointer;}
input,select,textarea{font-family:var(--font-body);}

/* ---------- Buttons ---------- */
.btn{
  border:none; border-radius:10px; padding:11px 18px; font-size:14.5px; font-weight:700;
  transition:transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active{transform:scale(0.97);}
.btn-primary{background:var(--teal-800); color:var(--sand-50);}
.btn-primary:hover{background:var(--teal-700);}
.btn-secondary{background:var(--gold-500); color:var(--teal-900);}
.btn-secondary:hover{background:var(--gold-400);}
.btn-ghost{background:transparent; color:var(--teal-800); border:1.5px solid var(--line);}
.btn-ghost:hover{background:var(--sand-100);}
.btn-danger{background:var(--red-no); color:#fff;}
.btn-block{width:100%;}
.btn-sm{padding:6px 12px; font-size:13px; border-radius:8px;}

/* ---------- Auth screen ---------- */
.auth-screen{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(circle at 15% 20%, rgba(217,160,43,0.18), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(20,98,90,0.25), transparent 50%),
    var(--teal-900);
  padding:20px;
}
.auth-card{
  background:var(--sand-50); border-radius:20px; padding:44px 40px; width:100%; max-width:400px;
  box-shadow:0 20px 60px rgba(0,0,0,0.35);
}
.auth-brand{text-align:center; margin-bottom:28px;}
.auth-mark{
  width:52px; height:52px; border-radius:14px; background:linear-gradient(140deg,var(--gold-500),var(--gold-400));
  color:var(--teal-900); font-family:var(--font-display); font-weight:700; font-size:26px;
  display:flex; align-items:center; justify-content:center; margin:0 auto 14px;
}
.auth-mark.small{width:34px; height:34px; font-size:17px; border-radius:10px;}
.auth-logo{width:72px; height:72px; border-radius:16px; object-fit:cover; margin:0 auto 14px; display:block; box-shadow:0 6px 18px rgba(19,43,74,0.25);}
.sidebar-logo{width:34px; height:34px; border-radius:9px; object-fit:cover; flex-shrink:0;}
.auth-brand h1{font-size:28px; margin-bottom:4px;}
.auth-brand p{margin:0; color:var(--ink-600); font-size:13.5px;}
.auth-form{display:flex; flex-direction:column; gap:16px; margin-top:8px;}
.auth-form label{display:flex; flex-direction:column; gap:6px; font-size:13px; font-weight:600; color:var(--ink-600);}
.auth-form input{
  padding:12px 14px; border-radius:10px; border:1.5px solid var(--line); font-size:15px; background:#fff;
}
.auth-form input:focus{outline:none; border-color:var(--teal-700);}
.auth-error{color:var(--red-no); font-size:13.5px; min-height:18px; margin:0; text-align:center;}

/* ---------- App shell ---------- */
.app-shell{display:flex; min-height:100vh;}
.sidebar{
  width:230px; background:var(--teal-900); color:var(--sand-50); display:flex; flex-direction:column;
  padding:22px 16px; flex-shrink:0;
}
.sidebar-brand{display:flex; align-items:center; gap:10px; font-family:var(--font-display); font-weight:700; font-size:19px; margin-bottom:28px; padding:0 4px;}
.sidebar-nav{display:flex; flex-direction:column; gap:4px; flex:1;}
.nav-item{
  background:transparent; border:none; color:rgba(247,245,239,0.75); text-align:left; padding:11px 14px;
  border-radius:10px; font-size:14.5px; font-weight:600; transition:background .15s, color .15s;
}
.nav-item:hover{background:rgba(255,255,255,0.06); color:#fff;}
.nav-item.active{background:var(--gold-500); color:var(--teal-900);}
.sidebar-footer{display:flex; flex-direction:column; gap:12px; margin-top:16px; padding-top:16px; border-top:1px solid rgba(255,255,255,0.12);}
.user-chip{display:flex; align-items:center; gap:10px;}
.user-avatar{
  width:36px; height:36px; border-radius:50%; background:var(--teal-700); display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:15px; flex-shrink:0;
}
.user-name{font-size:13.5px; font-weight:700; line-height:1.3;}
.user-role{font-size:11.5px; color:rgba(247,245,239,0.6); text-transform:uppercase; letter-spacing:.04em;}
.sidebar-footer .btn-ghost{color:rgba(247,245,239,0.8); border-color:rgba(255,255,255,0.2);}
.sidebar-footer .btn-ghost:hover{background:rgba(255,255,255,0.08);}

.main-area{flex:1; min-width:0; display:flex; flex-direction:column;}
.topbar{
  height:64px; background:#fff; border-bottom:1px solid var(--line); display:flex; align-items:center; padding:0 28px; gap:14px;
  flex-shrink:0;
}
.topbar-title{font-family:var(--font-display); font-size:20px; font-weight:600; color:var(--teal-900);}
.mobile-menu-btn{display:none; background:none; border:none; font-size:20px;}
.topbar-spacer{flex:1;}
.view-container{padding:28px; overflow-y:auto; flex:1;}
.view-toolbar{display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; flex-wrap:wrap; gap:10px;}

/* ---------- Stats / dashboard ---------- */
.stats-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:24px;}
.stat-card{
  background:#fff; border-radius:var(--radius); padding:18px 20px; box-shadow:var(--shadow); border-left:4px solid var(--gold-500);
}
.stat-card .stat-num{font-family:var(--font-display); font-size:30px; color:var(--teal-900); font-weight:700;}
.stat-card .stat-label{font-size:12.5px; color:var(--ink-600); text-transform:uppercase; letter-spacing:.05em; margin-top:2px;}
.panel{background:#fff; border-radius:var(--radius); padding:20px 22px; box-shadow:var(--shadow);}
.panel-head{margin-bottom:14px;}
.event-list{display:flex; flex-direction:column; gap:10px;}
.event-row{
  display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border:1px solid var(--line);
  border-radius:10px; gap:10px; flex-wrap:wrap;
}
.event-row .ename{font-weight:700; color:var(--teal-900);}
.event-row .emeta{font-size:12.5px; color:var(--ink-600);}

/* ---------- Badges ---------- */
.badge{display:inline-block; padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em;}
.badge-pending{background:#FCEDD0; color:var(--amber);}
.badge-approved, .badge-active, .badge-accepted, .badge-yes{background:#DCF0E6; color:var(--green-ok);}
.badge-rejected, .badge-inactive, .badge-declined, .badge-no{background:#FADADA; color:var(--red-no);}
.badge-sent, .badge-scheduled{background:#DDEBF7; color:#2A6DA3;}

/* ---------- Events grid ---------- */
.events-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(270px,1fr)); gap:16px;}
.event-card{
  background:#fff; border-radius:var(--radius); padding:20px; box-shadow:var(--shadow); cursor:pointer;
  border-top:4px solid var(--teal-700); transition:transform .12s ease, box-shadow .12s ease;
  display:flex; flex-direction:column; gap:10px;
}
.event-card:hover{transform:translateY(-3px); box-shadow:0 10px 26px rgba(15,74,67,0.14);}
.event-card h3{font-size:18px;}
.event-card .ec-meta{font-size:12.5px; color:var(--ink-600);}
.event-card .ec-foot{display:flex; align-items:center; justify-content:space-between; margin-top:auto;}

.event-header-card{
  background:linear-gradient(120deg, var(--teal-900), var(--teal-800)); color:#fff; border-radius:var(--radius);
  padding:24px 26px; margin:14px 0 20px; display:flex; flex-wrap:wrap; gap:16px; align-items:center; justify-content:space-between;
}
.event-header-card h2{color:#fff; font-size:24px;}
.event-header-card .eh-meta{font-size:13px; color:rgba(255,255,255,0.75); margin-top:4px;}
.event-header-card .eh-actions{display:flex; gap:8px; flex-wrap:wrap;}

/* ---------- Tabs ---------- */
.tabs{display:flex; gap:4px; border-bottom:2px solid var(--line); margin-bottom:20px; overflow-x:auto;}
.tab-btn{
  background:none; border:none; padding:11px 16px; font-weight:700; font-size:14px; color:var(--ink-600);
  border-bottom:3px solid transparent; margin-bottom:-2px; white-space:nowrap;
}
.tab-btn.active{color:var(--teal-800); border-color:var(--gold-500);}
.tab-panel{display:none;}
.tab-panel.active{display:block;}

/* ---------- Cards / lists ---------- */
.card-list{display:flex; flex-direction:column; gap:12px;}
.item-card{
  background:#fff; border:1px solid var(--line); border-radius:12px; padding:16px 18px; display:flex; justify-content:space-between;
  align-items:center; gap:14px; flex-wrap:wrap;
}
.item-card .ic-title{font-weight:700; color:var(--teal-900);}
.item-card .ic-sub{font-size:12.5px; color:var(--ink-600); margin-top:2px;}
.item-actions{display:flex; gap:8px; flex-wrap:wrap;}

.chip-row{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px;}
.chip{
  padding:7px 14px; border-radius:20px; background:#fff; border:1.5px solid var(--line); font-size:13px; font-weight:600;
  cursor:pointer;
}
.chip.active{background:var(--teal-800); color:#fff; border-color:var(--teal-800);}

/* ---------- Tables ---------- */
.table-wrap{background:#fff; border-radius:var(--radius); box-shadow:var(--shadow); overflow-x:auto;}
table{width:100%; border-collapse:collapse; font-size:13.5px; min-width:640px;}
thead th{
  text-align:left; padding:12px 16px; background:var(--sand-100); color:var(--teal-900); font-size:11.5px;
  text-transform:uppercase; letter-spacing:.04em; border-bottom:1px solid var(--line); white-space:nowrap;
}
tbody td{padding:12px 16px; border-bottom:1px solid var(--line); vertical-align:middle;}
tbody tr:last-child td{border-bottom:none;}
tbody tr:hover{background:var(--sand-50);}

.expense-summary{display:flex; gap:16px; margin-bottom:18px; flex-wrap:wrap;}
.expense-summary .es-box{background:#fff; border-radius:12px; padding:14px 20px; box-shadow:var(--shadow); min-width:140px;}
.expense-summary .es-num{font-family:var(--font-display); font-size:22px; font-weight:700; color:var(--teal-900);}
.expense-summary .es-label{font-size:11.5px; color:var(--ink-600); text-transform:uppercase;}

/* ---------- Lucky draw wheel ---------- */
.luckydraw-layout{display:flex; gap:32px; flex-wrap:wrap; align-items:flex-start;}
.wheel-wrap{position:relative; width:420px; max-width:100%; flex-shrink:0;}
#wheelCanvas{width:100%; height:auto; display:block; filter:drop-shadow(0 10px 24px rgba(15,74,67,0.25));}
.wheel-pointer{
  position:absolute; top:50%; right:-6px; transform:translateY(-50%); font-size:34px; color:var(--maroon-600);
  text-shadow:0 2px 3px rgba(0,0,0,0.2);
}
.wheel-controls{flex:1; min-width:260px; display:flex; flex-direction:column; gap:14px;}
.winner-banner{
  background:linear-gradient(120deg,var(--gold-500),var(--gold-400)); color:var(--teal-900); border-radius:12px; padding:16px;
  font-weight:800; text-align:center; font-size:18px; font-family:var(--font-display);
}
.add-participant-row{display:flex; gap:8px; flex-wrap:wrap;}
.add-participant-row input{flex:1; min-width:120px; padding:10px 12px; border-radius:9px; border:1.5px solid var(--line);}
.participant-list{display:flex; flex-direction:column; gap:6px; max-height:320px; overflow-y:auto;}
.participant-row{
  display:flex; align-items:center; justify-content:space-between; background:#fff; border:1px solid var(--line);
  border-radius:9px; padding:8px 12px; font-size:13.5px;
}
.participant-row.winner-tag{border-color:var(--gold-500); background:#FEF7E6;}

/* ---------- Modal ---------- */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(11,56,51,0.55); display:flex; align-items:center; justify-content:center;
  padding:20px; z-index:200;
}
.modal{background:#fff; border-radius:16px; padding:26px 28px; width:100%; max-width:480px; max-height:88vh; overflow-y:auto; box-shadow:0 24px 60px rgba(0,0,0,0.3);}
.modal h3{margin-bottom:16px; font-size:19px;}
.form-group{display:flex; flex-direction:column; gap:6px; margin-bottom:14px;}
.form-group label{font-size:13px; font-weight:700; color:var(--ink-600);}
.form-group input, .form-group select, .form-group textarea{
  padding:10px 12px; border-radius:9px; border:1.5px solid var(--line); font-size:14px;
}
.form-group textarea{resize:vertical; min-height:70px;}
.form-row{display:flex; gap:12px;}
.form-row .form-group{flex:1;}
.modal-actions{display:flex; justify-content:flex-end; gap:10px; margin-top:8px;}

/* ---------- Toast ---------- */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--teal-900); color:#fff;
  padding:13px 22px; border-radius:10px; font-size:14px; font-weight:600; box-shadow:0 10px 30px rgba(0,0,0,0.25); z-index:300;
}
.toast.error{background:var(--red-no);}
.toast.success{background:var(--green-ok);}

/* ---------- Utility ---------- */
/* Role-gated elements start hidden via inline style (set in app.js on load),
   not via a CSS class — this avoids the "clearing inline style falls back
   to display:none" bug. Do not add display:none for .admin-only/.committee-only here. */
.empty-state{text-align:center; padding:40px 20px; color:var(--ink-600);}
.empty-state h3{color:var(--ink-600); margin-bottom:6px;}

/* ---------- Responsive ---------- */
@media (max-width:860px){
  .sidebar{position:fixed; left:-240px; top:0; bottom:0; z-index:150; transition:left .2s ease;}
  .sidebar.open{left:0;}
  .mobile-menu-btn{display:block;}
  .view-container{padding:18px;}
  .luckydraw-layout{flex-direction:column; align-items:center;}
}
