/*
 * Modern Admin Panel CSS
 * Theme: Dark sidebar + header, light content
 * Accent: Indigo/blue
 * Author: AI-generated
 */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-bg: #ffffff;
  --sidebar-bg-gradient: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
  --header-bg: #ffffff;
  --header-bg-gradient: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
  --content-bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text-main: #0f172a;
  --text-light: #0f172a;
  --text-muted: #64748b;
  --shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.08);
  --radius: 1rem;
}

/* Dark theme removed */

html, body, .left-sidebar-container, .main-content, .sidebar-nav, .scroll-sidebar {
  scrollbar-width: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar, .left-sidebar-container::-webkit-scrollbar, .main-content::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar, .scroll-sidebar::-webkit-scrollbar {
  display: none;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: var(--content-bg);
  color: var(--text-main);
  font-size: 15px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dash-card {
  background: white;
  box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.08);
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
}


/* Header Layout */
.app-topstrip {
  background: var(--header-bg-gradient);
  color: var(--text-main);
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  font-size: 0.95rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.9rem;
}

.user-role {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.logout-btn {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.logout-btn:hover {
  background: linear-gradient(135deg, #dc2626, var(--danger));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-text {
  display: inline;
}

@media (max-width: 768px) {
  .logout-text {
    display: none;
  }
  .user-details {
    display: none;
  }
  .user-info {
    padding: 0.25rem;
  }
}

.header-logo {
  color: var(--text-main);
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  margin-right: 1rem;
  cursor: pointer;
  z-index: 1100;
}

@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: block;
  }
}

/* Sidebar Container - Refined */
.left-sidebar-container {
  position: fixed;
  top: 56px;
  left: 0;
  height: calc(100vh - 56px);
  width: 260px;
  min-width: 220px;
  max-width: 100vw;
  z-index: 1101;
  background: var(--sidebar-bg-gradient);
  box-shadow: var(--shadow);
  overflow-y: auto;
  transition: transform 0.3s;
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
}
.left-sidebar-container.show {
  transform: translateX(0);
}
@media (max-width: 1024px) {
  .left-sidebar-container {
    transform: translateX(-100%);
  }
  .left-sidebar-container.show {
    transform: translateX(0);
  }
  /* Ensure dropdowns work properly on mobile */
  .left-sidebar .sidebar-dropdown .dropdown-menu {
    position: static;
    margin-top: 0.25rem;
    margin-left: 1rem;
    border-radius: 0.3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}
@media (min-width: 1025px) {
  .left-sidebar-container {
    transform: translateX(0);
  }
}

.left-sidebar {
  height: 85%;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  background: var(--sidebar-bg-gradient);
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.25rem 0 1rem 0;
  text-align: center;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 0.5rem;
  margin: 0;
}
.left-sidebar .sidebar-dropdown {
  margin-bottom: 0.5rem;
  position: relative;
}

.sidebar-link {
  color: var(--text-main);
  padding: 0.55rem 1.25rem;
  border-radius: 0.35rem;
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
  border: none;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-dark);
  box-shadow: none;
}
.sidebar-link i {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

/* Sidebar Dropdowns */
.left-sidebar .sidebar-dropdown {
  position: relative;
}
/* Sidebar dropdown menu - matching header design */
.left-sidebar .sidebar-dropdown .dropdown-menu {
  position: static;
  min-width: 100%;
  background: transparent;
  color: var(--text-main);
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0.25rem 0 0.25rem 0.5rem;
  margin-top: 0.25rem;
  display: none;
}
.left-sidebar .sidebar-dropdown.open .dropdown-menu {
  display: block;
}
/* Arrow for dropdown toggle */
.left-sidebar .sidebar-link.dropdown-toggle1 {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.left-sidebar .sidebar-link.dropdown-toggle1 .dropdown-arrow {
  margin-left: auto;
  transition: transform 0.3s;
  font-size: 0.8rem;
}
.left-sidebar .sidebar-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown menu item styles */
.left-sidebar .dropdown-menu .dropdown-item {
  padding: 0.5rem 1rem;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background 0.2s;
  font-size: 0.85rem;
}
.left-sidebar .dropdown-menu .dropdown-item:hover,
.left-sidebar .dropdown-menu .dropdown-item.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-dark);
}

/* Header Dropdown */
.header-dropdown {
  position: relative;
}

.user-info.dropdown-toggle1 {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.2s;
}

.user-info.dropdown-toggle1:hover {
  background: rgba(255, 255, 255, 0.15);
}

.dropdown-arrow {
  margin-left: 0.5rem;
  transition: transform 0.3s;
  font-size: 0.8rem;
}

.header-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.header-dropdown .dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 180px;
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  z-index: 1200;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s;
}

.header-dropdown.open .dropdown-menu {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.header-dropdown .dropdown-item {
  padding: 0.75rem 1.25rem;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.header-dropdown .dropdown-item:hover {
  background: var(--primary);
  color: #fff;
}

.dropdown-item-form {
  margin: 0;
}

.logout-dropdown-btn {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
}

.logout-dropdown-btn:hover {
  background: var(--danger);
  color: #fff;
}

.main-content {
  margin-left: 260px;
  margin-top: 56px;
  padding: 2rem 0 2rem 2rem;
  background: var(--card-bg);
  box-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.08);
  min-height: calc(100vh - 56px);
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  position: relative;
  width: 100%;
  box-sizing: border-box;
  border-radius: 0;
}
@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
    margin-top: 56px;
    padding: 1rem 0.5rem;
    border-radius: 0;
  }
}

@media (max-width: 1024px) {
  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1001;
  }
  .left-sidebar-container {
    width: 260px;
  }
  .left-sidebar-container.show ~ .mobile-menu-overlay {
    display: block;
  }
}
@media (max-width: 600px) {
  .mobile-menu-overlay {
    left: 0;
  }
}

.table, .table th, .table td {
  font-size: 0.88rem;
}

.table-action-btn, .table .btn-sm, .table .btn {
  min-width: 40px;
  min-height: 40px;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 30%;
}
.table-action-btn:last-child, .table .btn-sm:last-child, .table .btn:last-child {
  margin-right: 0;
}
.table-action-btn i, .table .btn-sm i, .table .btn i {
  font-size: 1em;
}
.table-action-btn-primary, .table .btn-primary {
  background: transparent;
  color: var(--primary);
}
.table-action-btn-primary:hover, .table .btn-primary:hover {
  background: var(--primary);
  color: #fff;
}
.table-action-btn-warning, .table .btn-warning {
  background: transparent;
  color: var(--warning);
}
.table-action-btn-warning:hover, .table .btn-warning:hover {
  background: var(--warning);
  color: #fff;
}
.table-action-btn-danger, .table .btn-danger, .table .btn-outline-danger {
  background: transparent;
  color: var(--danger);
}
.table-action-btn-danger:hover, .table .btn-danger:hover, .table .btn-outline-danger:hover {
  background: var(--danger);
  color: #fff;
}
.table-action-btn-info, .table .btn-info, .table .btn-outline-info {
  background: transparent;
  color: var(--accent);
}
.table-action-btn-info:hover, .table .btn-info:hover, .table .btn-outline-info:hover {
  background: var(--accent);
  color: #fff;
}
.table-action-btn-success, .table .btn-success, .table .btn-outline-success {
  background: transparent;
  color: var(--success);
}
.table-action-btn-success:hover, .table .btn-success:hover, .table .btn-outline-success:hover {
  background: var(--success);
  color: #fff;
}
.table-action-btn-outline, .table .btn-outline-primary, .table .btn-outline-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.table-action-btn-outline:hover, .table .btn-outline-primary:hover, .table .btn-outline-secondary:hover {
  background: var(--primary);
  color: #fff;
}
.table-action-btn-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  align-items: center;
}
.table td {
  vertical-align: middle;
}
.table td .btn,
.table td .btn-sm,
.table td .table-action-btn,
.table td > form,
.table td > a,
.table td > button {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0;
}
.table-action-btn-group form {
  display: inline-flex !important;
  align-items: center;
  margin-bottom: 0;
}

.modal {
  z-index: 2000 !important;
}
.modal-backdrop {
  z-index: 1999 !important;
}

/* --- Footer --- */
.app-footer {
  width: 100%;
  height: 40px;
  background: var(--header-bg-gradient);
  border-top: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}
.app-footer a {
  color: #22c55e;
  text-decoration: none;
  font-weight: 600;
}

.app-footer .brand {
  font-weight: 700;
}

.left{
  margin-left: 260px;
}

@media (max-width: 640px) {
  .app-footer {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }
}

/* Allow footer to stick to bottom via flex layout */
.admin-body .page-wrapper {
  flex: 1;
}

/* Avoid forcing full viewport height so footer can sit at bottom without extra scroll */
.page-wrapper .main-content {
  min-height: unset;
}

/* Notification Bell Styles */
.notification-bell {
  position: relative;
  display: inline-block;
}

.notification-bell .btn-link {
  color: var(--text-light) !important;
  text-decoration: none;
  border: none;
  background: transparent;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.notification-bell .btn-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light) !important;
}

.notification-bell .btn-link:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
  outline: none;
}

.notification-bell #notificationBadge {
  font-size: 0.6rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--danger) !important;
  border: 2px solid var(--header-bg);
}

.notification-bell #notificationDropdown {
  width: 320px;
  z-index: 1050;
  display: none;
}

.notification-bell #notificationDropdown .card {
  border: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.notification-bell #notificationDropdown .card-header {
  background: var(--primary);
  color: white;
  border-bottom: none;
  border-radius: 0.375rem 0.375rem 0 0;
}

.notification-bell #notifications-list {
  max-height: 300px;
  overflow-y: auto;
}

.notification-bell .notification-item {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.notification-bell .notification-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.notification-bell .notification-item:last-child {
  border-bottom: none !important;
}

/* Mobile responsiveness for notification bell */
@media (max-width: 768px) {
  .notification-bell #notificationDropdown {
    width: 280px;
    right: -10px;
  }
  
  .notification-bell .btn-link {
    padding: 0.375rem;
  }
  
  .notification-bell #notificationBadge {
    font-size: 0.5rem;
    min-width: 16px;
    height: 16px;
  }
}

/* Toast notification styles */
.toast {
  border: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.toast .toast-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.toast .toast-body {
  padding: 0.75rem 1rem;
}

/* Alert message styles - narrower width */
.alert {
  max-width: 600px;
  margin: 1rem auto;
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

/* Mobile responsiveness for alerts */
@media (max-width: 768px) {
  .alert {
    max-width: 90%;
    margin: 1rem 1rem;
  }
}

/* Search Filter Component Styles */
.search-filter-container {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-filter-container .input-group-text {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}

.search-filter-container .form-control:focus,
.search-filter-container .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

.filter-btn {
  transition: all 0.2s ease;
  border-radius: 0.5rem;
}

.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.filter-btn.active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

#clearFilters:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

#saveFilters:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

#resultCount {
  font-weight: 600;
  color: var(--primary);
}

/* Responsive adjustments for search filter */
@media (max-width: 768px) {
  .search-filter-container .row {
    gap: 0.5rem !important;
  }
  
  .search-filter-container .col-md-4,
  .search-filter-container .col-md-6,
  .search-filter-container .col-md-2 {
    width: 100%;
  }
  
  .search-filter-container .d-flex.gap-2 {
    flex-direction: column;
    gap: 0.5rem !important;
  }
  
  .search-filter-container .d-flex.justify-content-between {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
}