/* ====================================================================
   DIAMOND & JEWELLERY JOB WORK ERP - LAYOUT & SHELL
   ==================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* --------------------------------------------------------------------
   SIDEBAR
   -------------------------------------------------------------------- */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--nav-sidebar);
  border-right: 1px solid var(--nav-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform var(--transition-smooth), width var(--transition-smooth);
}

.sidebar-header {
  height: var(--header-height);
  background-color: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.brand-subtitle {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: #2563eb;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.75rem;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.sidebar-nav::-webkit-scrollbar,
.app-sidebar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.nav-group {
  margin-bottom: 1.25rem;
}

.nav-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0 0.75rem 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--nav-text);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover {
  background-color: var(--nav-hover);
  color: var(--nav-text-hover);
}

.nav-item.active {
  background-color: var(--nav-active);
  color: #1d4ed8;
  font-weight: 700;
  border-left: 3px solid #2563eb;
  box-shadow: none;
}

.nav-item.active svg {
  color: #2563eb;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #64748b;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: #dbeafe;
  color: #1e40af;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--nav-border);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0f172a;
}

.user-role {
  font-size: 0.68rem;
  color: #64748b;
}

/* --------------------------------------------------------------------
   MAIN WRAPPER & TOPBAR
   -------------------------------------------------------------------- */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

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

.btn-sidebar-toggle {
  display: none;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.btn-sidebar-toggle:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  width: 280px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

/* --------------------------------------------------------------------
   HEADER TRIAL TIMELINE & SUBSCRIPTION WIDGET
   -------------------------------------------------------------------- */
.header-timeline-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: #334155;
  transition: all var(--transition-fast);
  cursor: pointer;
  user-select: none;
}

.header-timeline-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.header-timeline-pill.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.header-timeline-pill.expired {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #f87171; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.timeline-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.timeline-track {
  width: 55px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.timeline-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.header-timeline-pill.warning .timeline-bar {
  background: #f59e0b;
}

.header-timeline-pill.expired .timeline-bar {
  background: #ef4444;
}

.timeline-btn-renew {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all var(--transition-fast);
}

.timeline-btn-renew:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.header-timeline-pill.expired .timeline-btn-renew {
  background: #dc2626;
}

.pulse-anim {
  animation: pulse-btn 1.5s infinite;
}

@keyframes pulse-btn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.header-search:focus-within {
  background-color: #ffffff;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  width: 320px;
}

.header-search input {
  background: none;
  border: none;
  outline: none;
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-main);
}

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

.badge-live-db {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--success-main);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background-color: #ffffff;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
}

/* --------------------------------------------------------------------
   HEADER TRIAL TIMELINE & SUBSCRIPTION WIDGET
   -------------------------------------------------------------------- */
.header-timeline-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: #334155;
  transition: all var(--transition-fast);
  cursor: pointer;
  user-select: none;
}

.header-timeline-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.header-timeline-pill.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.header-timeline-pill.expired {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #f87171; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.timeline-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.timeline-track {
  width: 55px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.timeline-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.header-timeline-pill.warning .timeline-bar {
  background: #f59e0b;
}

.header-timeline-pill.expired .timeline-bar {
  background: #ef4444;
}

.timeline-btn-renew {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all var(--transition-fast);
}

.timeline-btn-renew:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.header-timeline-pill.expired .timeline-btn-renew {
  background: #dc2626;
}

.pulse-anim {
  animation: pulse-btn 1.5s infinite;
}

@keyframes pulse-btn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.header-icon-btn:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--border-strong);
}

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

/* --------------------------------------------------------------------
   CONTENT AREA
   -------------------------------------------------------------------- */
.app-content {
  flex: 1;
  padding: 1.75rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-default);
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.page-title-group h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.page-title-group p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------
   RESPONSIVE DRAWER & OVERLAY
   -------------------------------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 35;
}

@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .app-main {
    margin-left: 0;
  }

  .btn-sidebar-toggle {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .app-content {
    padding: 1rem;
  }

  .header-search {
    display: none;
  }
}

