/* OEH Admin Theme
   Primary blue: #1434A4 */

:root {
  --primary-color: #1434A4;
  --secondary-color: #1434A4; /* solid theme */
  --sidebar-width: 280px;
  --header-height: 70px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  color: #2c3e50;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--primary-color);
  color: #fff;
  transition: all 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.sidebar.collapsed { width: 80px; }

.sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-header h4 { margin: 0; font-weight: 700; transition: opacity .3s ease; }
.sidebar.collapsed .sidebar-header h4 { opacity: 0; }

.sidebar-nav { padding: 20px 0; }
.nav-item { margin-bottom: 5px; }
.nav-link {
  color: rgba(255,255,255,.85);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: all .25s ease;
  border-left: 3px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.12);
  border-left-color: #fff;
}
.nav-link i { font-size: 1.2rem; margin-right: 15px; min-width: 20px; }
.sidebar.collapsed .nav-link span { opacity: 0; }

/* Main layout */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left .3s ease;
}
.sidebar.collapsed + .main-content { margin-left: 80px; }

.header {
  background: #fff;
  padding: 15px 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; }
.breadcrumb { background: none; padding: 0; margin: 0; }
.breadcrumb-item a { color: var(--primary-color); text-decoration: none; }

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #666;
  margin-right: 15px;
  padding: 8px;
  border-radius: 6px;
  transition: all .2s ease;
}
.sidebar-toggle:hover { background-color: #f1f3f5; color: var(--primary-color); }

.header-right { display: flex; align-items: center; gap: 15px; }
.user-dropdown .dropdown-toggle { background: none; border: none; padding: 8px; border-radius: 50px; }
.user-dropdown .dropdown-toggle:hover { background: #f8f9fa; }

.content-area { padding: 30px; }

/* Cards */
.card { border: none; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,.08); transition: transform .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.card-header { background: var(--primary-color); color: #fff; border-radius: 15px 15px 0 0 !important; border: none; padding: 16px 20px; }

/* Buttons */
.btn-primary { background: var(--primary-color); border: none; border-radius: 10px; padding: 10px 20px; font-weight: 600; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(20,52,164,.35); background: #0F2A83; }
.btn-outline-primary { color: var(--primary-color); border-color: var(--primary-color); }
.btn-outline-primary:hover { color: #fff; background: var(--primary-color); border-color: var(--primary-color); }

/* Forms */
.form-control, .form-select { border: 2px solid #e9ecef; border-radius: 10px; padding: 12px 15px; }
.form-control:focus, .form-select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 .2rem rgba(20,52,164,.25); }

/* Alerts */
.alert { border: none; border-radius: 10px; padding: 15px 20px; }

/* Tables */
.table { border-radius: 10px; overflow: hidden; }
.table th { background: #f8f9fa; border: none; font-weight: 600; color: #495057; padding: 15px; }
.table td { border: none; padding: 15px; vertical-align: middle; }

/* Modals */
.modal-content { border: none; border-radius: 15px; }
.modal-header { border-bottom: 1px solid #e9ecef; border-radius: 15px 15px 0 0; }

/* Badges */
.badge { font-size: .75rem; padding: 5px 10px; border-radius: 20px; }

/* Misc */
.loading { text-align: center; padding: 50px; }
.spinner-border { color: var(--primary-color); }

/* Stat cards */
.stat-card { background: #fff; border-radius: 15px; padding: 25px; text-align: center; transition: all .2s ease; border: none; box-shadow: 0 5px 15px rgba(0,0,0,.08); }
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(0,0,0,.15); }
.stat-icon { font-size: 2.5rem; margin-bottom: 15px; display: block; }
.stat-value { font-size: 2rem; font-weight: 700; margin-bottom: 5px; color: #2c3e50; }
.stat-label { color: #7f8c8d; font-size: .9rem; text-transform: uppercase; letter-spacing: .5px; }

/* Enhanced Mobile-first design */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .content-area { padding: 16px 12px; }
  .header { padding: 12px 16px; }
  .sidebar-toggle { margin-right: 10px; }
  .card { border-radius: 12px; }
  
  /* Prevent horizontal scrolling */
  body, html {
    overflow-x: hidden;
  }
  
  /* Mobile table improvements */
  .table-responsive {
    border: none;
    overflow: hidden !important; /* Prevent horizontal scroll */
  }
  
  /* Hide desktop table on mobile completely */
  .desktop-table {
    display: none !important;
  }
  
  /* Show mobile cards on mobile */
  .mobile-cards {
    display: block !important;
  }
  
  /* Stack form filters vertically on mobile */
  .mobile-stack .col-md-2,
  .mobile-stack .col-md-1 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 15px;
  }
  
  /* Larger touch targets for mobile */
  .btn-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  /* Better modal sizing */
  .modal-dialog {
    margin: 20px;
    max-width: calc(100% - 40px);
  }
  
  /* Compact pagination */
  .pagination-sm .page-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* Extra mobile optimizations for very small screens */
@media (max-width: 576px) {
  .content-area { padding: 12px 8px; }
  
  /* Ensure no horizontal scrolling */
  * {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* User cards for mobile view */
  .user-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    width: 100%;
    overflow: hidden;
  }
  
  .user-card .user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }
  
  .user-card .user-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 6px;
    margin-top: 12px;
  }
  
  .user-card .user-actions .btn {
    font-size: 0.75rem;
    padding: 6px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Compact filters for mobile */
  .filter-compact {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  .filter-row {
    display: flex;
    gap: 8px;
  }
  
  .filter-row .form-control,
  .filter-row .form-select {
    flex: 1;
    font-size: 14px;
    padding: 8px 12px;
    min-width: 0; /* Prevent overflow */
  }
  
  /* Hide certain badges on very small screens to save space */
  .user-card .badge {
    font-size: 0.65rem;
    padding: 3px 6px;
  }
}

/* Medium screens - tablet view */
@media (min-width: 769px) and (max-width: 991px) {
  .mobile-cards {
    display: block !important;
  }
  
  .desktop-table {
    display: none !important;
  }
  
  .user-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
  }
}

/* Large screens and up - show full table */
@media (min-width: 992px) {
  .mobile-cards {
    display: none !important;
  }
  
  .desktop-table {
    display: block !important;
  }
}

/* Touch-friendly improvements */
.btn-group .btn {
  touch-action: manipulation;
}

/* Better focus states for mobile */
@media (hover: none) {
  .btn:hover {
    transform: none;
  }
  
  .card:hover {
    transform: none;
  }
}

/* Loading states */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Search highlight */
.search-highlight {
  background-color: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
}

/* Quick search enhancements */
#quickSearch {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#quickSearch:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(20, 52, 164, 0.25);
}

#clearSearch {
  background: transparent;
  border: none;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s ease;
}

#clearSearch:hover {
  color: #dc3545;
}

/* Smooth transitions for filtered rows */
#usersTable tbody tr,
.user-card {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#usersTable tbody tr[style*="display: none"],
.user-card[style*="display: none"] {
  opacity: 0;
  transform: scale(0.98);
}

/* Accessibility focus */
*:focus-visible { outline: 3px solid rgba(20,52,164,.4); outline-offset: 2px; }

/* =======================
   MOBILE-FIRST APP DESIGN
   ======================= */

/* User Cards - App-like Design */
.user-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0,0,0,0.06);
}

.user-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #f8f9fa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
}

.user-actions .btn {
  flex: 1;
  min-width: 40px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.user-actions .btn:active {
  transform: scale(0.95);
}

/* Filter Compact Design */
.filter-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-compact .form-control,
.filter-compact .form-select {
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  padding: 10px 14px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.filter-compact .form-control:focus,
.filter-compact .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(20, 52, 164, 0.1);
}

/* Mobile Cards View */
.mobile-cards {
  display: block;
  padding: 0;
}

@media (min-width: 768px) {
  .mobile-cards {
    display: none !important;
  }
  .desktop-table {
    display: block !important;
  }
}

@media (max-width: 767.98px) {
  .mobile-cards {
    display: block !important;
  }
  .desktop-table {
    display: none !important;
  }
}

/* App-like Buttons */
.btn {
  border-radius: 12px;
  font-weight: 500;
  padding: 10px 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #1434A4 0%, #0f2875 100%);
  box-shadow: 0 4px 12px rgba(20, 52, 164, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(20, 52, 164, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Cards with Modern Shadows */
.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-header {
  background: linear-gradient(135deg, #1434A4 0%, #0f2875 100%);
  color: white;
  border: none;
  padding: 20px;
}

.card-body {
  padding: 20px;
}

/* Stats Display */
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  color: #6c757d;
  font-size: 0.75rem;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges - Modern Design */
.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.3px;
}

/* Pagination - Touch Friendly */
.pagination {
  gap: 4px;
}

.page-link {
  border-radius: 10px;
  border: none;
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  transition: all 0.2s ease;
  color: #495057;
  background: #f8f9fa;
}

.page-link:hover {
  background: #e9ecef;
  color: var(--primary-color);
  transform: translateY(-2px);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, #1434A4 0%, #0f2875 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(20, 52, 164, 0.3);
}

/* Table - Enhanced Mobile */
.table {
  margin-bottom: 0;
}

.table thead th {
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  color: #6c757d;
  padding: 16px;
}

.table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
  background: #f8f9fa;
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.table td {
  padding: 16px;
  vertical-align: middle;
}

/* Loading Indicator */
#loadingIndicator {
  background: rgba(255, 255, 255, 0.95);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

/* Modal Enhancements */
.modal-content {
  border: none;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
  border-bottom: 1px solid #f0f0f0;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1434A4 0%, #0f2875 100%);
  color: white;
  border-radius: 20px 20px 0 0;
}

.modal-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid #f0f0f0;
  padding: 16px 24px;
}

/* Form Controls - Modern */
.form-control,
.form-select {
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  padding: 12px 16px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(20, 52, 164, 0.1);
}

.form-label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

/* Alert Styles */
.alert {
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Mobile Optimizations */
@media (max-width: 767.98px) {
  .card-header {
    padding: 16px;
  }
  
  .card-body {
    padding: 16px;
  }
  
  .modal-content {
    margin: 0.5rem;
    border-radius: 16px;
  }
  
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .badge {
    font-size: 0.7rem;
    padding: 4px 10px;
  }
  
  /* Stack stats on mobile */
  .row.text-center .col-6 {
    margin-bottom: 12px;
  }
  
  /* Touch-friendly table */
  .table td {
    padding: 12px 8px;
    font-size: 14px;
  }
  
  /* Better button groups on mobile */
  .btn-group {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .btn-sm {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* Pull to Refresh Effect */
.refresh-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: white;
  padding: 12px 24px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
  z-index: 9998;
}

.refresh-indicator.show {
  transform: translateX(-50%) translateY(0);
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1434A4 0%, #0f2875 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(20, 52, 164, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px rgba(20, 52, 164, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

@media (min-width: 768px) {
  .fab {
    display: none;
  }
}

/* Smooth Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-card,
.card {
  animation: slideInUp 0.3s ease forwards;
}

.user-card:nth-child(1) { animation-delay: 0.05s; }
.user-card:nth-child(2) { animation-delay: 0.1s; }
.user-card:nth-child(3) { animation-delay: 0.15s; }
.user-card:nth-child(4) { animation-delay: 0.2s; }
.user-card:nth-child(5) { animation-delay: 0.25s; }

/* Search Enhancements */
#quickSearch {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#quickSearch:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(20, 52, 164, 0.25);
}

#clearSearch {
  background: transparent;
  border: none;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s ease;
}

#clearSearch:hover {
  color: #dc3545;
}

/* Smooth transitions for filtered rows */
#usersTable tbody tr,
.user-card {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#usersTable tbody tr[style*="display: none"],
.user-card[style*="display: none"] {
  opacity: 0;
  transform: scale(0.98);
}

