/*
 * custom.css - component vocabulary for the Warkop Fun portal.
 * The colors below repeat the Tailwind tokens in app/partials/head.php (handoff section 3).
 * If a token changes, change it in both places. Pages use token classes and these
 * components only, never raw colors.
 */
:root {
  --brand-accent: #0B6B4A;
  --brand-accent-hover: #D4A62A;
  --brand-deep: #084C35;
  --surface-base: #F8F9FB;
  --surface-raised: #FFFFFF;
  --surface-sidebar: #F2F4F7;
  --border-subtle: #E1E4E9;
  --text-primary: #1B2420;
  --text-secondary: #4D5A53;
  --text-muted: #7C877F;
  --status-active: #4F9D6E;
  --status-warning: #C79A4B;
  --status-danger: #D2685F;
  --status-neutral: #7C877F;
  --radius-card: 14px;
  --radius-control: 10px;
  --sidebar-w: 17rem;
}

[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }

:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 2px;
}

/* ---------- cards ---------- */
.app-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(27, 36, 32, 0.04);
}
.app-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
.app-card-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.app-card-body { padding: 1.25rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.btn-primary { color: #fff; background-color: var(--brand-accent); }
.btn-secondary { color: var(--text-primary); background-color: var(--surface-raised); border-color: var(--border-subtle); }
.btn-secondary:hover:not(:disabled) { background-color: var(--surface-sidebar); }
.btn-danger { color: #fff; background-color: var(--status-danger); }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-sm { min-height: 2rem; padding: 0.25rem 0.75rem; font-size: 0.8125rem; }

/* Green button that sweeps to gold on hover. */
.accent-hover {
  color: #fff;
  background-color: var(--brand-accent);
  background-image: linear-gradient(90deg, var(--brand-accent-hover) 0%, var(--brand-accent-hover) 50%, var(--brand-accent) 50%, var(--brand-accent) 100%);
  background-size: 200% 100%;
  background-position: 100% 0;
  transition: background-position 0.35s ease, color 0.35s ease;
}
.accent-hover:hover:not(:disabled) {
  background-position: 0 0;
  color: var(--brand-deep);
}
a.accent-hover:hover { background-position: 0 0; color: var(--brand-deep); }

/* ---------- forms ---------- */
.form-label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.form-hint { margin-top: 0.25rem; font-size: 0.75rem; color: var(--text-muted); }
.form-input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(11, 107, 74, 0.15); }
.form-input[readonly], .form-input:disabled { background: var(--surface-base); color: var(--text-secondary); cursor: not-allowed; }
.form-input.is-invalid { border-color: var(--status-danger); }
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(210, 104, 95, 0.18); }
.form-error { margin-top: 0.25rem; font-size: 0.8125rem; color: var(--status-danger); }
.input-affix { position: relative; }
.input-affix .form-input { padding-right: 2.75rem; }
.input-affix-btn {
  position: absolute; top: 0; right: 0; bottom: 0; width: 2.75rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: transparent; border: 0; cursor: pointer;
}
.input-affix-btn:hover { color: var(--brand-accent); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius-control); border: 1px solid; font-size: 0.875rem; line-height: 1.4; }
.alert-success { border-color: color-mix(in srgb, var(--status-active) 40%, white); background: color-mix(in srgb, var(--status-active) 12%, white); color: color-mix(in srgb, var(--status-active) 55%, var(--text-primary)); }
.alert-warning { border-color: color-mix(in srgb, var(--status-warning) 45%, white); background: color-mix(in srgb, var(--status-warning) 14%, white); color: color-mix(in srgb, var(--status-warning) 45%, var(--text-primary)); }
.alert-danger  { border-color: color-mix(in srgb, var(--status-danger) 40%, white); background: color-mix(in srgb, var(--status-danger) 11%, white); color: color-mix(in srgb, var(--status-danger) 60%, var(--text-primary)); }
.alert-info    { border-color: var(--border-subtle); background: var(--surface-base); color: var(--text-secondary); }

/* ---------- pill badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.125rem 0.625rem; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.25rem; white-space: nowrap;
}
.badge::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: currentColor; }
.badge-active  { background: color-mix(in srgb, var(--status-active) 14%, white);  color: color-mix(in srgb, var(--status-active) 60%, var(--text-primary)); }
.badge-warning { background: color-mix(in srgb, var(--status-warning) 16%, white); color: color-mix(in srgb, var(--status-warning) 45%, var(--text-primary)); }
.badge-danger  { background: color-mix(in srgb, var(--status-danger) 13%, white);  color: color-mix(in srgb, var(--status-danger) 60%, var(--text-primary)); }
.badge-neutral { background: color-mix(in srgb, var(--status-neutral) 14%, white); color: var(--text-secondary); }

/* ---------- data tables ---------- */
.table-scroll {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--surface-raised) 30%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, var(--surface-raised) 30%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(27, 36, 32, 0.16), rgba(27, 36, 32, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(27, 36, 32, 0.16), rgba(27, 36, 32, 0)) right center;
  background-repeat: no-repeat;
  background-color: var(--surface-raised);
  background-size: 2.5rem 100%, 2.5rem 100%, 0.875rem 100%, 0.875rem 100%;
  background-attachment: local, local, scroll, scroll;
}
.data-table { width: 100%; min-width: 36rem; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  padding: 0.75rem 1rem; text-align: left; white-space: nowrap;
  font-size: 0.8125rem; font-weight: 700; color: var(--text-secondary);
  background: var(--surface-sidebar); border-bottom: 1px solid var(--border-subtle);
}
.data-table td { padding: 0.75rem 1rem; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-sidebar) 55%, transparent); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

/* ---------- dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 2rem 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--border-subtle); border-radius: var(--radius-card);
  background: var(--surface-base); color: var(--text-secondary);
  transition: border-color 0.2s, background-color 0.2s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand-accent); background: color-mix(in srgb, var(--brand-accent) 6%, white); }
.dropzone-icon { font-size: 1.75rem; color: var(--brand-accent); }
.dropzone-title { font-weight: 700; color: var(--text-primary); }
.dropzone-hint { font-size: 0.8125rem; color: var(--text-muted); }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  display: flex; flex-direction: column;
  width: var(--sidebar-w); max-width: 85vw;
  background: var(--surface-sidebar); border-right: 1px solid var(--border-subtle);
  transform: translateX(-100%); transition: transform 0.25s ease;
  overflow-y: auto;
}
.sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(27, 36, 32, 0.25); }
.sidebar-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(27, 36, 32, 0.45); }
@media (min-width: 1024px) {
  .sidebar { position: sticky; height: 100vh; transform: none; flex-shrink: 0; box-shadow: none; }
  .sidebar-overlay { display: none !important; }
}
.sidebar-group-label { padding: 0 0.875rem; margin: 1.25rem 0 0.375rem; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.875rem; margin-bottom: 0.125rem;
  border-radius: var(--radius-control);
  font-size: 0.9rem; font-weight: 600; color: var(--text-secondary);
  transition: background-color 0.2s, color 0.2s;
}
.sidebar-link i { width: 1.25rem; text-align: center; }
a.sidebar-link:hover { background: color-mix(in srgb, var(--brand-accent) 9%, transparent); color: var(--brand-accent); }
.sidebar-link-active, a.sidebar-link-active:hover {
  color: #fff;
  background: linear-gradient(90deg, var(--brand-accent) 0%, var(--brand-deep) 100%);
  box-shadow: inset 3px 0 0 var(--brand-accent-hover);
}
.sidebar-link-disabled { color: var(--text-muted); cursor: not-allowed; }
.sidebar-soon { margin-left: auto; padding: 0 0.5rem; border-radius: 9999px; border: 1px solid var(--border-subtle); font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); background: var(--surface-raised); }

/* ---------- topbar, avatar, dropdown ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 0.75rem;
  height: 3.75rem; padding: 0 1rem;
  background: var(--surface-raised); border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 640px) { .topbar { padding: 0 1.5rem; } }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px; flex-shrink: 0;
  background: var(--brand-accent); color: #fff; font-size: 0.8125rem; font-weight: 700;
}
.dropdown-menu {
  position: absolute; z-index: 45; margin-top: 0.5rem; min-width: 13rem; padding: 0.375rem;
  background: var(--surface-raised); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control); box-shadow: 0 10px 30px rgba(27, 36, 32, 0.12);
}
.dropdown-item {
  display: flex; align-items: center; gap: 0.625rem; width: 100%;
  padding: 0.5rem 0.75rem; border: 0; border-radius: 8px; background: transparent;
  font-size: 0.875rem; font-weight: 500; text-align: left; color: var(--text-primary); cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-sidebar); color: var(--brand-accent); }
.dropdown-item i { width: 1rem; text-align: center; color: var(--text-muted); }
.dropdown-item-danger:hover, .dropdown-item-danger:hover i { color: var(--status-danger); }
.dropdown-divider { height: 1px; margin: 0.375rem 0; background: var(--border-subtle); }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(27, 36, 32, 0.5); }
.modal-panel {
  position: relative; width: 100%; max-width: 28rem; max-height: calc(100vh - 2rem); overflow-y: auto;
  background: var(--surface-raised); border-radius: var(--radius-card);
  box-shadow: 0 20px 50px rgba(27, 36, 32, 0.25);
}
.modal-header { padding: 1.25rem 1.25rem 0; font-size: 1.0625rem; font-weight: 700; color: var(--text-primary); }
.modal-body { padding: 0.75rem 1.25rem 1.25rem; font-size: 0.9rem; color: var(--text-secondary); }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.875rem 1.25rem; border-top: 1px solid var(--border-subtle); background: var(--surface-base); border-radius: 0 0 var(--radius-card) var(--radius-card); }
.modal-icon-danger { display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; margin-bottom: 0.75rem; border-radius: 9999px; background: color-mix(in srgb, var(--status-danger) 14%, white); color: var(--status-danger); }

/* ---------- pager ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.875rem 1.25rem; border-top: 1px solid var(--border-subtle); font-size: 0.8125rem; color: var(--text-secondary); }
.pager-buttons { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pager-btn {
  min-width: 2.25rem; min-height: 2.25rem; padding: 0 0.625rem;
  border: 1px solid var(--border-subtle); border-radius: 8px;
  background: var(--surface-raised); color: var(--text-primary); font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--brand-accent); color: var(--brand-accent); }
.pager-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pager-btn-active, .pager-btn-active:hover:not(:disabled) { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; }

/* ---------- toasts ---------- */
.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 70; display: flex; flex-direction: column; gap: 0.5rem; width: min(22rem, calc(100vw - 2rem)); }
.toast { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius-control); border: 1px solid var(--border-subtle); background: var(--surface-raised); box-shadow: 0 10px 30px rgba(27, 36, 32, 0.15); font-size: 0.875rem; color: var(--text-primary); animation: toast-in 0.2s ease; }
.toast i { margin-top: 0.125rem; }
.toast-success i { color: var(--status-active); }
.toast-danger i { color: var(--status-danger); }
.toast-warning i { color: var(--status-warning); }
.toast-info i { color: var(--text-muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }

/* ---------- login panel ---------- */
.auth-panel {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(150deg, var(--brand-deep) 0%, var(--brand-accent) 100%);
}
.auth-panel-watermark { position: absolute; right: -4rem; bottom: -3rem; width: 26rem; max-width: none; opacity: 0.09; pointer-events: none; }

/* ---------- utilities ---------- */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
