/* RABIX (RFMS PRO) Enterprise Design System */
:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-emerald: #10b981;
  --accent-blue: #0ea5e9;
  --accent-purple: #8b5cf6;
  --accent-sky: #38bdf8;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-family: 'Tajawal', 'Outfit', sans-serif;
}

body.light-theme {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent-emerald: #059669;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.layout-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: 280px;
  background-color: var(--bg-card);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 20px;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-emerald), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  display: block;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.role-selector-card {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--accent-emerald);
  padding: 12px;
  border-radius: var(--radius-md);
}

.role-badge {
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 700;
  margin-bottom: 8px;
}

.btn-role-switch {
  width: 100%;
  background: var(--accent-emerald);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  border-right: 4px solid var(--accent-emerald);
  color: var(--accent-emerald);
}

.badge-count {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  display: block;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-header {
  height: 70px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.search-bar-container {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  width: 420px;
  gap: 10px;
}

.global-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 13px;
}

.search-shortcut {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

.btn-ai-trigger {
  background: linear-gradient(135deg, var(--accent-emerald), var(--accent-blue));
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.content-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.page-section.hidden {
  display: none;
}

.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-h1 {
  font-size: 24px;
  font-weight: 800;
}

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

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.metric-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

.metric-icon.blue { color: var(--accent-blue); }
.metric-icon.emerald { color: var(--accent-emerald); }
.metric-icon.sky { color: var(--accent-sky); }
.metric-icon.purple { color: var(--accent-purple); }

.metric-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric-footer {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-footer.positive { color: var(--accent-emerald); }

.charts-two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.data-table th, .data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
}

.plan-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.plan-badge.enterprise { background: rgba(139, 92, 246, 0.2); color: var(--accent-purple); }
.plan-badge.pro { background: rgba(14, 165, 233, 0.2); color: var(--accent-blue); }
.plan-badge.starter { background: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 600px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-messages-container {
  height: 350px;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  max-width: 85%;
}

.chat-bubble.assistant {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  align-self: flex-start;
}

.chat-bubble.user {
  background: var(--accent-blue);
  color: white;
  align-self: flex-end;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.chat-input-bar {
  display: flex;
  gap: 10px;
}

.chat-input-bar input {
  flex: 1;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent-emerald);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
}
