/* ================================================
   HR CRM — Main CSS Design System
   Xalqaro Mehnat Migratsiya Agentligi
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- Custom Properties ---- */
:root {
  color-scheme: dark;
  /* Colors */
  --color-bg:           hsl(225, 28%, 5%);
  --color-bg-2:         hsl(225, 24%, 8%);
  --color-bg-3:         hsl(225, 20%, 11%);
  --color-surface:      rgba(255, 255, 255, 0.04);
  --color-surface-hover:rgba(255, 255, 255, 0.07);
  --color-border:       rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.16);

  /* Accent */
  --color-primary:      hsl(258, 89%, 66%);
  --color-primary-dark: hsl(258, 89%, 52%);
  --color-primary-glow: hsla(258, 89%, 66%, 0.18);

  /* Semantic */
  --color-success:      hsl(152, 69%, 44%);
  --color-success-bg:   hsla(152, 69%, 44%, 0.12);
  --color-danger:       hsl(0, 72%, 56%);
  --color-danger-bg:    hsla(0, 72%, 56%, 0.12);
  --color-warning:      hsl(43, 96%, 54%);
  --color-warning-bg:   hsla(43, 96%, 54%, 0.12);
  --color-info:         hsl(210, 100%, 60%);
  --color-info-bg:      hsla(210, 100%, 60%, 0.12);

  /* Text */
  --text-primary:   hsl(220, 20%, 95%);
  --text-secondary: hsl(220, 12%, 58%);
  --text-muted:     hsl(220, 12%, 38%);

  /* Spacing */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;
  --space-4: 16px;  --space-5: 20px;  --space-6: 24px;
  --space-8: 32px;  --space-10: 40px; --space-12: 48px;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   22px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg: 0 10px 50px rgba(0,0,0,0.6);

  /* Layout */
  --sidebar-width:     262px;
  --sidebar-collapsed: 68px;
  --header-height:     64px;

  /* Transitions */
  --transition:      0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-hover); }

/* ================================================================
   LAYOUT
   ================================================================ */

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg-2);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  min-height: var(--header-height);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  overflow: hidden;
}

.logo-icon {
  font-size: 26px;
  flex-shrink: 0;
  width: 34px;
  text-align: center;
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6));
}

.logo-text { display: flex; flex-direction: column; overflow: hidden; }
.logo-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.sidebar-toggle {
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--color-surface-hover); }
.sidebar-toggle svg { width: 18px; height: 18px; }

/* Navigation */
.nav-section {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.nav-section:last-child { border-bottom: none; flex: 1; }

.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 var(--space-5) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-3);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link span:not(.nav-badge) { overflow: hidden; text-overflow: ellipsis; flex: 1; }

.nav-link:hover {
  color: var(--text-primary);
  background: var(--color-surface-hover);
}

.nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-glow);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%;
  width: 3px; height: 60%;
  background: var(--color-primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  box-shadow: 0 0 8px var(--color-primary);
}

.nav-badge {
  margin-left: auto;
  background: var(--color-primary-glow);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.nav-badge.danger { background: var(--color-danger-bg); color: var(--color-danger); }

/* Collapsed Sidebar */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-link > span:not(.nav-badge),
.sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-link { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-toggle { display: none; }

/* ---- Main Wrapper ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}
.main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  padding-top: env(safe-area-inset-top);
  height: calc(var(--header-height) + env(safe-area-inset-top));
  background: rgba(8, 9, 16, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.mobile-menu-btn svg { width: 20px; height: 20px; }

.header-search {
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 0 var(--space-4);
  height: 38px;
  transition: all var(--transition);
}
.header-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}
.header-search svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.header-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
}
.header-search input::placeholder { color: var(--text-muted); }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-glow);
  box-shadow: 0 0 12px var(--color-primary-glow);
}
.btn-icon svg { width: 17px; height: 17px; }

.header-date {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.header-date svg { width: 13px; height: 13px; }

/* ---- Content Area ---- */
.content {
  flex: 1;
  padding: var(--space-6);
  animation: fadeIn 0.25s ease;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.page-title {
  font-size: 23px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  cursor: default;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-color, var(--color-primary));
  opacity: 0.8;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 120px; height: 120px;
  border-radius: var(--radius-full);
  background: var(--stat-color, var(--color-primary));
  opacity: 0.04;
}
.stat-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  background: var(--stat-color-bg, var(--color-primary-glow));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 21px; height: 21px; color: var(--stat-color, var(--color-primary)); }
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 25px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.stat-label { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.stat-change {
  font-size: 11.5px; margin-top: 5px;
  display: flex; align-items: center; gap: 4px;
}
.stat-change svg { width: 12px; height: 12px; }
.stat-change.up   { color: var(--color-success); }
.stat-change.down { color: var(--color-danger);  }

/* ---- Responsive ---- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 290;
  animation: fadeIn 0.2s ease;
}

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: translateX(0); }

  .main-wrapper { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .top-header { padding: 0 var(--space-4); }
  .content { padding: var(--space-4); }
  .header-date { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; }
}

@media (max-width: 580px) {
  .header-search { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content { padding: var(--space-3); }
}

/* ================================================================
   Notifications Panel Styles
   ================================================================ */
.notifications-wrapper {
  position: relative;
}
.notifications-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  z-index: 1000;
  margin-top: var(--space-2);
}
.notifications-panel.open {
  display: flex !important;
}
.notif-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
  cursor: pointer;
  font-size: 12.5px;
}
.notif-item:hover {
  background: var(--color-surface-2);
}
.notif-item.unread {
  background: var(--color-primary-glow);
  border-left: 3px solid var(--color-primary);
}
.notif-item-title {
  font-weight: 700;
  color: var(--text-primary);
}
.notif-item-text {
  color: var(--text-secondary);
  line-height: 1.4;
}
.notif-item-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

