/* ── DONA DON HR — Premium Design System ──────────────────────────── */
:root {
  --brand-primary: #0b4021;
  --brand-secondary: #166534;
  --brand-accent: #d97706;
  --brand-success: #22c55e;
  --brand-danger: #ef4444;
  --brand-warning: #f59e0b;
  --brand-info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: .2s ease;
}

[data-theme="light"] {
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-nav: rgba(255,255,255,.85);
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.12);
  --hover: #f1f5f9;
  --input-bg: #ffffff;
  --modal-overlay: rgba(0,0,0,.4);
  --stat-bg: #f8fafc;
}

[data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-card: #1a2332;
  --bg-sidebar: #111827;
  --bg-nav: rgba(15,23,42,.85);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #1e293b;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,.5);
  --hover: #1e293b;
  --input-bg: #0a0f1e;
  --modal-overlay: rgba(0,0,0,.8);
  --stat-bg: #111827;
}

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ── Navbar ───────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background var(--transition), border-color var(--transition);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon { font-size: 24px; }
.brand-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-primary);
  letter-spacing: -.5px;
}
[data-theme="dark"] .brand-text { color: var(--brand-success); }
.brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-accent);
  background: rgba(217,119,6,.15);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-date, .nav-time {
  font-size: 14px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.nav-date { display: none; }
@media (min-width: 640px) { .nav-date { display: inline; } }

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover {
  border-color: var(--brand-accent);
  transform: scale(1.05);
}

/* ── Layout ───────────────────────────────────────────────────────── */
.layout {
  display: flex;
  padding-top: 60px;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: fixed;
  top: 60px;
  bottom: 0;
  overflow-y: auto;
  transition: background var(--transition), border-color var(--transition);
  z-index: 50;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none !important;
}
.sidebar-link:hover {
  background: var(--hover);
  color: var(--text);
}
.sidebar-link.active {
  background: rgba(11,64,33,.12);
  color: var(--brand-primary);
  font-weight: 600;
}
[data-theme="dark"] .sidebar-link.active {
  background: rgba(34,197,94,.12);
  color: var(--brand-success);
}
.sidebar-link .icon { font-size: 18px; }

.content {
  margin-left: 220px;
  flex: 1;
  padding: 24px 28px;
  min-height: 100vh;
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  transition: all var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ── Stat Circles (Premium) ───────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-circle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-circle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.stat-circle.total::before { background: var(--brand-info); }
.stat-circle.ontime::before { background: var(--brand-success); }
.stat-circle.late::before { background: var(--brand-danger); }
.stat-circle.absent::before { background: var(--brand-warning); }

.stat-circle:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-circle .circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 26px;
  font-weight: 800;
  border: 3px solid;
  background: var(--stat-bg);
}

.stat-circle .circle.total { border-color: var(--brand-info); color: var(--brand-info); }
.stat-circle .circle.ontime { border-color: var(--brand-success); color: var(--brand-success); }
.stat-circle .circle.late { border-color: var(--brand-danger); color: var(--brand-danger); }
.stat-circle .circle.absent { border-color: var(--brand-warning); color: var(--brand-warning); }

.stat-circle .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.stat-circle .stat-count {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  margin-top: 2px;
}

/* ── Filters Bar ──────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.filters-bar select, .filters-bar input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filters-bar select:focus, .filters-bar input:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(217,119,6,.15);
}

.filters-bar .search-input {
  flex: 1;
  min-width: 140px;
}

.layout-toggle {
  display: flex;
  gap: 3px;
}

.layout-toggle button {
  padding: 7px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
}
.layout-toggle button.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
[data-theme="dark"] .layout-toggle button.active {
  background: var(--brand-secondary);
}

/* ── Employee Grid ────────────────────────────────────────────────── */
.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.employee-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.employee-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--brand-accent);
}

.employee-card .emp-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.employee-card .emp-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.employee-card .emp-details {
  flex: 1;
  min-width: 0;
}

.employee-card .emp-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-card .emp-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.employee-card .emp-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-top: 4px;
  display: inline-block;
}

.emp-status.ontime { background: rgba(34,197,94,.12); color: var(--brand-success); }
.emp-status.late { background: rgba(239,68,68,.12); color: var(--brand-danger); }
.emp-status.absent { background: rgba(245,158,11,.12); color: var(--brand-warning); }
.emp-status.departed { background: rgba(59,130,246,.12); color: var(--brand-info); }

/* ── Table View ───────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--hover);
}

.data-table tr {
  cursor: pointer;
  transition: background var(--transition);
}

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--border);
  border-radius: var(--radius-xs);
  padding: 2px;
  margin-bottom: 20px;
}

.tab {
  padding: 7px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 5px;
  transition: all var(--transition);
}
.tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none !important;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-secondary); }

.btn-accent { background: var(--brand-accent); color: #fff; }
.btn-accent:hover { opacity: .9; }

.btn-danger { background: var(--brand-danger); color: #fff; }
.btn-danger:hover { opacity: .85; }

.btn-success { background: var(--brand-success); color: #fff; }
.btn-success:hover { opacity: .85; }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--hover); }

.btn-sm { padding: 5px 12px; font-size: 11px; }

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 9px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(217,119,6,.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-overlay);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}

@keyframes modalIn {
  from { transform: scale(.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }

/* ── Employee Detail ──────────────────────────────────────────────── */
.emp-detail-header {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.emp-detail-header img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.emp-detail-header .info h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

.emp-detail-header .info .meta {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ── History ───────────────────────────────────────────────────────── */
.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.history-item:last-child { border-bottom: none; }

.history-item .left { min-width: 0; flex: 1; }
.history-item .right { text-align: right; flex-shrink: 0; }

.history-item .date { font-weight: 600; font-size: 13px; }
.history-item .time { color: var(--text-secondary); font-size: 12px; }
.history-item .fine { color: var(--brand-danger); font-size: 12px; }
.history-item .bonus { color: var(--brand-success); font-size: 12px; }

/* ── Quick Stats in Detail ────────────────────────────────────────── */
.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.detail-stat {
  background: var(--stat-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.detail-stat .value {
  font-size: 18px;
  font-weight: 800;
}

.detail-stat .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Action Bar ───────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── Balance display ──────────────────────────────────────────────── */
.balance-display {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--stat-bg);
  border-radius: var(--radius-sm);
  align-items: center;
}

.balance-display .balance-item {
  font-size: 13px;
}
.balance-display .balance-item strong {
  font-size: 15px;
}

/* ── Subtitle text ─────────────────────────────────────────────────- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 800;
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Inline Form ──────────────────────────────────────────────────── */
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.inline-form input {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 13px;
}

/* ── Loading ──────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ── Badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}

.badge.ontime { background: rgba(34,197,94,.12); color: var(--brand-success); }
.badge.late { background: rgba(239,68,68,.12); color: var(--brand-danger); }
.badge.absent { background: rgba(245,158,11,.12); color: var(--brand-warning); }
.badge.departed { background: rgba(59,130,246,.12); color: var(--brand-info); }

/* ── Tag chips ────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.tag-green { background: rgba(34,197,94,.12); color: var(--brand-success); }
.tag-red { background: rgba(239,68,68,.12); color: var(--brand-danger); }
.tag-gold { background: rgba(217,119,6,.12); color: var(--brand-accent); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
  }
  .sidebar-link {
    font-size: 12px;
    padding: 6px 10px;
  }
  .content {
    margin-left: 0;
    padding: 16px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .employee-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .text { font-size: 14px; }

/* ── Notification toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  animation: slideUp .3s ease;
  font-size: 14px;
  max-width: 360px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
