/* Numetrix ERP - Əsas Dizayn Sistemi & Qlobal Stillər */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Brend Rəngləri - Numetrix Yaşıl */
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-300: #6ee7b7;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669; /* Əsas Rəng */
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;
  --primary-glow: rgba(16, 185, 129, 0.25);

  /* Neytral Rənglər */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;
  --sidebar-border: #1e293b;

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

  --border-color: #e2e8f0;
  --border-focus: #10b981;

  /* Status Rəngləri */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;

  /* Həndəsə və Kölgələr */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 290px;
  --header-height: 68px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: block;
  overflow-x: hidden;
}

/* Scrollbar dizaynı */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Layout Qovşağı */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* SİDEBAR (Yan Menyu) */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  transition: all var(--transition-normal);
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(16, 185, 129, 0.4));
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-title {
  color: #ffffff;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-brand-title span {
  color: var(--primary-400);
}

.sidebar-brand-subtitle {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text);
  font-weight: 600;
}

.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.85rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

/* 3 SƏVİYYƏLİ AKKORDEON DROPDOWN SİSTEMİ */
/* Səviyyə 1: Modul */
.nav-module-item {
  margin-bottom: 0.25rem;
}

.nav-module-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-module-btn:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--sidebar-text-hover);
}

.nav-module-item.active > .nav-module-btn {
  background: rgba(16, 185, 129, 0.12);
  color: var(--primary-400);
}

.nav-module-btn-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-text);
  transition: color var(--transition-fast);
}

.nav-module-btn:hover .nav-icon,
.nav-module-item.active .nav-icon {
  color: var(--primary-400);
}

.nav-chevron {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-normal);
  color: #64748b;
}

.nav-module-item.open > .nav-module-btn .nav-chevron {
  transform: rotate(90deg);
  color: var(--primary-400);
}

/* Submodul Menyu Qutusu (Səviyyə 2 konteyneri) */
.nav-submodule-container {
  display: none;
  padding-left: 1.25rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  margin-left: 1.35rem;
  margin-top: 0.2rem;
  margin-bottom: 0.35rem;
}

.nav-module-item.open > .nav-submodule-container {
  display: block;
}

/* Səviyyə 2: Submodul (Kartlar, Əməliyyatlar, Hesabat) */
.nav-submodule-group {
  margin-bottom: 0.2rem;
}

.nav-submodule-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

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

.nav-submodule-group.active > .nav-submodule-btn {
  color: var(--primary-300);
  font-weight: 700;
}

.nav-submodule-group.open > .nav-submodule-btn .sub-chevron {
  transform: rotate(90deg);
  color: var(--primary-400);
}

.sub-chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #64748b;
}

/* Səviyyə 3: Alt Submodul Səhifələri (Xammal, Hazır məhsul, Qəbzlər və s.) */
.nav-leaf-container {
  display: none;
  padding-left: 0.75rem;
  margin-left: 0.5rem;
  border-left: 1px dashed rgba(255, 255, 255, 0.14);
  margin-top: 0.2rem;
  margin-bottom: 0.4rem;
}

.nav-submodule-group.open > .nav-leaf-container {
  display: block;
}

.nav-leaf-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.65rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-leaf-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.07);
  padding-left: 0.85rem;
}

.nav-leaf-link.active {
  color: #34d399;
  background-color: rgba(16, 185, 129, 0.16);
  font-weight: 600;
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #64748b;
  transition: background-color var(--transition-fast);
}

.nav-leaf-link:hover .nav-dot,
.nav-leaf-link.active .nav-dot {
  background-color: #34d399;
}

/* Sidebar Footer (Lisenziya & Dəstək) */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  background-color: rgba(15, 23, 42, 0.95);
}

.license-mini-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(15, 23, 42, 0.5));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.license-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.license-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  background-color: var(--primary-500);
  color: #ffffff;
  text-transform: uppercase;
}

.support-email-link {
  color: #94a3b8;
  font-size: 0.72rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color var(--transition-fast);
}

.support-email-link:hover {
  color: var(--primary-300);
}

/* ƏSAS MƏZMUN SAHƏSİ */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Yuxarı Header Bar */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.header-search {
  position: relative;
  max-width: 320px;
  width: 100%;
  min-width: 140px;
  flex: 1;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  background-color: #f8fafc;
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary-500);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.header-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 16px;
  height: 16px;
}

.header-company-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background-color: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-800);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-action-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.header-action-btn:hover {
  background-color: var(--bg-body);
  color: var(--primary-600);
  border-color: var(--primary-300);
}

.header-badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger);
  border: 2px solid #ffffff;
}

.header-user-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
  user-select: none;
  flex-shrink: 0;
}

.header-user-profile:hover {
  background-color: var(--bg-body);
  border-color: var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* İstifadəçi menyusu dropdown popover */
.header-user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 210px;
  z-index: 250;
  overflow: hidden;
  animation: slideUp 0.15s ease-out;
}

.header-user-dropdown.show {
  display: block;
}

/* SƏHİFƏ İÇƏRİYİ KONTEYNERİ */
.page-content {
  flex: 1;
  padding: 1.5rem 1.75rem 3rem 1.75rem;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  min-width: 0;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.785rem;
  color: var(--text-light);
}

.page-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.page-breadcrumbs a:hover {
  color: var(--primary-600);
}

.breadcrumb-separator {
  color: #cbd5e1;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.page-actions-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Responsive header elementləri */
@media (max-width: 1280px) {
  .header-btn-text {
    display: none;
  }
}

@media (max-width: 1024px) {
  .header-company-badge {
    display: none;
  }
  .app-sidebar {
    position: fixed;
    left: -290px;
  }
  .app-sidebar.show {
    left: 0;
  }
  .page-content {
    padding: 1.25rem;
  }
}

@media (max-width: 800px) {
  .header-user-text {
    display: none;
  }
  .header-search {
    max-width: 180px;
  }
}

/* WINDOWS DESKTOP MDI PƏNCƏRƏ REJİMİ (İframe daxilində tam ekran tətbiq görünüşü) */
html.in-window-mode,
html.in-window-mode body {
  background: var(--bg-body, #f8fafc) !important;
  overflow-x: hidden;
}

html.in-window-mode .app-sidebar,
html.in-window-mode .app-header {
  display: none !important;
}

html.in-window-mode .app-main {
  margin-left: 0 !important;
  width: 100% !important;
  min-height: 100vh !important;
}

html.in-window-mode .page-content {
  padding: 0.85rem 1.25rem 2rem 1.25rem !important;
  max-width: 100% !important;
}

html.in-window-mode .page-header-row {
  margin-bottom: 0.85rem !important;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

html.in-window-mode .page-title {
  font-size: 1.25rem !important;
}

/* Modul daxili lent naviqasiyası (Desktop Ribbon / Toolbar) */
.module-ribbon-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
}

.module-ribbon-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-right: 0.75rem;
  margin-right: 0.5rem;
  border-right: 1px solid var(--border-color, #e2e8f0);
}

.module-ribbon-group:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.module-ribbon-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light, #94a3b8);
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.module-ribbon-btn {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted, #64748b);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.module-ribbon-btn:hover {
  background: var(--bg-body, #f1f5f9);
  color: var(--primary, #10b981);
}

.module-ribbon-btn.active {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
  font-weight: 700;
}

/* ===================================================
   DESKTOP WINDOW / EMBEDDED MODE (Clean Window View)
   =================================================== */
html.in-window-mode .app-header,
html.in-window-mode .app-sidebar,
body.is-embedded .app-header,
body.is-embedded .app-sidebar,
body.in-window .app-header,
body.in-window .app-sidebar {
  display: none !important;
}

html.in-window-mode body,
body.is-embedded,
body.in-window {
  background: #f8fafc !important;
}

html.in-window-mode .app-main,
body.is-embedded .app-main,
body.in-window .app-main {
  margin-left: 0 !important;
  width: 100% !important;
  padding: 0 !important;
}

html.in-window-mode .page-content,
body.is-embedded .page-content,
body.in-window .page-content {
  padding: 1rem !important;
  max-width: 100% !important;
}

html.in-window-mode .app-container,
body.is-embedded .app-container,
body.in-window .app-container {
  display: block !important;
}


