* {
  box-sizing: border-box;
}

body { 
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fa;
}

.card { 
  border-radius: 10px;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.navbar-brand { 
  font-weight: 600;
  font-size: 1.2rem;
}

.vh-100 { 
  min-height: 100vh;
}

/* ===== RESPONSIVE LAYOUT ===== */
.main-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* ===== SIDEBAR STYLES ===== */
.sidebar {
  border-right: 1px solid rgba(0,0,0,.05);
}

.sidebar .nav-link { 
  color: #212529;
  padding: 0.75rem 1rem;
}

.sidebar .nav-link:hover { 
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
}

.sidebar .has-submenu .caret { 
  transition: transform .2s ease;
}

.sidebar .has-submenu[aria-expanded="true"] .caret { 
  transform: rotate(90deg);
}

.sidebar .avatar { 
  width: 48px;
  height: 48px;
  font-weight: 600;
  font-size: 18px;
}

.sidebar .shadow-sm { 
  box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
}

/* ===== MOBILE SIDEBAR TOGGLE ===== */
.sidebar-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1031;
}

.sidebar-mobile {
  position: fixed;
  left: -250px;
  top: 60px;
  width: 250px;
  height: calc(100vh - 60px);
  z-index: 1025;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.sidebar-mobile.show {
  left: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
  z-index: 1024;
}

.sidebar-overlay.show {
  display: block;
}

/* Show/hide toggle on different screens */
@media (min-width: 768px) {
  .sidebar-toggle {
    display: none !important;
  }
  
  .sidebar-mobile {
    display: none !important;
  }
  
  .sidebar-overlay {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .sidebar-toggle {
    display: block;
  }
}

/* ===== NAVBAR RESPONSIVE ===== */
.navbar {
  padding: 0.75rem 1rem;
}

.navbar-brand {
  font-size: 1rem;
}

.brand-sub {
  font-size: 10px;
}

/* ===== CARDS & GRIDS RESPONSIVE ===== */
.col-sm-6,
.col-lg-3 {
  margin-bottom: 1rem;
}

.card-body {
  padding: 1.25rem;
}

.card-body h6 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.card-body h2 {
  font-size: 1.75rem;
}

/* ===== TABLES RESPONSIVE ===== */
.table {
  font-size: 0.9rem;
}

.table thead {
  font-size: 0.85rem;
  background: #f8f9fa;
}

.table td {
  padding: 0.75rem;
  vertical-align: middle;
}

.table img {
  max-width: 100%;
  height: auto;
}

/* ===== BUTTONS RESPONSIVE ===== */
.btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}

.d-grid {
  gap: 0.5rem;
}

/* ===== FORMS RESPONSIVE ===== */
.form-control,
.form-select {
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
}

.form-label {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet (768px and up) */
@media (min-width: 768px) {
  .sidebar-toggle {
    display: none;
  }
  
  .sidebar-overlay {
    display: none !important;
  }
  
  .sidebar {
    width: 250px;
  }
  
  .main-content {
    padding: 2rem;
  }
  
  .navbar-brand {
    font-size: 1.2rem;
  }
}

/* Mobile (under 768px) */
@media (max-width: 767px) {
  .main-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    display: none;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .sidebar-mobile {
    left: -250px;
    width: 250px;
  }
  
  .main-content {
    flex: 1;
    padding: 1rem;
  }
  
  .navbar-brand {
    font-size: 1rem;
  }
  
  .navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .user-area {
    gap: 0.5rem;
  }
  
  /* Stack columns on mobile */
  .col-sm-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .col-lg-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .col-lg-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .col-lg-8 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .row.g-3 {
    gap: 0.75rem !important;
  }
  
  .table {
    font-size: 0.8rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }
  
  .card {
    margin-bottom: 0.75rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-body h6 {
    font-size: 0.85rem;
  }
  
  .card-body h2 {
    font-size: 1.5rem;
  }
  
  /* Hide less important columns on mobile */
  .col-auto {
    display: none;
  }
  
  /* Responsive forms */
  .form-control,
  .form-select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Responsive buttons in table */
  .btn-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
  }
  
  .btn-group .btn {
    flex: 1;
    min-width: 50px;
  }
}

/* Extra small devices (under 480px) */
@media (max-width: 479px) {
  .navbar-brand {
    font-size: 0.9rem;
  }
  
  .main-content {
    padding: 0.75rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .card-body h2 {
    font-size: 1.25rem;
  }
  
  .table {
    font-size: 0.75rem;
  }
  
  .btn {
    padding: 0.4rem 0.5rem;
    font-size: 0.7rem;
  }
  
  .mb-3 {
    margin-bottom: 0.75rem;
  }
}

