/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css");

:root {
  /* Light Theme (Default) */
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-body: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  
  --sidebar-bg: #111827;
  --sidebar-text: #f3f4f6;
  --sidebar-link: #9ca3af;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.1);
  --sidebar-hover-text: #ffffff;
  
  --sidebar-width: 260px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

[data-theme="dark"] {
  --bg-body: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --card-bg: #1e293b;
  --border-color: #334155;
  
  --sidebar-bg: #0b1120;
  
  /* Update bootstrap text colors for dark mode */
  --bs-body-color: var(--text-main);
  --bs-body-bg: var(--bg-body);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar Layout */
.wrapper {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  transition: background-color 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--sidebar-hover-text);
  text-decoration: none;
}

.sidebar-nav {
  padding: 1rem 0;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-category {
  color: #6b7280;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 1rem 1.5rem 0.5rem 1.5rem;
}

.sidebar-nav .nav-item {
  padding: 0.25rem 1rem;
}

.sidebar-nav .nav-link {
  color: var(--sidebar-link);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link.active {
  color: var(--sidebar-hover-text);
  background-color: var(--sidebar-hover-bg);
}

.sidebar-nav .nav-link i {
  font-size: 1.2rem;
  width: 1.5rem;
  text-align: center;
}

.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

/* Header */
.top-header {
  background-color: var(--card-bg);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 999;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.top-header .user-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Containers & Cards */
.content-area {
  padding: 2rem;
  flex-grow: 1;
}

.premium-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.premium-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

[data-theme="light"] .stat-icon.primary, :root .stat-icon.primary { background-color: #e0e7ff; color: #4338ca; }
[data-theme="light"] .stat-icon.success, :root .stat-icon.success { background-color: #dcfce7; color: #15803d; }
[data-theme="light"] .stat-icon.warning, :root .stat-icon.warning { background-color: #fef3c7; color: #b45309; }
[data-theme="light"] .stat-icon.danger, :root .stat-icon.danger { background-color: #fee2e2; color: #b91c1c; }

[data-theme="dark"] .stat-icon.primary { background-color: rgba(67, 56, 202, 0.2); color: #818cf8; }
[data-theme="dark"] .stat-icon.success { background-color: rgba(21, 128, 61, 0.2); color: #4ade80; }
[data-theme="dark"] .stat-icon.warning { background-color: rgba(180, 83, 9, 0.2); color: #fbbf24; }
[data-theme="dark"] .stat-icon.danger { background-color: rgba(185, 28, 28, 0.2); color: #f87171; }

.stat-content .stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-content .stat-value {
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

/* Authentication Page Styles */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f9ff 0%, #c7d2fe 100%);
}

.auth-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo i {
  font-size: 3rem;
  color: var(--primary-color);
}

/* Overrides for Bootstrap Components */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.form-control {
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-main);
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--primary-color);
  background-color: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.dropdown-menu {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.dropdown-item {
  color: var(--text-main);
}

.dropdown-item:hover {
  background-color: var(--bg-body);
  color: var(--text-main);
}

.table {
  color: var(--text-main);
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  border-bottom-width: 1px;
}

.table-hover tbody tr:hover {
  background-color: var(--bg-body);
  color: var(--text-main);
}

/* Footer Fix */
.footer {
  background-color: var(--card-bg);
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  width: 100%;
}

/* Hide default navbar if we use wrapper */
.d-none-auth {
  display: none !important;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
}
/* Global Overrides for Scaffolded Views */
.content-area > h1, 
.content-area > h2, 
.content-area > div > h1, 
.content-area > div > h2 {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  letter-spacing: -0.025em;
}

.table-responsive {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
  margin-bottom: 2rem;
}

.table {
  margin-bottom: 0;
}

.table th {
  background-color: var(--bg-body);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 1rem 1.5rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Forms */
form:not(.form-inline) {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  max-width: 800px;
}

.form-group, .mb-3 {
  margin-bottom: 1.5rem !important;
}

.control-label, .form-label {
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  display: inline-block;
}

/* Badges */
.badge {
  padding: 0.35em 0.65em;
  font-weight: 600;
  border-radius: var(--radius-md);
}

/* Fix width of footer */
.wrapper {
  overflow-x: hidden;
}

.main-content {
  overflow-x: hidden;
  width: calc(100% - var(--sidebar-width));
}

@media (max-width: 768px) {
  .main-content {
    width: 100%;
  }
}
