/* Prime Connect Services - Enterprise UI Design System */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #0ea5e9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --primary-navy: #0f172a;
  --primary-navy-surface: #1e293b;
  --accent-teal: #0ea5e9;
  --accent-teal-hover: #0284c7;
  --accent-cyan: #06b6d4;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;

  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-subtle: #1f2937;
  --bg-hover: #1f2937;
  --border-color: #374151;
  --border-focus: #38bdf8;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  --primary-navy: #030712;
  --primary-navy-surface: #111827;
  --accent-teal: #38bdf8;
  --accent-teal-hover: #0ea5e9;
  --accent-cyan: #22d3ee;

  --success: #34d399;
  --success-bg: #064e3b;
  --success-text: #a7f3d0;

  --warning: #fbbf24;
  --warning-bg: #78350f;
  --warning-text: #fde68a;

  --danger: #f87171;
  --danger-bg: #7f1d1d;
  --danger-text: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
}

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

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary-navy);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 10px 12px 4px;
}

.nav-module {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.nav-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 10px 5px;
  margin-top: 2px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-module-header:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.06);
}

.nav-module-chevron {
  width: 13px;
  height: 13px;
  opacity: 0.7;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.nav-module.collapsed .nav-module-chevron {
  transform: rotate(-90deg);
}

.nav-module-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-module.collapsed .nav-module-items {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.25), rgba(14, 165, 233, 0.1));
  border-left: 3px solid #0ea5e9;
  font-weight: 600;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.nav-link.active svg {
  opacity: 1;
  stroke: #38bdf8;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.top-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.clock-display {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  background-color: var(--bg-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.clock-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--border-color);
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-teal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.admin-name {
  font-weight: 600;
  color: var(--text-main);
}

.admin-role {
  font-size: 11px;
  color: var(--accent-teal);
  font-weight: 700;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Page Container */
.page-container {
  padding: 28px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.page-description {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Cards & Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtext {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Tables */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background-color: var(--bg-subtle);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-in {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-out {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-active {
  background-color: var(--success-bg);
  color: var(--success-text);
}

.badge-inactive {
  background-color: var(--danger-bg);
  color: var(--danger-text);
}

.badge-super {
  background-color: rgba(14, 165, 233, 0.15);
  color: var(--accent-teal);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-admin {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-hr {
  background-color: rgba(139, 92, 246, 0.14);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-teal);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-teal-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

/* Form inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.form-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Alert Banner */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Tabs System */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 11px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.tab-btn.active {
  color: var(--accent-teal);
  border-bottom-color: var(--accent-teal);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Profile Layout */
.profile-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 20px;
}

.profile-avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent-teal);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-initials {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.info-item {
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* Attendance & Calendar KPI Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 4px 0;
  line-height: 1.15;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 540px;
  padding: 20px 24px;
  box-shadow: var(--shadow-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid var(--border-color);
}

.calendar-day-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calendar-day-card[onclick]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.main-content {
  min-width: 0;
}

.split-dashboard-grid>.card,
.split-dashboard-grid>div {
  min-width: 0;
}

.split-dashboard-grid .data-table th,
.split-dashboard-grid .data-table td {
  padding: 10px 10px;
}

@media (max-width: 1024px) {
  .split-dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .nav-section-label {
    width: 100%;
    padding: 4px 8px 2px;
  }

  .nav-module {
    width: 100%;
  }

  .nav-module-items {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-module.collapsed .nav-module-items {
    display: none;
  }

  .sidebar-nav a {
    margin-bottom: 0;
    padding: 8px 10px;
    font-size: 13px;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }

  .top-header {
    padding: 0 12px;
    gap: 8px;
  }

  .clock-display {
    display: none;
  }

  .content-body {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}