/* ==========================================================================
   Henrock Admin Custom Design System
   ========================================================================== */

/* Define Global CSS Variables for Themes */
:root {
  /* Common Values */
  --font-sans: 'Inter', sans-serif;
  --font-outfit: 'Outfit', sans-serif;
  --color-orange: #ea580c;
  --color-orange-hover: #d97706;
  
  /* Light Mode (Default) */
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -4px rgba(0,0,0,0.02);
  
  /* Sidebar Light Mode Details (Sleek Light Sidebar) */
  --sidebar-bg: #ffffff;
  --sidebar-text: #475569;
  --sidebar-border: #e2e8f0;
  --sidebar-hover-bg: rgba(234, 88, 12, 0.08);
  --sidebar-hover-text: #ea580c;
}

[data-bs-theme="dark"] {
  /* Dark Mode Variables */
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 10px rgba(0,0,0,0.4);
  --shadow-lg: 0 15px 30px rgba(0,0,0,0.5);
  
  /* Sidebar Dark Mode Details */
  --sidebar-bg: #111827;
  --sidebar-text: #9ca3af;
  --sidebar-border: #1f2937;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-hover-text: #ffffff;
}

/* Global Styles */
body {
  background-color: var(--bg-body);
  color: var(--text-color);
  font-family: var(--font-sans);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.outfit-font {
  font-family: var(--font-outfit), sans-serif;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Font Size Helpers */
.font-size-xs { font-size: 0.8rem; }
.font-size-sm { font-size: 0.875rem; }
.font-size-md { font-size: 0.95rem; }
.font-size-lg { font-size: 1.125rem; }
.font-size-xl { font-size: 1.25rem; }
.font-size-xxs { font-size: 0.7rem; }

/* Custom Colors & Utilities */
.bg-orange { background-color: var(--color-orange) !important; }
.text-orange { color: var(--color-orange) !important; }
.btn-orange {
  background-color: var(--color-orange);
  color: white;
  border: none;
  transition: all 0.2s ease;
}
.btn-orange:hover, .btn-orange:focus {
  background-color: var(--color-orange-hover);
  color: white;
}
.text-muted-opacity {
  opacity: 0.3;
}

.bg-orange-subtle {
  background-color: rgba(234, 88, 12, 0.15);
}
.bg-orange-light {
  background-color: rgba(234, 88, 12, 0.05);
}
.bg-primary-light {
  background-color: rgba(13, 110, 253, 0.05);
}

/* App Layout Grid */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.sidebar-wrapper {
  width: 260px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1040;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  height: 70px;
}
.brand-name {
  font-family: var(--font-outfit);
  font-size: 1.25rem;
  color: #1e293b;
}
.text-gradient {
  background: linear-gradient(to right, #1e293b, #ea580c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-subtitle {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--sidebar-text);
}

.sidebar-user {
  background-color: #f8fafc;
}
.sidebar-user-name {
  color: #1e293b;
  font-weight: 600;
}
.sidebar-user-email {
  color: var(--sidebar-text);
}

.sidebar-nav {
  overflow-y: auto;
}
.sidebar-nav .nav-link {
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}
.sidebar-nav .nav-link:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}
.sidebar-nav .nav-link.active {
  background-color: var(--color-orange);
  color: #ffffff;
}
.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1.05rem;
}

/* Main Area Layout */
.main-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-left: 260px;
  min-width: 0; /* Prevents flex children from breaking layouts */
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Navbar Styling */
.navbar {
  height: 70px;
  background-color: var(--bg-card);
}
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* Cards & Modern Panels */
.bg-card {
  background-color: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}
.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.relative-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg) !important;
}

/* Form Controls styling override */
.form-control, .form-select {
  background-color: var(--bg-body);
  border-color: var(--border-color);
  color: var(--text-color);
}
.form-control:focus, .form-select:focus {
  background-color: var(--bg-card);
  color: var(--text-color);
  border-color: var(--color-orange);
  box-shadow: 0 0 0 0.2rem rgba(234, 88, 12, 0.15);
}

/* Table styles custom values */
.table {
  color: var(--text-color);
}
.table-light {
  --bs-table-bg: var(--bg-body);
  --bs-table-color: var(--text-color);
  border-color: var(--border-color);
}
.table-hover tbody tr:hover {
  --bs-table-hover-bg: rgba(234, 88, 12, 0.03);
}
.page-link {
  color: var(--text-color);
  background-color: var(--bg-card);
  border-color: var(--border-color);
}
.page-link:hover {
  background-color: var(--bg-body);
  color: var(--color-orange);
}
.page-item.active .page-link {
  background-color: var(--color-orange);
  border-color: var(--color-orange);
  color: white;
}
.page-item.disabled .page-link {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

/* Responsive Rules for Mobile viewports */
@media (max-width: 991.98px) {
  .sidebar-wrapper {
    transform: translateX(-100%);
  }
  .sidebar-wrapper.show {
    transform: translateX(0);
  }
  .main-container {
    margin-left: 0;
  }
  .app-wrapper.sidebar-collapsed .main-container {
    margin-left: 0;
  }
}

/* Collapsed Sidebar on Desktop */
@media (min-width: 992px) {
  .app-wrapper.sidebar-collapsed .sidebar-wrapper {
    transform: translateX(-100%);
  }
  .app-wrapper.sidebar-collapsed .main-container {
    margin-left: 0;
  }
}

/* Custom switch colors for theme alignment */
.form-check-input:checked {
  background-color: var(--color-orange);
  border-color: var(--color-orange);
}

/* Modal styles customization for dark mode support */
.modal-content {
  background-color: var(--bg-card);
  color: var(--text-color);
  border-color: var(--border-color);
}
.modal-header, .modal-footer {
  border-color: var(--border-color);
}

/* Styles for alert notifications */
.alert-success {
  background-color: rgba(25, 135, 84, 0.1) !important;
  color: #198754 !important;
}
.alert-danger {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #dc3545 !important;
}
.alert-dismissible .btn-close {
  filter: var(--bs-transition-duration);
}

/* Extra animations helper */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
