/* =================================
   Popex Admin Dashboard - Bootstrap 5.3
   ================================= */

:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;
  --top-navbar-height: 60px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #ffffff;
  --sidebar-active-bg: rgba(255, 255, 255, 0.1);
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: #f1f5f9;
  min-height: 100vh;
}

/* =================================
   Sidebar
   ================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  z-index: 1040;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.sidebar-logo {
  max-width: 140px;
  height: auto;
}

.btn-close-sidebar {
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.btn-close-sidebar:hover {
  color: var(--sidebar-text-hover);
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 1rem 0;
}

.sidebar-nav .nav {
  padding: 0 0.75rem;
}

.sidebar-nav .nav-item {
  margin-bottom: 2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 0.625rem 1rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link i {
  font-size: 1.125rem;
  margin-right: 0.75rem;
  width: 1.25rem;
  text-align: center;
}

.sidebar-nav .nav-link .bi-chevron-down {
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.sidebar-nav .nav-link:not(.collapsed) .bi-chevron-down {
  transform: rotate(180deg);
}

.sidebar-nav .nav-link:hover {
  color: var(--sidebar-text-hover);
  background-color: var(--sidebar-active-bg);
}

.sidebar-nav .nav-link.active {
  color: #ffffff;
  background-color: #3b82f6;
}

.sidebar-nav .nav-link .badge {
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
}

/* Sub Navigation */
.sidebar-nav .sub-nav {
  padding-left: 2.5rem;
  padding-top: 0.25rem;
}

.sidebar-nav .sub-nav .nav-link {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 400;
}

/* Section Titles */
.nav-section-title {
  padding: 1.25rem 1rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(148, 163, 184, 0.6);
}

/* =================================
   Main Content
   ================================= */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* Top Navbar */
.top-navbar {
  background-color: #ffffff;
  height: var(--top-navbar-height);
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1rem;
}

.sidebar-toggle {
  color: #475569;
  padding: 0.5rem;
  border-radius: 0.5rem;
}

.sidebar-toggle:hover {
  background-color: #f1f5f9;
  color: #1e293b;
}

.user-avatar {
  font-size: 1.5rem;
  color: #64748b;
}

/* Page Content */
.page-content {
  flex: 1;
  padding: 1.5rem;
}

/* =================================
   Breadcrumbs
   ================================= */
.breadcrumb-wrapper {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.5rem;
}

.breadcrumb {
  margin-bottom: 0;
  font-size: 0.875rem;
  background: none;
  padding: 0;
}

.breadcrumb-item a {
  color: #3b82f6;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #64748b;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #94a3b8;
  font-weight: 600;
}

.breadcrumb-item i {
  font-size: 0.75rem;
  vertical-align: middle;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

/* Footer */
.page-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background-color: #ffffff;
}

/* =================================
   Stats Cards
   ================================= */
.stat-card {
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-link {
  color: #3b82f6;
  text-decoration: none;
}

.stat-link:hover {
  text-decoration: underline;
}

/* =================================
   Cards
   ================================= */
.card {
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
}

.card-header {
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.25rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.card-body {
  padding: 1.25rem;
}

/* =================================
   Mobile Responsive
   ================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1030;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }
}

@media (max-width: 575.98px) {
  .page-content {
    padding: 1rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

/* =================================
   Utility Classes
   ================================= */
.bg-gradient-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading Placeholders */
.placeholder-glow .placeholder {
  background-color: #e2e8f0;
}

/* List Group Enhancements */
.list-group-item {
  border-left: none;
  border-right: none;
}

.list-group-item:first-child {
  border-top: none;
}

.list-group-item:last-child {
  border-bottom: none;
}

/* Table Styles */
.table {
  margin-bottom: 0;
}

.table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: #64748b;
  border-bottom-width: 1px;
}

.table td {
  vertical-align: middle;
  color: #475569;
}

/* Form Controls */
.form-control,
.form-select {
  border-color: #e2e8f0;
  border-radius: 0.5rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.15);
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: 0.5rem;
}

.btn-primary {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.btn-primary:hover {
  background-color: #2563eb;
  border-color: #2563eb;
}

/* Badges */
.badge {
  font-weight: 500;
}

/* Alert Improvements */
.alert {
  border: none;
  border-radius: 0.5rem;
}

/* Modal Improvements */
.modal-content {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  border-bottom-color: #e2e8f0;
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top-color: #e2e8f0;
  padding: 1rem 1.5rem;
}

/* Dropdown Improvements */
.dropdown-menu {
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.dropdown-item:hover {
  background-color: #f1f5f9;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
