/* HUTECH Program — Notion-inspired Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2383e2;
  --primary-hover: #1b6ec2;
  --primary-bg: rgba(35,131,226,0.06);
  --success: #0f7b6c;
  --success-bg: rgba(15,123,108,0.06);
  --warning: #d9730d;
  --warning-bg: rgba(217,115,13,0.06);
  --danger: #e03e3e;
  --danger-bg: rgba(224,62,62,0.06);
  --info: #2383e2;

  --bg: #ffffff;
  --bg-secondary: #f7f7f5;
  --bg-hover: rgba(55,53,47,0.04);
  --bg-active: rgba(55,53,47,0.06);

  --text: #37352f;
  --text-secondary: #37352f;
  --text-muted: #787774;
  --text-light: #a4a4a0;

  --border: rgba(55,53,47,0.09);
  --divider: rgba(55,53,47,0.09);

  --sidebar-w: 240px;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow-sm: rgba(15,15,15,0.04) 0px 0px 0px 1px, rgba(15,15,15,0.03) 0px 3px 6px;
  --shadow-md: rgba(15,15,15,0.04) 0px 0px 0px 1px, rgba(15,15,15,0.03) 0px 3px 6px, rgba(15,15,15,0.06) 0px 9px 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LAYOUT ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 14px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-header h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}
.sidebar-header p { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.nav-section {
  padding: 16px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.1s ease;
  font-size: 13px;
  font-weight: 400;
  border-radius: var(--radius);
  margin: 1px 0;
  user-select: none;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 500;
}
.nav-item .icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.sidebar-user {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-user .user-info { font-size: 12px; }
.sidebar-user .user-name { font-weight: 500; color: var(--text); }
.sidebar-user .user-role { color: var(--text-muted); font-size: 11px; }
.sidebar-user .logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: all 0.15s;
}
.sidebar-user .logout-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 48px;
  max-width: 1100px;
  min-height: 100vh;
}

/* ===== CARDS (no border, no shadow, no background) ===== */
.card {
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.card-body {
  padding: 0;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-secondary);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  opacity: 0.85;
}
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== FORMS ===== */
.input-group {
  margin-bottom: 16px;
}
.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35,131,226,0.12);
}
.input-group input:disabled,
.input-group select:disabled,
.input-group textarea:disabled {
  background: var(--bg-secondary);
  color: var(--text-muted);
}
.input-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  transform: translateY(10px);
  transition: transform 0.15s;
  box-shadow: var(--shadow-md);
}
.modal-overlay.active .modal {
  transform: translateY(0);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
}
.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
}
.modal-body {
  padding: 20px;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
}
.modal-error {
  color: var(--danger);
  font-size: 12px;
  padding: 8px 12px;
  background: var(--danger-bg);
  border-radius: var(--radius);
  display: none;
  margin-bottom: 8px;
}
.modal-error.show { display: block; }

/* ===== TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--divider);
}
.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
  vertical-align: middle;
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: var(--bg-hover);
}

/* ===== BADGE ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 500;
}
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--primary-bg); color: var(--primary); }
.badge-neutral { background: var(--bg-active); color: var(--text-muted); }

/* ===== LOADING ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--divider);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state .icon {
  font-size: 36px;
  margin-bottom: 12px;
}
.empty-state h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state p {
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 400;
  min-width: 260px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  border-left: 3px solid var(--text-muted);
}
.toast.removing { animation: toastOut 0.2s ease forwards; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ===== LOGIN ===== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-secondary);
}
.login-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-sm);
}
.login-box h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.login-box .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.login-box .logo {
  text-align: center;
  font-size: 40px;
  margin-bottom: 12px;
}
.login-error {
  color: var(--danger);
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
}

/* ===== TABS ===== */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-item {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.1s;
  white-space: nowrap;
}
.tab-item:hover {
  color: var(--text);
}
.tab-item.active {
  color: var(--text);
  font-weight: 500;
  border-bottom-color: var(--text);
}

/* ===== TREE / LIST ITEM ===== */
.tree-node {
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius);
  transition: background 0.1s;
}
.tree-node:hover {
  background: var(--bg-hover);
}

/* ===== UTILITY ===== */
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.15); }

/* ===== SELECTION ===== */
::selection { background: rgba(35,131,226,0.2); }
