/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

/* CSS Variables */
:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --dark-color: #1f2937;
  --light-color: #f9fafb;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--gray-900);
  line-height: 1.6;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 3rem;
  width: 100%;
  max-width: 450px;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--gray-600);
  font-size: 0.95rem;
}

/* Dashboard Layout */
.dashboard-container {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.mobile-menu-toggle:hover {
  transform: scale(1.1);
}

.mobile-menu-toggle i {
  font-size: 1.5rem;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  color: white;
  padding: 2rem 0;
  box-shadow: var(--shadow-xl);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease, var(--transition);
  z-index: 1000;
}

.sidebar-header {
  padding: 0 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-menu {
  list-style: none;
  padding: 1.5rem 0;
}

.sidebar-menu li {
  margin-bottom: 0.5rem;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.5rem;
  color: var(--gray-300);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.sidebar-menu a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  transform: scaleY(0);
  transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: rgba(99, 102, 241, 0.1);
  color: white;
}

.sidebar-menu a:hover::before,
.sidebar-menu a.active::before {
  transform: scaleY(1);
}

.sidebar-menu a i {
  margin-right: 0.75rem;
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2rem;
}

.topbar {
  background: white;
  padding: 1.25rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  text-align: right;
}

.user-info .name {
  font-weight: 600;
  color: var(--gray-900);
}

.user-info .role {
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
}

.card-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select.form-control {
  cursor: pointer;
  background: white;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: 0.5rem;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-color)
  );
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning-color), #d97706);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, var(--info-color), #2563eb);
  color: white;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

thead {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
}

thead th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: var(--transition);
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody td {
  padding: 1rem;
  color: var(--gray-700);
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInDown 0.4s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--danger-color);
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border-left: 4px solid var(--warning-color);
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-left: 4px solid var(--info-color);
}

/* Action Buttons */
.actions {
  display: flex;
  gap: 0.5rem;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-card p {
  font-size: 1rem;
  opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Hide sidebar by default on mobile */
  .sidebar {
    transform: translateX(-100%);
  }

  /* Show sidebar when active */
  .sidebar.active {
    transform: translateX(0);
  }

  /* Overlay for sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Main content adjustments */
  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 4rem; /* Space for mobile menu button */
  }

  /* Login card */
  .login-card {
    padding: 1.5rem;
    margin: 1rem;
  }

  .login-header h1 {
    font-size: 1.5rem;
  }

  /* Topbar */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
  }

  .topbar-title h1 {
    font-size: 1.25rem;
  }

  .topbar-user {
    width: 100%;
    justify-content: space-between;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 1.5rem;
  }

  /* Card */
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .card-header h2 {
    font-size: 1.25rem;
  }

  /* Tables - make scrollable on mobile */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px; /* Ensure table doesn't shrink too much */
  }

  thead th {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
  }

  tbody td {
    padding: 0.75rem 0.5rem;
    font-size: 0.875rem;
  }

  /* Buttons */
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }

  .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }

  /* Actions */
  .actions {
    flex-direction: column;
    gap: 0.25rem;
  }

  .actions .btn {
    width: 100%;
  }

  /* Form groups - make responsive grid single column */
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Alert */
  .alert {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .main-content {
    padding: 0.5rem;
    padding-top: 4rem;
  }

  .login-card {
    padding: 1rem;
  }

  .topbar {
    padding: 0.75rem;
  }

  .card {
    padding: 0.75rem;
  }

  .stat-card h3 {
    font-size: 2rem;
  }

  .stat-card p {
    font-size: 0.875rem;
  }

  table {
    font-size: 0.75rem;
  }

  .form-control {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-color);
  color: white;
}

.badge-danger {
  background: var(--danger-color);
  color: white;
}

.badge-warning {
  background: var(--warning-color);
  color: white;
}

.badge-info {
  background: var(--info-color);
  color: white;
}
