/* ============================================================
   assets/css/components.css
   Cards, buttons, forms, modals, search, permissions table.
   ============================================================ */

/* ─── CARD ─── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}
.card-title { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--white-dim); }
.card-body  { padding: 16px 20px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'DM Sans',sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 0.5px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-full { width: 100%; justify-content: center; }
.btn-gold {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}
.btn-gold:hover  { background: var(--gold-light); }
.btn-gold:active { background: #B8953E; }
.btn-gold:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border-color: var(--border2);
  color: var(--white-dim);
}
.btn-outline:hover  { background: var(--white-faint); color: var(--white); }
.btn-outline:active { background: rgba(245,242,238,0.12); }

/* ─── FORM FIELDS ─── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--white-dim);
  font-weight: 500;
}
.field input, .field select, .field textarea {
  background: var(--surface2);
  border: 0.5px solid var(--border2);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'DM Sans',sans-serif;
  font-size: 13px;
  color: var(--white);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}
.field input::placeholder, .field textarea::placeholder { color: rgba(245,242,238,0.25); }
.field select option { background: var(--surface2); }
.field textarea { resize: vertical; min-height: 72px; line-height: 1.6; }
.field-hint { font-size: 11px;  color: var(--text-dim, rgba(245, 242, 238, 0.35)); }
.field-error { font-size: 11px; color: var(--error); display: none; }
.field-error.show { display: block; }

/* Light mode field overrides */
body.light .field input, body.light .field select, body.light .field textarea {
  background: #F5F2EE; color: #1A1612; border-color: rgba(26,22,18,0.14);
}
body.light .field input::placeholder, body.light .field textarea::placeholder { color: rgba(26,22,18,0.35); }
body.light .field select option { background: #F5F2EE; color: #1A1612; }

/* ─── SEARCH INPUT ─── */
.search-input-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--white-dim);
  pointer-events: none;
}
.search-input-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border2);
  border-radius: 8px;
  padding: 9px 12px 9px 32px;
  font-family: 'DM Sans',sans-serif;
  font-size: 13px;
  color: var(--white);
  outline: none;
  transition: border-color 0.2s;
}
.search-input-wrap input:focus { border-color: var(--gold-border); }
.search-input-wrap input::placeholder {  color: var(--text-faint, rgba(245, 242, 238, 0.3)); }
body.light .search-input-wrap input { background:#F5F2EE; color:#1A1612; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 0.5px solid var(--border2);
  border-radius: 16px;
  padding: 28px;
  margin: auto;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  font-size: 16px; color: var(--white-dim);
  cursor: pointer; line-height: 1;
  padding: 4px; border-radius: 4px;
}
.modal-close:hover { color: var(--white); }
.modal-title { font-family: 'Cormorant Garamond',serif; font-size: 24px; font-weight: 400; margin-bottom: 4px; }
.modal-sub   { font-size: 12px; color: var(--white-dim); margin-bottom: 20px; line-height: 1.5; }

/* ─── Post reactions ────────────────────────────────────── */
.post-react-btn {
  display:inline-flex;
  align-items:center;
  gap:4px;
  background:transparent;
  border:0.5px solid var(--border2);
  border-radius:16px;
  padding:4px 10px;
  font-size:12px;
  color:var(--white-dim);
  cursor:pointer;
  transition:all 0.15s;
}
.post-react-btn:hover {
  background:var(--white-faint);
  border-color:var(--border);
}
.post-react-btn.reacted {
  background:var(--gold-dim);
  border-color:var(--gold-border);
  color:var(--gold);
}
.react-count {
  font-size:11px;
  font-weight:500;
}

/* ─── News feed ─────────────────────────────────────────── */
#news-feed {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* ─── Post card fixed height truncation ────────────────── */
.news-post .card-body {
  overflow: hidden;
  position: relative;
}
.news-post .card-body::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  pointer-events: none;
}

/* ─── Comment compose ───────────────────────────────────── */
.comment-compose input:focus {
  border-color: var(--gold-border);
}

/* ─── Modal detail ──────────────────────────────────────── */
#postDetailModal .modal-box {
  max-width: 680px;
}

/* ─── Category tags ─────────────────────────────────────── */
.ann-tag.update { background:rgba(46,134,193,0.12); color:#2E86C1; }
.ann-tag.announcement { background:rgba(201,168,76,0.12); color:#C9A84C; }
.ann-tag.milestone { background:rgba(155,89,182,0.12); color:#9B59B6; }
.ann-tag.event { background:rgba(39,174,96,0.12); color:#27AE60; }
.ann-tag.urgent { background:rgba(231,76,60,0.12); color:#E74C3C; }
.ann-tag.policy { background:rgba(149,165,166,0.12); color:#95A5A6; }

/* ─── Comments ───────────────────────────────────────────── */
.comment-item { display:flex; gap:8px; align-items:flex-start; }
.comment-compose { display:flex; gap:8px; align-items:center; }

/* ─── STATUS BADGES ─── */
.leave-status {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px;
}
.leave-status.approved  { background: rgba(39,174,96,0.12);  color: #27AE60; }
.leave-status.pending   { background: rgba(243,156,18,0.12); color: #F39C12; }
.leave-status.rejected  { background: rgba(231,76,60,0.12);  color: #E74C3C; }
.leave-status.cancelled { background: rgba(127,140,141,0.12);color: #95A5A6; }

/* ─── PERMISSIONS TABLE ─── */
.perm-table { width:100%; border-collapse:collapse; font-size:12px; }
.perm-table thead th { padding:10px 12px; background:var(--surface2); font-size:10px; letter-spacing:0.1em; text-transform:uppercase; color:var(--white-dim); position:sticky; top:0; z-index:1; }
.perm-table tbody td { padding:8px 12px; border-bottom:0.5px solid var(--border); }
.perm-section-row td { background:var(--surface3); font-size:9px; font-weight:700; letter-spacing:0.18em; text-transform:uppercase; color:rgba(245,242,238,0.4); padding:6px 12px; }
.perm-key-col { min-width:180px; text-align:left; }
.perm-role-col { min-width:80px; text-align:center; }
.perm-check-cell { text-align:center; }
.perm-check { width:16px; height:16px; accent-color:var(--gold); cursor:pointer; }
.perm-check.admin-locked { opacity:0.5; cursor:not-allowed; }
.perm-key-label { display:block; font-weight:500; }
.perm-key-code  { font-family:'Space Mono',monospace; font-size:9px; color:rgba(245,242,238,0.35); }
.perm-role-label { writing-mode:vertical-rl; text-orientation:mixed; transform:rotate(180deg); font-size:10px; color:var(--white-dim); padding:4px 0; }

/* ─── OVERRIDE ROWS ─── */
.override-row {
  display:flex; align-items:center; gap:10px;
  padding:10px 20px; border-bottom:0.5px solid var(--border);
  flex-wrap:wrap;
}
.override-type-badge { font-size:10px; font-weight:600; padding:3px 9px; border-radius:4px; flex-shrink:0; }
.override-type-badge.grant { background:rgba(39,174,96,0.12); color:#27AE60; }
.override-type-badge.deny  { background:rgba(231,76,60,0.12);  color:#E74C3C; }

/* ─── SEARCH RESULT ROW ─── */
.search-result-row {
  display:flex; align-items:center; gap:10px;
  padding:9px 14px; cursor:pointer;
  border-bottom:0.5px solid var(--border);
  transition:background 0.15s;
}
.search-result-row:hover { background:var(--white-faint); }

/* ─── TOAST ─── */
.email-toast {
  position:fixed; bottom:24px; right:24px;
  background:var(--surface);
  border:0.5px solid var(--border2);
  border-radius:12px;
  padding:14px 18px;
  box-shadow:0 8px 32px rgba(0,0,0,0.4);
  z-index:600;
  max-width:320px;
  animation: toastIn 0.25s ease both;
}
@keyframes toastIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

/* ─── Calendar source filter buttons ────────────────────── */
.cal-src-btn {
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:5px 14px;
  border:0.5px solid var(--border2);
  border-radius:20px;
  background:transparent;
  color:var(--white-dim);
  font-size:12px;
  font-family:'DM Sans',sans-serif;
  cursor:pointer;
  transition:all 0.15s;
  user-select:none;
}
.cal-src-btn:hover {
  border-color:var(--border);
  background:var(--white-faint);
  color:var(--white);
}
.cal-src-btn.active {
  border-color:var(--gold-border);
  background:var(--gold-dim);
  color:var(--gold);
}
.cal-src-btn.active:hover {
  background:var(--gold-dim);
}


/* ─── Nav badge (circular) ──────────────────────────────────── */
.nav-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  background: var(--gold);
  color: #000;
  flex-shrink: 0;
}
.nav-badge.red {
  background: var(--error);
  color: #fff;
}