﻿/* ═══════════════════════════════════════════════════════════════
   views.css — هيكل التطبيق المتجاوب + وحدات الواجهة المشتركة
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1.1rem .9rem;
  background: linear-gradient(180deg, #0f172a 0%, #111827 32%, #1e1b4b 100%);
  color: #fff;
  box-shadow: inset -1px 0 0 rgba(148, 163, 184, .15);
  z-index: 40;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem .35rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 1rem;
}

.sidebar-brand {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: .9rem;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(99, 102, 241, .35);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  overflow-y: auto;
  padding-inline-end: .25rem;
}

.nav-label {
  padding: .5rem .7rem;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, .8);
  font-weight: 800;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .72rem .8rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 700;
  color: #dbe4ff;
  transition: all .2s ease;
}

.nav-item::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #818cf8, #ec4899);
  transform: translateY(-50%);
  transition: height .2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
  transform: translateX(-2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(236, 72, 153, .12));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .2);
}

.nav-item.active::before { height: 60%; }

.sidebar-card {
  margin-top: 1rem;
  padding: .85rem .8rem;
  border-radius: .9rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: #e2e8f0;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(4px);
  z-index: 30;
  display: none;
  animation: fadeInSimple .2s ease;
}

.sidebar-overlay.open { display: block; }
@keyframes fadeInSimple { from { opacity: 0; } to { opacity: 1; } }

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

.app-page-title,
.app-header-title {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 900;
  line-height: 1.2;
}

.app-page-subtitle,
.app-header-subtitle {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .76rem;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-inline-start: auto;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .35rem .55rem;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.user-avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 900;
  font-size: .8rem;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-meta strong { font-size: .78rem; }
.user-meta span { font-size: .67rem; color: var(--muted); }

.page-panel {
  background: rgba(255,255,255,.8);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 1.2rem;
  box-shadow: var(--shadow-soft);
  padding: clamp(1rem, 2vw, 1.5rem);
}

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

.eyebrow {
  display: inline-block;
  padding: .28rem .55rem;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: .72rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card {
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow-card);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: .74rem;
  margin-bottom: .5rem;
}

.stat-value {
  display: block;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 900;
  color: var(--ink-soft);
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-top: .55rem;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .28rem .55rem;
}

.stat-trend.up { background: rgba(16,185,129,.08); color: #047857; }
.stat-trend.down { background: rgba(239,68,68,.08); color: #b91c1c; }

.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.list-card,
.chart-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line-light);
}

.list-item:last-child { border-bottom: none; }

.list-meta {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.list-dot {
  width: .8rem;
  height: .8rem;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, .08);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .32rem .6rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
}

.badge.ok { background: rgba(16,185,129,.12); color: #047857; }
.badge.warn { background: rgba(245,158,11,.12); color: #b45309; }
.badge.info { background: rgba(59,130,246,.12); color: #1d4ed8; }

.menu-btn {
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: .75rem;
}

.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tbl th {
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-weight: 700;
  padding: .75rem .65rem;
  text-align: right;
  border-bottom: 2px solid var(--line);
}
.tbl td {
  padding: .75rem .65rem;
  border-bottom: 1px solid var(--line-light);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--bg-soft); }
.tbl-empty { text-align: center; color: var(--muted-light); padding: 2.5rem 0; }

.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.auth-hero {
  display: none;
  background: radial-gradient(circle at 20% 20%, rgba(99,102,241,.8), transparent 35%),
              radial-gradient(circle at 80% 50%, rgba(236,72,153,.7), transparent 35%),
              linear-gradient(135deg, #111827 0%, #1e1b4b 100%);
  color: #fff;
}

.auth-tab {
  flex: 1;
  padding: .65rem;
  font-size: .85rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  transition: all .2s;
  text-align: center;
  background: transparent;
  border: none;
}
.auth-tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.feature-row { display: flex; align-items: flex-start; gap: .85rem; color: #e2e8f0; font-size: .85rem; line-height: 1.6; }
.feature-ico {
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(10px);
  display: grid; place-items: center;
  flex-shrink: 0;
}

.qr-img {
  width: 132px; height: 132px;
  image-rendering: pixelated;
  border-radius: var(--radius);
  background: #fff;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  font-size: 10.5px;
  line-height: 1.7;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  direction: ltr;
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.db-dot { width: .55rem; height: .55rem; border-radius: 9999px; display: inline-block; }
.db-dot-ok   { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, .5); }
.db-dot-bad  { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, .5); }
.db-dot-warn { background: #f59e0b; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(82vw, 18rem);
    z-index: 40;
    transform: translateX(102%);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
}

@media (min-width: 1024px) {
  .menu-btn { display: none; }
  .sidebar-overlay { display: none !important; }
  .auth-wrapper { grid-template-columns: 1fr 1fr; }
  .auth-hero { display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; }
}

@media (max-width: 640px) {
  .app-header { padding: .75rem 1rem; }
  .app-content { padding: 1rem .8rem; }
  .app-header-actions { gap: .45rem; }
  .user-pill { display: none; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .stats-grid, .content-grid { grid-template-columns: 1fr; }

  .tbl-responsive {
    width: 100%;
    border-collapse: collapse;
  }
  .tbl-responsive thead { display: none; }
  .tbl-responsive tbody tr {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    border: 1px solid var(--line-light);
    border-radius: var(--radius-sm);
    padding: .75rem;
    margin-bottom: .75rem;
    background: #fff;
  }
  .tbl-responsive tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border: none;
    font-size: .8rem;
  }
  .tbl-responsive tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--ink-soft);
    min-width: 40%;
  }
  .qr-img { width: 100px; height: 100px; }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1024px) {
  .tbl-responsive thead { display: table-header-group; }
  .tbl-responsive tbody tr { display: table-row; }
  .tbl-responsive tbody td { display: table-cell; }
  .tbl-responsive tbody td::before { content: none; }
}

.hide-mobile { display: none; }
@media (min-width: 641px) { .hide-mobile { display: block; } }

.hide-tablet { display: block; }
@media (min-width: 641px) and (max-width: 1023px) { .hide-tablet { display: none; } }

.hide-desktop { display: block; }
@media (min-width: 1024px) { .hide-desktop { display: none; } }

.show-mobile { display: block; }
@media (min-width: 641px) { .show-mobile { display: none; } }

.show-tablet { display: none; }
@media (min-width: 641px) and (max-width: 1023px) { .show-tablet { display: block; } }

.show-desktop { display: none; }
@media (min-width: 1024px) { .show-desktop { display: block; } }
