/* ===========================================
   COMMON CSS — Employee Task ERP
   =========================================== */

/* CSS Variables */
:root {
  --primary:        #2563EB;
  --primary-dark:   #1D4ED8;
  --primary-light:  #EFF6FF;
  --primary-100:    #DBEAFE;
  --secondary:      #64748B;
  --success:        #10B981;
  --success-light:  #ECFDF5;
  --warning:        #F59E0B;
  --warning-light:  #FFFBEB;
  --danger:         #EF4444;
  --danger-light:   #FEF2F2;
  --info:           #3B82F6;

  --bg:             #F1F5F9;
  --surface:        #FFFFFF;
  --surface-2:      #F8FAFC;
  --border:         #E2E8F0;
  --border-dark:    #CBD5E1;

  --text:           #1E293B;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;

  --sidebar-width:  240px;
  --navbar-height:  64px;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow:         0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition:     150ms ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: .9375rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ===========================================
   APP LAYOUT
   =========================================== */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.app-container { display: flex; flex: 1; padding-top: var(--navbar-height); }
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.75rem;
  min-height: calc(100vh - var(--navbar-height));
  overflow-x: hidden;
}

/* ===========================================
   NAVBAR
   =========================================== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-brand {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.0625rem; font-weight: 700; color: var(--primary);
  width: var(--sidebar-width); flex-shrink: 0;
  text-decoration: none;
}
.navbar-brand:hover { text-decoration: none; }
.navbar-logo {
  width: 34px; height: 34px;
  background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: .875rem; flex-shrink: 0;
}
.navbar-spacer { flex: 1; }
.navbar-actions { display: flex; align-items: center; gap: .75rem; }
.navbar-user {
  display: flex; align-items: center; gap: .625rem;
  padding: .375rem .75rem; border-radius: var(--radius);
  cursor: default; transition: background var(--transition);
}
.navbar-user:hover { background: var(--bg); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .875rem; flex-shrink: 0;
}
.navbar-user-info { line-height: 1.25; }
.navbar-user-name { font-size: .875rem; font-weight: 600; color: var(--text); }
.navbar-user-role { font-size: .725rem; color: var(--text-muted); text-transform: capitalize; }

/* ===========================================
   SIDEBAR
   =========================================== */
.sidebar {
  position: fixed; top: var(--navbar-height); left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 1rem 0;
  z-index: 90;
}
.sidebar-label {
  font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: .625rem 1.25rem;
  margin-top: .25rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .625rem 1.25rem;
  color: var(--text-secondary); font-size: .875rem; font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-link:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.sidebar-link.active { color: var(--primary); background: var(--primary-light); border-left-color: var(--primary); }
.sidebar-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-divider { border: none; border-top: 1px solid var(--border); margin: .5rem 0; }

/* ===========================================
   PAGE HEADER
   =========================================== */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.4375rem; font-weight: 700; color: var(--text); }
.page-header p { color: var(--text-muted); margin-top: .25rem; font-size: .875rem; }
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
}

/* ===========================================
   CARDS
   =========================================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text); }

/* Stat Cards */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; margin-bottom: .75rem;
}
.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-success { background: var(--success-light); color: var(--success); }
.stat-icon-warning { background: var(--warning-light); color: var(--warning); }
.stat-icon-danger  { background: var(--danger-light);  color: var(--danger);  }
.stat-card-label {
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: .375rem;
}
.stat-card-value { font-size: 1.875rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card-sub { font-size: .8125rem; color: var(--text-muted); margin-top: .25rem; }

/* ===========================================
   GRID
   =========================================== */
.grid    { display: grid; gap: 1rem; }
.grid-2  { grid-template-columns: repeat(2, 1fr); }
.grid-3  { grid-template-columns: repeat(3, 1fr); }
.grid-4  { grid-template-columns: repeat(4, 1fr); }

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  padding: .5rem 1rem;
  font-size: .875rem; font-weight: 500;
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap; line-height: 1;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary  { background: var(--primary);  color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled)  { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success  { background: var(--success);  color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled)  { background: #059669; border-color: #059669; }
.btn-danger   { background: var(--danger);   color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled)   { background: #DC2626; border-color: #DC2626; }
.btn-warning  { background: var(--warning);  color: #fff; border-color: var(--warning); }
.btn-warning:hover:not(:disabled)  { background: #D97706; border-color: #D97706; }
.btn-secondary { background: var(--bg); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled)  { background: var(--primary-light); }
.btn-ghost    { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled)    { background: var(--bg); }
.btn-sm  { padding: .3125rem .625rem; font-size: .8125rem; }
.btn-lg  { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .5rem; width: 34px; height: 34px; }

/* ===========================================
   FORMS
   =========================================== */
.form-group { margin-bottom: 1rem; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label {
  display: block; font-size: .875rem; font-weight: 500;
  color: var(--text); margin-bottom: .375rem;
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-label-hint { display: block; font-size: .75rem; font-weight: 400; color: var(--text-muted); margin-top: .1rem; }
.form-control {
  width: 100%; padding: .5rem .75rem;
  font-size: .875rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg); cursor: not-allowed; opacity: .7; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-hint  { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: .25rem; }

/* ===========================================
   TABLE
   =========================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  text-align: left; font-size: .725rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); padding: .75rem 1rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-2);
}
.table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===========================================
   BADGES
   =========================================== */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  border-radius: 100px; white-space: nowrap;
}
.badge-primary   { background: var(--primary-100);   color: var(--primary-dark); }
.badge-success   { background: var(--success-light);  color: #065F46; }
.badge-warning   { background: var(--warning-light);  color: #92400E; }
.badge-danger    { background: var(--danger-light);   color: #991B1B; }
.badge-secondary { background: var(--bg); color: var(--secondary); }
.badge-pending     { background: var(--warning-light); color: #92400E; }
.badge-in_progress { background: var(--primary-100);  color: var(--primary-dark); }
.badge-completed   { background: var(--success-light); color: #065F46; }

/* ===========================================
   MODAL
   =========================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  opacity: 0; visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(16px); transition: transform 200ms ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 680px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.0625rem; font-weight: 600; color: var(--text); }
.modal-close {
  width: 30px; height: 30px; border: none; background: none;
  color: var(--text-muted); font-size: 1.25rem; cursor: pointer;
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
  display: flex; gap: .75rem; justify-content: flex-end;
}

/* ===========================================
   TOAST
   =========================================== */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  display: flex; align-items: center; gap: .625rem;
  padding: .75rem 1rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; color: white;
  box-shadow: var(--shadow-md);
  transform: translateX(120%); transition: transform 300ms ease;
  max-width: 340px; min-width: 220px;
}
.toast.show { transform: translateX(0); }
.toast-icon  { flex-shrink: 0; opacity: .9; display: flex; align-items: center; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  flex-shrink: 0; background: none; border: none;
  color: rgba(255,255,255,.7); font-size: 1.125rem;
  cursor: pointer; padding: 0; line-height: 1;
  transition: color var(--transition); margin-left: .125rem;
}
.toast-close:hover { color: white; }
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info    { background: var(--primary); }

/* ===========================================
   SPINNER / LOADING
   =========================================== */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: white; border-radius: 50%;
  animation: spin .65s linear infinite;
}
.spinner-dark { border-color: var(--border); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state, .empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3rem; color: var(--text-muted);
  text-align: center; gap: .625rem;
}
.empty-state-icon  { font-size: 2.25rem; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }

/* ===========================================
   UTILITIES
   =========================================== */
.d-flex    { display: flex; }
.flex-col  { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: .8125rem; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 250ms ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header-row { flex-direction: column; align-items: flex-start; }
  .modal { max-width: 100%; }
}

/* ===========================================
   SCROLLBAR
   =========================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }

/* ===========================================
   FOCUS VISIBLE (Accessibility)
   =========================================== */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn:focus-visible, a:focus-visible { border-radius: var(--radius); }

/* ===========================================
   SKELETON LOADER
   =========================================== */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text  { height: 13px; width: 100%; margin-bottom: .5rem; }
.skeleton-title { height: 18px; width: 60%; margin-bottom: .75rem; }
.skeleton-box   { height: 80px; }

/* ===========================================
   HAMBURGER & MOBILE SIDEBAR OVERLAY
   =========================================== */
.hamburger-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; background: none;
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  margin-right: .5rem;
}
.hamburger-btn:hover { background: var(--bg); color: var(--text); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 89; cursor: pointer;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
}

/* ===========================================
   CARD HOVER (for interactive cards)
   =========================================== */
.card-hover {
  transition: transform var(--transition), box-shadow var(--transition);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ===========================================
   SMOOTH SCROLL
   =========================================== */
html { scroll-behavior: smooth; }

/* ===========================================
   SWEETALERT2 CUSTOM POPUP
   =========================================== */
.swal2-container { z-index: 9999 !important; }
.swal2-backdrop-show { background: rgba(15,23,42,.45) !important; backdrop-filter: blur(3px); }

.swal-custom-popup {
  border-radius: 16px !important;
  padding: 2rem 1.75rem 1.5rem !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 6px 20px rgba(0,0,0,.1) !important;
  max-width: 420px !important;
  width: 92vw !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  border: 1px solid #E2E8F0 !important;
}

.swal2-html-container { margin: 0 !important; padding: 0 !important; overflow: visible !important; }

.swal-custom-actions {
  gap: .625rem !important;
  margin-top: 1.375rem !important;
  padding: 0 !important;
  justify-content: center !important;
}

.swal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.375rem;
  padding: 0 1.25rem;
  font-size: .875rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  font-family: 'Inter', sans-serif;
  letter-spacing: .01em;
  min-width: 96px;
}
.swal-btn:active { transform: scale(.97); }
.swal-btn:focus-visible { outline: 2px solid #93C5FD; outline-offset: 2px; }

.swal-btn-confirm {
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.swal-btn-cancel {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}
.swal-btn-cancel:hover { background: #E2E8F0; color: #1E293B; }
