@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@300;400;500;600;700&display=swap");

:root {
  --primary-color: #0b1f3a; /* Navy Blue */
  --secondary-color: #173b6c;
  --accent-color: #007aff; /* iOS Blue */
  --bg-color: #f2f2f7; /* iOS Light Gray Background */
  --surface-color: rgba(255, 255, 255, 0.75); /* Glassmorphism base */
  --text-primary: #1c1c1e;
  --text-secondary: #8e8e93;
  --danger-color: #ff3b30; /* iOS Red */
  --success-color: #34c759; /* iOS Green */
  --warning-color: #ff9500; /* iOS Orange */
  --border-radius: 18px;
  --glass-blur: blur(20px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.5);
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.04);
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Noto Sans Arabic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  direction: rtl;
  line-height: 1.6;
  padding-bottom: 80px; /* Space for mobile nav */
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--surface-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--border-radius);
  border: var(--glass-border);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Desktop Sidebar */
.sidebar {
  width: 280px;
  background: var(--surface-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: var(--glass-border);
  padding: 30px 20px;
  position: fixed;
  height: 100vh;
  right: 0;
  top: 0;
  box-shadow: var(--shadow-soft);
  z-index: 100;
}

.sidebar .brand {
  text-align: center;
  margin-bottom: 40px;
}

.sidebar .brand h2 {
  color: var(--primary-color);
  font-size: 20px;
  font-weight: 700;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text-primary);
  border-radius: 14px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.sidebar-nav a i {
  width: 30px;
  font-size: 18px;
  color: var(--secondary-color);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 15px rgba(11, 31, 58, 0.2);
}

.sidebar-nav a:hover i,
.sidebar-nav a.active i {
  color: #fff;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-right: 280px;
  padding: 30px;
}

/* Top Header in Main Content */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.top-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
}

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

.user-profile .avatar {
  width: 45px;
  height: 45px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Mobile Bottom Nav (iOS Floating Style) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 30px;
  padding: 10px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  border: var(--glass-border);
}

.mobile-nav-items {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  transition: all 0.2s;
  padding: 5px;
}

.mobile-nav-item i {
  font-size: 22px;
  margin-bottom: 5px;
}

.mobile-nav-item.active {
  color: var(--primary-color);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  padding: 24px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: rgba(11, 31, 58, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary-color);
  margin-left: 20px;
}

.stat-details h3 {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-details p {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Forms & Inputs - iOS Style */
.form-group {
  margin-bottom: 20px;
}

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

.form-control {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  transition: all 0.3s;
  font-family: "Noto Sans Arabic", sans-serif;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Prevent iOS Zoom on Inputs */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  font-size: 16px !important;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  text-decoration: none;
  font-family: "Noto Sans Arabic", sans-serif;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(11, 31, 58, 0.2);
}

.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(11, 31, 58, 0.3);
}

.btn-accent {
  background: var(--accent-color);
  color: white;
}
.btn-danger {
  background: var(--danger-color);
  color: white;
}
.btn-success {
  background: var(--success-color);
  color: white;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: right;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

th {
  background: rgba(0, 0, 0, 0.02);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
}

tbody tr {
  transition: background 0.2s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.9);
}

td {
  color: var(--text-primary);
  font-size: 15px;
}

/* Action Icons */
.actions a {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
  text-decoration: none;
  transition: all 0.2s;
  background: rgba(0, 0, 0, 0.03);
}

.actions a.view {
  color: var(--accent-color);
}
.actions a.edit {
  color: var(--warning-color);
}
.actions a.delete {
  color: var(--danger-color);
}

.actions a:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: scale(1.05);
}

/* Status Badges */
.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active {
  background: rgba(52, 199, 89, 0.15);
  color: var(--success-color);
}
.badge-inactive {
  background: rgba(255, 59, 48, 0.15);
  color: var(--danger-color);
}

/* Responsive Adjustments */
@media (max-width: 991px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-right: 0;
    padding: 15px;
    padding-bottom: 100px; /* Space for bottom nav */
    width: 100%;
    max-width: 100vw;
  }

  .glass-card {
    padding: 15px;
    border-radius: 16px;
  }

  .glass-card .table-responsive {
    margin: 0 -15px;
    width: calc(100% + 30px);
    padding: 0 15px;
    border-radius: 0;
  }

  .mobile-bottom-nav {
    display: block;
  }

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

  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .top-header .user-profile {
    align-self: flex-end;
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .mobile-bottom-nav,
  .top-header .user-profile,
  .btn,
  .actions {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .glass-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: transparent !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}
