:root {
  --bg-main: #0B111E;
  --bg-card: #131E32;
  --bg-sidebar: #0E1626;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #00E5C4;
  --primary: #00E5C4;
  --primary-hover: #00BFA5;
  --accent: #3B82F6;
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  --radius: 12px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0, 229, 196, 0.1);
  border: 1px solid var(--primary);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
}

.version-badge {
  font-size: 0.75rem;
  background: rgba(0, 229, 196, 0.15);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 196, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #0B111E;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Layout */
.app-container {
  display: flex;
  min-height: calc(100vh - 74px);
}

.app-sidebar {
  width: 340px;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: calc(100vh - 74px);
  position: sticky;
  top: 74px;
  overflow-y: auto;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 12px;
  font-size: 1rem;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.7rem 2.6rem 0.7rem 1rem;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
}

.filter-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.role-pill {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.role-pill:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.role-pill.active {
  background: rgba(0, 229, 196, 0.15);
  color: var(--primary);
  border-color: var(--primary);
}

.nav-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-item.active {
  background-color: rgba(0, 229, 196, 0.1);
  color: var(--primary);
  border-color: rgba(0, 229, 196, 0.3);
}

/* Content Area */
.app-content {
  flex: 1;
  padding: 2.5rem 3.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.content-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.content-card h1 {
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.content-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

.content-card p {
  margin-bottom: 1.2rem;
  font-size: 1.02rem;
  color: #CBD5E1;
}

.content-card ul, .content-card ol {
  margin-right: 1.5rem;
  margin-bottom: 1.5rem;
  color: #CBD5E1;
}

.content-card li {
  margin-bottom: 0.5rem;
}

/* Image Snapshot Styling */
.doc-image-container {
  margin: 1.8rem 0;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 229, 196, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
  cursor: zoom-in;
}

.doc-image-container:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.doc-image {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
  background: #060A12;
}

.doc-image-caption {
  padding: 0.8rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(11, 17, 30, 0.95);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Lightbox Modal */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  position: relative;
  text-align: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border: 1px solid var(--primary);
}

.lightbox-caption {
  margin-top: 1rem;
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  left: 0;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s;
}

.lightbox-close:hover {
  color: var(--primary);
}

/* Callouts / Alerts */
.callout {
  padding: 1.2rem 1.5rem;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  border-right: 4px solid var(--accent);
  margin: 1.5rem 0;
}

.callout-ai {
  background: rgba(0, 229, 196, 0.1);
  border-right-color: var(--primary);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #fff;
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

th, td {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border-color);
  text-align: right;
}

th {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--primary);
  font-weight: 700;
}

/* Responsive */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .app-content {
    padding: 1.5rem;
  }
}
