/* CSS Variables */
:root {
  --primary-color: #333;
  --secondary-color: #666;
  --accent-color: #007bff;
  --background-color: #fafafa;
  --white: #fff;
  --border-color: #ddd;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
  --border-radius: 8px;
  --transition: all 0.3s ease;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  scroll-behavior: smooth;
  background: var(--background-color);
  line-height: 1.6;
  color: var(--primary-color);
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--accent-color);
  color: var(--white);
  padding: 8px;
  text-decoration: none;
  border-radius: var(--border-radius);
  z-index: 10000;
}

.skip-link:focus {
  top: 6px;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.logo {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent-color);
  transition: var(--transition);
}

/* Burger Menu */
.burger {
  width: 30px;
  height: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: var(--transition);
  background: none;
  border: none;
}

.burger:hover {
  background: var(--background-color);
}

.burger div {
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
  transition: var(--transition);
}

.burger.active div:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.burger.active div:nth-child(2) {
  opacity: 0;
}

.burger.active div:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Side Menu */
.side-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--white);
  transition: var(--transition);
  box-shadow: var(--shadow);
  z-index: 2000;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.side-menu.active {
  left: 0;
}

.side-menu h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-size: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.side-menu ul {
  list-style: none;
}

.side-menu li {
  margin-bottom: 0.5rem;
}

.side-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--secondary-color);
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.side-menu a:hover,
.side-menu a:focus {
  background: var(--background-color);
  color: var(--primary-color);
  transform: translateX(5px);
}

.side-menu a.active {
  background: var(--accent-color);
  color: var(--white);
  font-weight: bold;
}

.menu-divider {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

/* Main Content */
main {
  margin-left: 0;
  padding: 1rem;
  min-height: calc(100vh - 140px);
  transition: var(--transition);
}

main.side-menu-active {
  margin-left: 280px;
}

/* Alerts Container */
.alerts-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1500;
  max-width: 400px;
}

.alert {
  margin-bottom: 0.5rem;
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideInRight 0.3s ease;
}

.alert-success {
  background: var(--success-color);
  color: var(--white);
}

.alert-danger {
  background: var(--danger-color);
  color: var(--white);
}

.alert-warning {
  background: var(--warning-color);
  color: var(--primary-color);
}

.alert-info {
  background: var(--info-color);
  color: var(--white);
}

.alert-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  margin-left: 1rem;
  opacity: 0.7;
  transition: var(--transition);
}

.alert-close:hover {
  opacity: 1;
}

/* Content Wrapper */
.content-wrapper {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: 1rem;
}

/* Footer */
footer {
  background: var(--white);
  border-top: 1px solid var(--border-color);
  padding: 1rem;
  text-align: center;
  color: var(--secondary-color);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--primary-color);
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-control.is-invalid {
  border-color: var(--danger-color);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-primary {
  background: var(--accent-color);
  color: var(--white);
}

.btn-primary:hover {
  background: #0056b3;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary-color);
  color: var(--white);
}

.btn-secondary:hover {
  background: #545b62;
}

.btn-success {
  background: var(--success-color);
  color: var(--white);
}

.btn-danger {
  background: var(--danger-color);
  color: var(--white);
}

.btn-warning {
  background: var(--warning-color);
  color: var(--primary-color);
}

.btn-info {
  background: var(--info-color);
  color: var(--white);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Card Styles */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card-header {
  padding: 1rem;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.card-body {
  padding: 1rem;
}

.card-footer {
  padding: 1rem;
  background: var(--background-color);
  border-top: 1px solid var(--border-color);
}

/* Table Styles */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: var(--background-color);
  font-weight: 600;
}

.table tbody tr:hover {
  background: var(--background-color);
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.25rem;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--accent-color);
  color: var(--white);
}

.badge-success {
  background: var(--success-color);
  color: var(--white);
}

.badge-danger {
  background: var(--danger-color);
  color: var(--white);
}

.badge-warning {
  background: var(--warning-color);
  color: var(--primary-color);
}

.badge-info {
  background: var(--info-color);
  color: var(--white);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.me-3 { margin-right: 1rem; }

.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-3 { margin-left: 1rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }

.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }

.cursor-pointer { cursor: pointer; }

.transition-all { transition: all 0.2s ease-in-out; }

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .side-menu {
    width: 100%;
    left: -100%;
  }
  
  main.side-menu-active {
    margin-left: 0;
  }
  
  .content-wrapper {
    padding: 1rem;
  }
  
  .alerts-container {
    left: 20px;
    right: 20px;
    max-width: none;
  }
  
  .table {
    font-size: 0.875rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0.75rem;
  }
  
  .logo {
    font-size: 1.2rem;
  }
  
  .content-wrapper {
    padding: 0.75rem;
  }
  
  .alert {
    padding: 0.75rem;
    font-size: 0.875rem;
  }
  
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .btn + .btn {
    margin-left: 0;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #f8f9fa;
    --secondary-color: #adb5bd;
    --background-color: #212529;
    --white: #343a40;
    --border-color: #495057;
  }
  
  body {
    background: var(--background-color);
    color: var(--primary-color);
  }
  
  .card,
  .content-wrapper {
    background: var(--white);
  }
  
  .form-control {
    background: var(--white);
    color: var(--primary-color);
  }
  
  .table th {
    background: var(--white);
  }
}