/* MAIN STYLESHEET - PREMIUM ADMIN PANEL */
:root {
  /* Colors */
  --bg-body: #f1f5f9;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --bg-sidebar-active: rgba(79, 70, 229, 0.2);
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;
  --border-color: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.1);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 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);
  
  /* Radii */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Transitions */
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;
  
  /* Dimensions */
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 80px;
  --navbar-height: 65px;
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 10px 10px -5px rgba(0,0,0,0.3);
}

/* Global Styles */
* {
  box-sizing: border-box;
}
body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-xl);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
::selection {
  background-color: var(--primary-light);
  color: var(--primary);
}
::placeholder {
  color: var(--text-muted) !important;
  opacity: 1;
}

/* Typography & Utilities */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 0;
}
a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--primary-hover);
}
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
[data-theme="dark"] .glass-effect {
  background: rgba(30, 41, 59, 0.7);
}
.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #172554 100%);
  color: var(--text-sidebar);
  z-index: 1000;
  transition: transform var(--transition-slow), width var(--transition-slow);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.22);
  border-right: 1px solid rgba(148, 163, 184, 0.18);
}
.sidebar-header {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.sidebar-logo {
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-logo i {
  color: var(--primary);
  margin-right: 12px;
  font-size: 1.5rem;
}
.sidebar-content {
  padding: 18px 14px;
}
.sidebar-nav .nav-link {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.16), rgba(79, 70, 229, 0.24));
  color: #ffffff;
  transform: translateX(2px);
}
.sidebar-nav .nav-link i {
  color: #60a5fa;
}
.sidebar-divider {
  margin: 16px 0 8px;
  padding: 0 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.sidebar-footer {
  padding: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(15, 23, 42, 0.35);
}

/* Navbar */
.top-navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background-color: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  transition: left var(--transition-slow), box-shadow 0.3s ease;
}
.top-navbar.scrolled {
  box-shadow: var(--shadow-sm);
}
.navbar-left {
  display: flex;
  align-items: center;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 16px;
  display: none;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.nav-icon-btn:hover {
  background-color: var(--bg-body);
  color: var(--text-primary);
}
.badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}
.user-dropdown {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.user-dropdown:hover {
  background-color: var(--bg-body);
}

/* Avatar */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-md { width: 40px; height: 40px; font-size: 1rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  padding: 24px;
  min-height: calc(100vh - var(--navbar-height));
  transition: margin-left var(--transition-slow);
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  margin-bottom: 24px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body {
  padding: 20px;
}
.card-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* Stat Cards */
.stat-card {
  display: flex;
  align-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.stat-card-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-right: 16px;
  z-index: 1;
}
.stat-card-info {
  z-index: 1;
}
.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.stat-card-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}
.stat-primary .stat-card-icon { background: var(--primary-light); color: var(--primary); }
.stat-success .stat-card-icon { background: var(--success-light); color: var(--success); }
.stat-warning .stat-card-icon { background: var(--warning-light); color: var(--warning); }
.stat-danger .stat-card-icon { background: var(--danger-light); color: var(--danger); }
.stat-info .stat-card-icon { background: var(--info-light); color: var(--info); }

/* Tables */
.table-responsive {
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.table {
  width: 100%;
  margin-bottom: 0;
  color: var(--text-primary);
  border-collapse: collapse;
}
.table th {
  background-color: var(--bg-body);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  border-top: none;
}
.table td {
  padding: 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}
.table tbody tr {
  transition: var(--transition);
}
.table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

/* Forms */
.form-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.form-control, .form-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: var(--transition);
  font-size: 0.95rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background-color: var(--bg-input);
  color: var(--text-primary);
}
.input-group-text {
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.4);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background-color: var(--primary);
  color: #fff;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* Badges */
.badge {
  padding: 6px 12px;
  font-weight: 500;
  border-radius: 20px;
  font-size: 0.75rem;
}
.badge-status-active { background-color: var(--success-light); color: var(--success); }
.badge-status-inactive { background-color: var(--danger-light); color: var(--danger); }
.badge-payment-paid { background-color: var(--success-light); color: var(--success); }
.badge-payment-pending { background-color: var(--warning-light); color: var(--warning); }
.badge-payment-partial { background-color: var(--info-light); color: var(--info); }

/* Modals */
.modal-content {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
}
.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 24px;
}
.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 20px 24px;
}
.btn-close {
  filter: var(--close-btn-filter, none);
}
[data-theme="dark"] {
  --close-btn-filter: invert(1) grayscale(100%) brightness(200%);
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
}
.custom-toast {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 300px;
  max-width: 400px;
  animation: slideInRight 0.3s ease forwards;
  position: relative;
  overflow: hidden;
}
.custom-toast.hide {
  animation: fadeOutRight 0.3s ease forwards;
}
.toast-icon {
  font-size: 1.5rem;
}
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }
.toast-content {
  flex-grow: 1;
}
.toast-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: 0.95rem;
}
.toast-message {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: rgba(0,0,0,0.1);
  width: 100%;
}
.toast-progress-bar {
  height: 100%;
  width: 100%;
  animation: progressToast linear forwards;
}
.toast-success .toast-progress-bar { background-color: var(--success); }
.toast-error .toast-progress-bar { background-color: var(--danger); }
.toast-warning .toast-progress-bar { background-color: var(--warning); }
.toast-info .toast-progress-bar { background-color: var(--info); }

/* Breadcrumb */
.custom-breadcrumb {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}
.custom-breadcrumb li {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}
.custom-breadcrumb li a {
  color: var(--text-secondary);
}
.custom-breadcrumb li a:hover {
  color: var(--primary);
}
.custom-breadcrumb li+li::before {
  content: '›';
  margin: 0 8px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-muted);
}
.custom-breadcrumb .active {
  color: var(--text-primary);
  font-weight: 500;
}

/* Animations */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
@keyframes progressToast {
  from { width: 100%; }
  to { width: 0%; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.animate-fade-in { animation: fadeIn 0.4s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state-desc {
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 24px;
}

/* Pagination */
.pagination {
  margin-bottom: 0;
}
.page-link {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  transition: var(--transition);
}
.page-link:hover {
  background-color: var(--bg-body);
  border-color: var(--border-color);
  color: var(--primary);
}
.page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.page-item.disabled .page-link {
  background-color: var(--bg-body);
  border-color: var(--border-color);
  color: var(--text-muted);
}
