/* Admin Dashboard Theme — Bootstrap 5 customizations */

/* Root variables for easy theming */
:root {
    /* Modern Color Palette */
    --admin-bg: #f8fafc;
    --admin-bg-secondary: #f1f5f9;
    --admin-sidebar-bg: #0f172a;
    --admin-sidebar-active: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --admin-sidebar-hover: rgba(59, 130, 246, 0.1);
    --admin-sidebar-text: #e2e8f0;
    --admin-header-bg: #ffffff;
    --admin-header-text: #1e293b;
    --admin-card-bg: #ffffff;
    --admin-card-border: #e2e8f0;
    --admin-primary: #3b82f6;
    --admin-primary-dark: #1d4ed8;
    --admin-accent: #8b5cf6;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
    
    /* Modern Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Enhanced Typography & Body */
body {
    background-color: var(--admin-bg);
    color: #334155;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: 76px; /* Account for fixed navbar */
}

/* Enhanced Headings */
h1, h2, h3, h4, h5, h6 {
    color: #1e293b;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.h2 {
    font-size: 1.875rem;
    font-weight: 700;
}

.h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Text utilities */
.text-muted {
    color: #64748b !important;
}

.text-primary {
    color: var(--admin-primary) !important;
}

.text-success {
    color: var(--admin-success) !important;
}

.text-warning {
    color: var(--admin-warning) !important;
}

.text-danger {
    color: var(--admin-danger) !important;
}

/* Small text improvements */
.small {
    font-size: 0.875rem;
    line-height: 1.4;
}

.text-uppercase {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

/* Sidebar */
.admin-sidebar {
    background: var(--admin-sidebar-bg);
    color: var(--admin-sidebar-text);
    min-height: 100vh;
    width: 240px;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 1rem;
    z-index: 100;
}

.admin-sidebar .nav-link {
    color: var(--admin-sidebar-text);
    padding: 0.75rem 1.25rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: background 0.2s;
}

.admin-sidebar .nav-link.active,
.admin-sidebar .nav-link:hover {
    background: var(--admin-sidebar-active);
    color: #fff;
}

/* Header */
.admin-header {
    background: var(--admin-header-bg);
    color: var(--admin-header-text);
    padding: 1rem 2rem;
    margin-left: 240px;
    border-bottom: 1px solid #e3e6f0;
    position: sticky;
    top: 0;
    z-index: 101;
}

/* Main content */
.admin-content {
    margin-left: 240px;
    padding: 2rem;
    padding-top: 1rem; /* Additional top padding since navbar is fixed */
}

/* Modern Card Styling */
.card {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    /* border-color: rgba(59, 130, 246, 0.2); */
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    /* background: linear-gradient(90deg, var(--admin-primary) 0%, var(--admin-accent) 100%); */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

.card-body {
    padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
}

.stat-card .stat-icon.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(29, 78, 216, 0.1) 100%);
    color: var(--admin-primary);
}

.stat-card .stat-icon.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    color: var(--admin-success);
}

.stat-card .stat-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
    color: var(--admin-warning);
}

.stat-card .stat-icon.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: var(--admin-danger);
}

/* Legacy admin-card support */
.admin-card {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Modern Button Styling */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--admin-primary-dark) 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-secondary {
    border: 1px solid var(--admin-card-border);
    color: #64748b;
    background: transparent;
    font-weight: 500;
}

.btn-outline-secondary:hover {
    background: var(--admin-primary);
    border-color: var(--admin-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Legacy admin button support */
.btn-admin {
    background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-admin:hover {
    background: linear-gradient(135deg, var(--admin-primary-dark) 0%, #1e40af 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Modern Table Styling */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--admin-bg-secondary);
    color: var(--admin-header-text);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 2px solid var(--admin-card-border);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.02);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    color: #475569;
}

.table-responsive {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Badge styling for status */
.badge {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

.bg-white.text-dark.border {
    background: var(--admin-bg-secondary) !important;
    color: var(--admin-header-text) !important;
    border: 1px solid var(--admin-card-border) !important;
}

/* Legacy admin table support */
.admin-table th {
    background: var(--admin-bg-secondary);
    color: var(--admin-header-text);
    font-weight: 600;
}

.admin-table td {
    background: #fff;
    color: #475569;
}

/* Navbar Styling */
.navbar {
  background: var(--admin-header-bg) !important;
  /* border-bottom: 1px solid var(--admin-card-border); */
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  backdrop-filter: blur(10px);
  z-index: 1030;
  height: 76px;
  padding: 0.75rem 0;
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--admin-header-text) !important;
  letter-spacing: -0.025em;
}

.navbar-nav .nav-link {
  color: #6c757d !important;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
  color: var(--admin-header-text) !important;
  background-color: var(--admin-bg);
}

/* Enhanced Sidebar Styling */
.sidebar {
  background: var(--admin-sidebar-bg) !important;
  border-right: 1px solid var(--admin-card-border);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  min-height: 100vh;
  position: fixed;
  top: 76px; /* Start below the fixed navbar */
  left: 0;
  z-index: 1000;
  width: 16.666667%; /* col-md-3 equivalent */
  color: #ffffff !important;
}

@media (min-width: 992px) {
  .sidebar {
    width: 16.666667%; /* col-lg-2 equivalent */
  }
}

.sidebar .position-sticky {
  padding: 1.5rem 1rem;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  margin-bottom: 0.25rem;
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.sidebar .nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--admin-sidebar-active);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.sidebar .nav-link:hover {
  color: #ffffff !important;
  background: var(--admin-sidebar-hover);
  transform: translateX(4px);
  border-radius: var(--radius-md);
}

.sidebar .nav-link.active {
  color: #ffffff !important;
  background: var(--admin-sidebar-active);
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.sidebar .nav-link.active::before {
  transform: scaleY(1);
}

.sidebar .nav-link i {
  width: 20px;
  text-align: center;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  color: #ffffff !important;
}

.sidebar .nav-link:hover i,
.sidebar .nav-link.active i {
  opacity: 1;
  color: #ffffff !important;
}

/* Ensure all sidebar text is white */
.sidebar,
.sidebar *,
.sidebar .nav,
.sidebar .nav-item,
.sidebar .position-sticky {
  color: #ffffff !important;
}

/* Adjust main content for fixed sidebar */
main.col-md-9.ms-sm-auto.col-lg-10 {
  margin-left: 16.666667% !important;
  padding-top: 2rem;
  min-height: calc(100vh - 76px);
}

@media (min-width: 992px) {
  main.col-md-9.ms-sm-auto.col-lg-10 {
    margin-left: 16.666667% !important;
  }
}

/* Sidebar Toggle Button */
#sidebarToggle {
  border: 1px solid var(--admin-card-border);
  background: var(--admin-header-bg);
  color: var(--admin-header-text);
  font-size: 1rem;
  padding: 0.625rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#sidebarToggle:hover {
  background-color: var(--admin-primary);
  color: white;
  border-color: var(--admin-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

#sidebarToggle:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.2);
}

/* Sidebar Collapse States */
.sidebar.sidebar-collapsed {
  width: 70px !important;
  overflow: visible;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
}

.sidebar.sidebar-collapsed .position-sticky {
  padding: 1.5rem 0.25rem;
}

.sidebar.sidebar-collapsed .nav-link {
  padding: 0.875rem 0.25rem;
  justify-content: center;
  text-align: center;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.sidebar.sidebar-collapsed .nav-link span {
  display: none;
}

.sidebar.sidebar-collapsed .nav-link i {
  margin-right: 0 !important;
  font-size: 1.125rem;
  width: auto;
}

/* Tooltip on hover for collapsed sidebar */
.sidebar.sidebar-collapsed .nav-link {
  position: relative;
}

.sidebar.sidebar-collapsed .nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 80px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1050;
  pointer-events: none;
}

.sidebar.sidebar-collapsed .nav-link::before {
  content: '';
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid rgba(0, 0, 0, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1050;
}

.sidebar.sidebar-collapsed .nav-link:hover::after,
.sidebar.sidebar-collapsed .nav-link:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Enhanced hover states for collapsed sidebar */
.sidebar.sidebar-collapsed .nav-link:hover {
  background-color: rgba(13, 110, 253, 0.3);
  transform: translateX(2px);
  box-shadow: 2px 0 8px rgba(13, 110, 253, 0.2);
}

.sidebar.sidebar-collapsed .nav-link.active {
  background-color: var(--admin-sidebar-active);
  box-shadow: 2px 0 8px rgba(13, 110, 253, 0.4);
  border-left: none;
}

.sidebar.sidebar-collapsed .nav-link.active::before {
  display: none;
}

/* Main content adjustment when sidebar is collapsed */
main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed {
  margin-left: 70px !important;
  width: calc(100vw - 70px) !important;
  max-width: calc(100vw - 70px) !important;
  transition: all 0.3s ease;
}

/* Enhanced main content transitions */
main.col-md-9.ms-sm-auto.col-lg-10 {
  transition: all 0.3s ease;
  width: calc(100vw - 16.666667%) !important;
  max-width: calc(100vw - 16.666667%) !important;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (min-width: 992px) {
  main.col-md-9.ms-sm-auto.col-lg-10 {
    width: calc(100vw - 16.666667%) !important;
    max-width: calc(100vw - 16.666667%) !important;
  }
}

/* Content containers inside main for full width utilization */
main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed .container,
main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed .container-fluid {
  max-width: 100% !important;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed .row {
  margin-left: 0;
  margin-right: 0;
}

main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed .col,
main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed [class*="col-"] {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Smooth transition for sidebar */
.sidebar {
  transition: width 0.3s ease;
}

/* Responsive sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
        padding-top: 1rem;
    }
    
    .sidebar.sidebar-collapsed {
        width: 100% !important;
    }
    
    main.col-md-9.ms-sm-auto.col-lg-10 {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    main.col-md-9.ms-sm-auto.col-lg-10.sidebar-collapsed {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .admin-sidebar {
        width: 100%;
        position: relative;
        min-height: auto;
    }
    .admin-header,
    .admin-content {
        margin-left: 0;
    }
}