/* Color Palette */
:root {
  --primary-dark: #1a1a2e;
  --primary-light: #16213e;
  --accent-blue: #0f3460;
  --accent-yellow: #ffc107;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --text-white: #ffffff;
  --text-light: #e0e0e0;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --bg-secondary: #111827;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --radius: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--primary-dark);
  color: var(--text-white);
  line-height: 1.6;
  font-size: 14px;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-secondary);
}

.sidebar {
  width: 280px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  overflow-y: auto;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.main-content {
  margin-left: 280px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
}

.topbar {
  background-color: var(--primary-dark);
  border-bottom: 1px solid var(--border-color);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

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

/* Cards & Boxes */
.card {
  background-color: var(--primary-light);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.card-header {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-white);
}

.card-body {
  color: var(--text-light);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background-color: var(--accent-yellow);
  color: var(--primary-dark);
}

.btn-primary:hover {
  background-color: #ffb300;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background-color: var(--primary-light);
  color: var(--text-white);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #5a3f8f;
}

.btn-danger {
  background-color: #dc3545;
  color: var(--text-white);
}

.btn-danger:hover {
  background-color: #c82333;
}

.btn-success {
  background-color: #28a745;
  color: var(--text-white);
}

.btn-success:hover {
  background-color: #218838;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-white);
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-white);
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-yellow);
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1);
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Checkboxes & Radios */
.checkbox, .radio {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-yellow);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.table thead {
  background-color: rgba(255, 193, 7, 0.1);
}

.table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--accent-yellow);
  border-bottom: 2px solid var(--border-color);
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-light);
}

.table tbody tr:hover {
  background-color: rgba(255, 193, 7, 0.05);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background-color: var(--primary-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-white);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--accent-yellow);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Alerts */
.alert {
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background-color: rgba(40, 167, 69, 0.2);
  border: 1px solid #28a745;
  color: #90ee90;
}

.alert-danger {
  background-color: rgba(220, 53, 69, 0.2);
  border: 1px solid #dc3545;
  color: #ff6b6b;
}

.alert-warning {
  background-color: rgba(255, 193, 7, 0.2);
  border: 1px solid var(--accent-yellow);
  color: var(--accent-yellow);
}

.alert-info {
  background-color: rgba(23, 162, 184, 0.2);
  border: 1px solid #17a2b8;
  color: #5dade2;
}

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

.badge-primary {
  background-color: var(--accent-yellow);
  color: var(--primary-dark);
}

.badge-success {
  background-color: #28a745;
  color: var(--text-white);
}

.badge-danger {
  background-color: #dc3545;
  color: var(--text-white);
}

.badge-warning {
  background-color: #ffc107;
  color: var(--primary-dark);
}

/* Sidebar Navigation */
.nav-menu {
  list-style: none;
}

.nav-item {
  margin-bottom: 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--text-light);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background-color: var(--primary-light);
  color: var(--accent-yellow);
  padding-left: 20px;
}

/* Dashboard Widgets */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.widget {
  background-color: var(--primary-light);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.widget-title {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 10px;
  font-weight: 500;
}

.widget-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-yellow);
}

.widget-icon {
  font-size: 32px;
  color: var(--accent-yellow);
  margin-bottom: 10px;
}

/* Status Indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-online {
  background-color: rgba(40, 167, 69, 0.2);
  color: #90ee90;
}

.status-offline {
  background-color: rgba(108, 117, 125, 0.2);
  color: #adb5bd;
}

.status-idle {
  background-color: rgba(255, 193, 7, 0.2);
  color: var(--accent-yellow);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: #28a745;
}

.status-dot.offline {
  background-color: #6c757d;
}

.status-dot.idle {
  background-color: var(--accent-yellow);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

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

  .content {
    padding: 15px;
  }

  .widget-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: 95%;
  }
}

/* RTL Support */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border-color);
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: 260px;
}

[dir="rtl"] .topbar {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-link {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-link:hover,
[dir="rtl"] .nav-link.active {
  padding-left: 15px;
  padding-right: 20px;
}

[dir="rtl"] .modal-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .modal-footer {
  flex-direction: row-reverse;
}

[dir="rtl"] .alert {
  flex-direction: row-reverse;
}

[dir="rtl"] .checkbox,
[dir="rtl"] .radio {
  flex-direction: row-reverse;
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
  text-align: right;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.d-flex {
  display: flex;
}

.gap-10 {
  gap: 10px;
}

.gap-20 {
  gap: 20px;
}

.justify-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.flex-wrap {
  flex-wrap: wrap;
}

.w-100 {
  width: 100%;
}

.h-100 {
  height: 100%;
}

.opacity-50 {
  opacity: 0.5;
}

.cursor-pointer {
  cursor: pointer;
}

.hidden {
  display: none;
}

.visible {
  display: block;
}
