/* ===== Base Styles ===== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #10b981;
  --dark: #1e293b;
  --darker: #0f172a;
  --light: #f8fafc;
  --gray: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --card-bg: rgba(255, 255, 255, 0.96);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f1f5f9;
  color: var(--dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== Layout Styles ===== */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--darker);
  color: var(--light);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem 0;
  transition: all 0.3s ease;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.main-content {
  padding: 2rem;
  background-color: #f1f5f9;
}

/* ===== Sidebar Styles ===== */
.sidebar-header {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header h2 {
  font-weight: 600;
  font-size: 1.25rem;
  color: white;
}

.menu-category {
  margin-top: 1rem;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-title:hover {
  color: white;
}

.category-title svg {
  transition: transform 0.2s ease;
}

.menu-category.active .category-title svg {
  transform: rotate(90deg);
}

.submenu {
  padding-left: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.menu-category.active .submenu {
  max-height: 500px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem 0.75rem 3.75rem;
  color: var(--gray);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link:hover::before, .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

/* ===== Dashboard Sections ===== */
.dashboard-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.section-card {
  background: var(--card-bg);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.section-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--darker);
}

/* ===== CRUD Styles ===== */
.crud-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.crud-links a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--dark);
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.crud-links a:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ===== Form Styles ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--darker);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

/* ===== Table Styles ===== */
.table-container {
  background: white;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  background: #f8fafc;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--darker);
}

table td {
  padding: 1rem;
  border-top: 1px solid #f1f5f9;
}

table tr:hover td {
  background: #f8fafc;
}

/* ===== Utility Classes ===== */
.text-primary {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.bg-primary {
  background: var(--primary);
}

.bg-success {
  background: var(--success);
}

.bg-warning {
  background: var(--warning);
}

.bg-danger {
  background: var(--danger);
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1.5rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-card {
  animation: fadeIn 0.4s ease forwards;
}

.section-card:nth-child(1) { animation-delay: 0.1s; }
.section-card:nth-child(2) { animation-delay: 0.2s; }
.section-card:nth-child(3) { animation-delay: 0.3s; }
.section-card:nth-child(4) { animation-delay: 0.4s; }
.section-card:nth-child(5) { animation-delay: 0.5s; }
.section-card:nth-child(6) { animation-delay: 0.6s; }
.section-card:nth-child(7) { animation-delay: 0.7s; }