/* تنسيقات لوحة تحكم إدارة مصنع أصباغ عُمان */
:root {
  --primary: #000e1d;
  --primary-container: #0f2438;
  --secondary: #00696e;
  --secondary-light: #8df3f9;
  --surface: #fbf9f3;
  --surface-card: #ffffff;
  --surface-low: #f5f3ed;
  --surface-high: #eae8e2;
  --border: #dcdad4;
  --text-main: #1b1c18;
  --text-muted: #43474c;
  --success: #1e7e55;
  --warning: #d07030;
  --danger: #ba1a1a;
  --radius: 12px;
}

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

body {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  background-color: var(--surface);
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
.admin-navbar {
  background: var(--primary);
  color: #fff;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: 0 2px 10px rgba(0, 14, 29, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-badge {
  background: var(--secondary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-tag {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: 13px;
}

.user-tag span:first-child {
  font-weight: 600;
  color: #fff;
}

.user-tag span:last-child {
  font-size: 11px;
  color: #b4c8e3;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* Layout */
.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 24px;
  flex: 1;
}

/* Tabs Navigation */
.tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--secondary);
}

.tab-btn.active {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(15, 36, 56, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-info h3 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-icon.primary { background: #e0f2fe; color: #0369a1; }
.kpi-icon.warning { background: #fef3c7; color: #b45309; }
.kpi-icon.success { background: #dcfce7; color: #15803d; }
.kpi-icon.secondary { background: #ccfbf1; color: #0f766e; }

/* Filter & Action Bar */
.action-bar {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.search-input, .select-filter {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.search-input {
  min-width: 260px;
}

.search-input:focus, .select-filter:focus {
  border-color: var(--secondary);
}

.btn-primary {
  background: var(--secondary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  text-decoration: none;
}

.btn-primary:hover {
  background: #005458;
}

.btn-secondary {
  background: var(--surface-high);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--border);
}

/* Data Table */
.table-wrapper {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(15, 36, 56, 0.04);
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13px;
}

table.admin-table th {
  background: var(--surface-low);
  padding: 14px 16px;
  color: var(--primary);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

table.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

table.admin-table tr:hover {
  background: #faf8f2;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-new { background: #dbeafe; color: #1e40af; }
.badge-in_review { background: #fef3c7; color: #92400e; }
.badge-samples_sent { background: #e0e7ff; color: #3730a3; }
.badge-quoted { background: #f3e8ff; color: #6b21a8; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* Status selector button */
.action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 36, 56, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--surface-card);
  border-radius: 16px;
  max-width: 550px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text-main);
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--secondary);
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: #000e1d;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.login-card {
  background: var(--surface-card);
  border-radius: 20px;
  max-width: 440px;
  width: 100%;
  padding: 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.login-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.demo-credentials {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 20px;
  text-align: right;
  line-height: 1.6;
}

.demo-credentials span {
  font-family: monospace;
  font-weight: 700;
}
