/* Pharmacy 7 Payroll — Main Stylesheet */

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

:root {
  --blue:       #2563EB;
  --blue-dark:  #1D4ED8;
  --blue-light: #DBEAFE;
  --navy:       #1E293B;
  --slate:      #475569;
  --muted:      #94A3B8;
  --border:     #E2E8F0;
  --bg:         #F8FAFC;
  --white:      #FFFFFF;
  --green:      #16A34A;
  --green-bg:   #DCFCE7;
  --red:        #DC2626;
  --red-bg:     #FEE2E2;
  --amber:      #D97706;
  --amber-bg:   #FEF3C7;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,0.1);
}

body { font-family: "Segoe UI", system-ui, sans-serif; font-size: 15px;
       color: var(--navy); background: var(--bg); line-height: 1.5; }

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

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; background: var(--navy); color: #E2E8F0;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 100vh;
  height: 100dvh;
}
.sidebar-logo {
  padding: 20px 16px; font-size: 16px; font-weight: 700;
  color: white; border-bottom: 1px solid rgba(255,255,255,0.1);
  line-height: 1.3; flex-shrink: 0;
}
.sidebar-logo span { font-size: 11px; font-weight: 400;
                     color: var(--muted); display: block; }
.sidebar nav { flex: 1; padding: 12px 0; overflow-y: auto; min-height: 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: #CBD5E1; font-size: 14px;
  transition: background 0.15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(255,255,255,0.1); color: white; text-decoration: none;
}
.sidebar nav a.active { border-left: 3px solid var(--blue); }
.sidebar-section {
  padding: 4px 16px; font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 12px;
}
.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px; color: var(--muted); flex-shrink: 0;
}
.sidebar-footer a { color: var(--muted); }
.sidebar-footer a:hover { color: white; }

.main-content {
  margin-left: 220px; flex: 1; display: flex; flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 18px; font-weight: 600; color: var(--navy); }
.page-content { padding: 24px; flex: 1; }

/* ── Cards ── */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px;
              color: var(--navy); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
}
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: white; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #B91C1C; }
.btn-success { background: var(--green); color: white; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500;
              color: var(--slate); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; color: var(--navy);
  background: white; transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--blue); }
select.form-control { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 32px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg); padding: 10px 14px; text-align: left;
  font-weight: 600; color: var(--slate); border-bottom: 2px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
thead th:hover { background: var(--border); }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #F1F5F9; }
tbody td { padding: 10px 14px; vertical-align: middle; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px;
         border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge-blue   { background: var(--blue-light); color: #1E40AF; }
.badge-green  { background: var(--green-bg);  color: #14532D; }
.badge-red    { background: var(--red-bg);    color: #7F1D1D; }
.badge-amber  { background: var(--amber-bg);  color: #78350F; }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-gray   { background: #F1F5F9; color: var(--slate); }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius);
         font-size: 14px; margin-bottom: 16px; }
.alert-success { background: var(--green-bg); color: #14532D; }
.alert-error   { background: var(--red-bg);   color: #7F1D1D; }
.alert-warning { background: var(--amber-bg); color: #78350F; }
.alert-info    { background: var(--blue-light); color: #1E40AF; }

/* ── Login page ── */
.login-page { min-height: 100vh; background: var(--navy);
              display: flex; align-items: center; justify-content: center; }
.login-card { background: white; border-radius: 12px; padding: 40px;
              width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; color: var(--navy); }
.login-logo p  { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
              gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border: 1px solid var(--border);
             border-radius: var(--radius); padding: 16px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500;
              text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--navy);
              margin-top: 4px; }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Sections ── */
.section-header { display: flex; align-items: center; justify-content: space-between;
                  margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 600; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Employee list sections ── */
.emp-section-header {
  padding: 8px 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--bg); color: var(--slate); border-bottom: 1px solid var(--border);
}
.emp-row-inactive td { color: var(--muted); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 12px; padding: 28px;
         width: 100%; max-width: 520px; max-height: 90vh;
         overflow-y: auto; position: relative; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--muted);
}

/* ── Tabs ── */
.tabs { border-bottom: 1px solid var(--border); margin-bottom: 20px;
        display: flex; gap: 0; }
.tab-btn {
  padding: 10px 20px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--slate); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue);
                  font-weight: 600; }
.tab-btn:hover { color: var(--navy); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Pending badge on nav ── */
.nav-badge {
  background: var(--red); color: white; border-radius: 99px;
  font-size: 11px; padding: 1px 6px; margin-left: auto;
}

/* ── Calendar ── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day-hdr { text-align: center; padding: 8px; font-size: 12px;
               font-weight: 600; color: var(--slate); background: var(--bg); }
.cal-cell { background: white; border: 1px solid var(--border);
            min-height: 100px; padding: 6px; border-radius: 4px; }
.cal-cell.today { border-color: var(--blue); }
.cal-cell.other-month { background: var(--bg); opacity: 0.6; }
.cal-day-num { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cal-day-num.today-num { color: var(--blue); }
.cal-chip { font-size: 11px; padding: 2px 6px; border-radius: 3px;
            margin-bottom: 2px; white-space: nowrap; overflow: hidden;
            text-overflow: ellipsis; display: block; }

/* ── Responsive ── */
/* ── Hamburger button ── */
.hamburger {
  display: none;
  justify-content: center; align-items: center;
  width: 48px; height: 48px; min-width: 48px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; flex-shrink: 0;
  font-size: 26px; color: var(--navy); line-height: 1;
}

/* ── Sidebar overlay (mobile backdrop) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 99;
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar {
    transform: translateX(-100%); transition: transform 0.25s ease;
    z-index: 100;
    /* Ensure sidebar fits within visible screen on mobile */
    width: 260px;
    height: 100vh;
    height: 100svh;
    display: flex; flex-direction: column;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .sidebar nav { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
  .sidebar nav a { padding: 13px 16px; font-size: 15px; }
  .sidebar-footer { flex-shrink: 0; padding: 16px; }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .card { padding: 16px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .d-flex.gap-2 { flex-wrap: wrap; }
  .modal { width: calc(100vw - 32px) !important; max-width: 100% !important; margin: 16px; }
}

/* ── Utility ── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; } .gap-2 { gap: 8px; } .align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── Mobile payroll card view ─────────────────────────────────────────────── */
/* Desktop: show table, hide cards */
.payroll-card-list { display: none !important; }
.payroll-table-wrap { display: block !important; }

/* Mobile only: hide table, show cards */
@media (max-width: 768px) {
  .payroll-table-wrap { display: none !important; }
  .payroll-card-list  { display: block !important; }
}

.pr-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.pr-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.pr-card-week {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.pr-card-hours {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}
.pr-card-total {
  font-size: 18px;
  font-weight: 700;
  color: var(--green);
}
.pr-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 12px;
  font-size: 12px;
  border-top: 0.5px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}
.pr-card-grid-label { color: var(--muted); }
.pr-card-grid-val   { text-align: right; color: var(--slate); font-weight: 500; }
.pr-card-actions    { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 0.5px solid var(--border); }
