/* Design System - ApprenticeForward */
:root {
  --primary-navy: #0f172a;
  --primary-hover: #1e293b;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --bg-soft-gray: #f8fafc;
  --border-color: #e2e8f0;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --glass-bg: rgba(255, 255, 255, 0.7);

  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --sidebar-bg: #ffffff;
  --sidebar-hover-bg: #f8fafc;
  --sidebar-active-bg: #eff6ff;
  --sidebar-text: #64748b;
  --sidebar-active-text: #2563eb;
  --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.no-transition {
  transition: none !important;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  background-color: var(--bg-soft-gray);
  color: var(--primary-navy);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-navy);
}

.navbar-brand {
  white-space: normal;
  text-align: center;
  word-break: break-all;
}

.app-wrapper {
  display: flex;
  flex: 1;
  width: 100%;
}

main {
  flex: 1 0 auto;
  padding-bottom: 3rem;
}

/* Main Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Prevents overflow in flex items */
  transition: padding-left var(--sidebar-transition);
}

.admin-top-bar {
  height: 64px;
  background: white;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.admin-top-bar .navbar-nav {
  flex-direction: row;
  align-items: center;
}

.admin-top-bar .nav-item {
  margin-left: 1rem;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  transition: width var(--sidebar-transition);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1001;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}


.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-navy);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo i {
  font-size: 1.5rem;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 1.5rem 0.5rem 0.5rem;
  letter-spacing: 0.05em;
  transition: opacity 0.2s;
}

.collapsed .nav-section-label {
  opacity: 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.75rem;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
  gap: 0.875rem;
}

.sidebar-nav .nav-link i {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}

.sidebar-nav .nav-link span {
  transition: opacity 0.2s, transform 0.2s;
}

.collapsed .sidebar-nav .nav-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  transform: translateX(-10px);
  pointer-events: none;
}

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

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

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.sidebar-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover-bg);
}

.sidebar.collapsed .sidebar-toggle span {
  display: none;
}

/* Tooltip replacement for collapsed state (simple CSS title) */
.collapsed .nav-link {
  justify-content: center;
  padding: 0.625rem 0;
}

.collapsed .nav-link i {
  margin: 0;
}

/* Mobile adjustments */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: -100%;
    height: 100vh;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  }

  .sidebar.mobile-show {
    left: 0;
  }
}

.btn-primary {
  background-color: var(--primary-navy);
  border-color: var(--primary-navy);
  padding: 0.5rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

/* DataTables Styling Customization */
.dataTable {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.dataTable thead th {
  background-color: #f1f5f9;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.dataTable tbody td {
  padding: 1.25rem 1rem !important;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

/* Status Pills */
.badge {
  padding: 0.5em 0.75em;
  font-weight: 500;
  border-radius: 9999px;
}

/* Form Styles */
.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Layout Utilities */
.page-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.container-fluid {
  padding-left: 2rem !important;
  padding-right: 2rem !important;
}

.footer {
  position: relative;
  flex-shrink: 0;
  background-color: white;
  padding: 1.5rem 0;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
}

.footer a {
  color: var(--sidebar-text);
}

.footer a:hover {
  color: var(--primary-navy);
}

/* Mobile Responsiveness & Touch Targets */
@media (max-width: 768px) {
  body {
    min-width: 320px;
    overflow-x: hidden;
  }

  .table-responsive {
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
  }

  /* DataTables Responsive Child Row Styling */
  table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before,
  table.dataTable.dtr-column.collapsed>tbody>tr>td.dtr-control:before {
    background-color: transparent;
    border: none;
    box-shadow: none;
  }

  /* Better touch targets for buttons on mobile */
  .btn {
    padding: 0.75rem 1rem;
    margin-bottom: 5px;
  }

  /* Stepped form on mobile */
  .form-step .card-body {
    padding: 1.5rem !important;
  }
}

/* DataTables Responsive Specifics */
table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control,
table.dataTable.dtr-column.collapsed>tbody>tr>td.dtr-control {
  padding-left: 30px !important;
}

.dtr-details {
  width: 100%;
}

.dtr-data {
  font-weight: 500;
}

/* Apprentice View Modernization Utilities */
.text-primary-navy {
  color: var(--primary-navy) !important;
}

.cursor-pointer {
  cursor: pointer;
}

.hover-bg-light:hover {
  background-color: var(--bg-soft-gray) !important;
  border-color: var(--border-color) !important;
}

.step-indicator {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.3s;
}

.step-indicator.active {

  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Remove radius from button groups */
.btn-group .btn {
  border-radius: 0 !important;
}

/* Hide caret on icon-only dropdown toggles */
.dropdown-toggle-no-caret::after {
  display: none !important;
}

/* Table action dropdowns - tighter density */
td .dropdown-menu .dropdown-item {
  font-size: 0.875rem;
  padding: 0.375rem 1rem;
}

td .dropdown-menu .dropdown-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}