/* Modern Admin Panel Styles */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #06b6d4;
  --light-color: #f8fafc;
  --dark-color: #1e293b;
  --border-color: #e2e8f0;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  height: 100%;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
  background-color: #f8fafc;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* Focus styles */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
  outline: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: 2.25rem;
}

h2 {
  font-size: 1.875rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  transition: all 0.2s ease-in-out;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

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

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: white;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: transparent;
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Forms */
.form-control {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  transition: all 0.2s ease-in-out;
  background-color: white;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.form-label {
  font-weight: 500;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Cards */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background-color: white;
  overflow: hidden;
}

.card-header {
  background-color: var(--light-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Alerts */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.alert-danger {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.alert-success {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

.alert-warning {
  background-color: #fffbeb;
  border-color: #fed7aa;
  color: #d97706;
}

.alert-info {
  background-color: #f0f9ff;
  border-color: #bae6fd;
  color: #0284c7;
}

/* Utilities */
.text-muted {
  color: var(--text-muted) !important;
}

.bg-light {
  background-color: var(--light-color) !important;
}

.border {
  border: 1px solid var(--border-color) !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
  box-shadow: var(--shadow-md) !important;
}

.rounded {
  border-radius: var(--radius-md) !important;
}

.rounded-lg {
  border-radius: var(--radius-lg) !important;
}

/* Admin Layout Styles */
.admin-layout {
  display: flex;
  height: 100vh;
  background-color: #f8fafc;
}

.admin-sidebar {
  width: 300px;
  background: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.18rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
}

.brand {
  display: flex;
  align-items: center;
  color: white;
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
}

.brand i {
  font-size: 1.5rem;
}

.brand-text {
  margin-left: 0.5rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 1.25rem;
  margin-bottom: 0.75rem;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  color: var(--dark-color);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  font-weight: 500;
}

.nav-link:hover {
  background-color: var(--light-color);
  color: var(--primary-color);
  text-decoration: none;
}

.nav-link.active {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
  border-left-color: var(--primary-color);
  font-weight: 600;
}

.nav-link i {
  width: 20px;
  text-align: center;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-header {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  z-index: 999;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: flex-start;
}

.header-right {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--dark-color);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark-color);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  background-color: #f8fafc;
}

/* Auth Layout */
.auth-layout {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
}

.auth-header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem 0;
}

.auth-header .brand {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* Login Partial Styles */
.navbar-nav .nav-link {
  color: var(--dark-color) !important;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.navbar-nav .nav-link:hover {
  background-color: var(--light-color);
  color: var(--primary-color) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 1050;
  }

  .admin-sidebar.show {
    transform: translateX(0);
  }

  .admin-main {
    width: 100%;
  }

  .admin-content {
    padding: 1rem;
  }

  .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .form-control {
    padding: 0.875rem 1rem;
  }
}

/* Dashboard Styles */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
}

.welcome-section {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  color: white;
  padding: 3rem 2rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  text-align: center;
}

.welcome-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.welcome-subtitle {
  font-size: 1.125rem;
  opacity: 0.9;
  margin: 0;
}

.dashboard-cards {
  margin-bottom: 3rem;
}

.dashboard-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  height: 100%;
  transition: all 0.3s ease;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.card-icon i {
  font-size: 1.5rem;
  color: white;
}

.card-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--dark-color);
}

.card-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.quick-actions {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--dark-color);
}

.quick-action-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.quick-action-item:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-action-item i {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  display: block;
}

.quick-action-item span {
  font-weight: 500;
  color: var(--dark-color);
}

/* Entity List Styles */
.entity-list {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem - 75px);
  min-height: 0; /* Allow flex shrinking */
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.header-content {
  flex: 1;
}

.entity-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

.entity-description {
  color: var(--text-muted);
  font-size: 1.125rem;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.search-section {
  margin-bottom: 2rem;
}

.search-form {
  max-width: 500px;
}

.search-input-group {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.search-results-info {
  padding: 0.5rem 0.75rem;
  background-color: var(--light-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary-color);
}

.search-results-info strong {
  color: var(--primary-color);
}

.data-section {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flex shrinking */
}

.data-card {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flex shrinking */
}

/* Detail View Styles */
.detail-view {
  max-width: 1000px;
  margin: 0 auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-color);
  margin: 0;
}

.detail-actions {
  display: flex;
  gap: 1rem;
}

.detail-content {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.detail-form {
  padding: 2rem;
}

.form-sections {
  margin-bottom: 2rem;
}

.form-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-color);
  display: inline-block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.form-group {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

/* Login Styles */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 2rem;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border-color);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.login-icon i {
  font-size: 2rem;
  color: white;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

.login-subtitle {
  color: var(--text-muted);
  margin: 0;
}

.login-form {
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.input-group-text {
  background-color: var(--light-color);
  border-color: var(--border-color);
  color: var(--text-muted);
}

/* Grid Overrides */
.mvc-grid {
  border: none !important;
  font-family: inherit;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flex shrinking */
  flex: 1; /* Take up available space */
}

.mvc-grid-table {
  flex: 1;
  overflow: auto; /* Allow both horizontal and vertical scrolling */
  max-height: calc(100vh - 200px); /* Set max height for scrolling */
}

.mvc-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: max-content; /* Allow table to expand beyond container */
}

/* Make table header sticky */
.mvc-grid thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--light-color);
}

/* Ensure columns have minimum width */
.mvc-grid th,
.mvc-grid td {
  min-width: 120px;
}

.mvc-grid th {
  background-color: var(--light-color);
  color: var(--dark-color);
  font-weight: 600;
  padding: 1rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.mvc-grid th:last-child {
  border-right: none;
}

.mvc-grid td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: middle;
}

.mvc-grid td:last-child {
  border-right: none;
}

.mvc-grid tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

.mvc-grid .mvc-grid-pager {
  background-color: var(--light-color);
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  flex-shrink: 0; /* Prevent pager from shrinking */
  margin-top: auto; /* Push pager to bottom */
}

.mvc-grid .mvc-grid-pager a {
  color: var(--primary-color);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.mvc-grid .mvc-grid-pager a:hover {
  background-color: var(--primary-color);
  color: white;
}

.mvc-grid .mvc-grid-pager .current {
  background-color: var(--primary-color);
  color: white;
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  border-radius: var(--radius-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
  .admin-content {
    padding: 1rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .welcome-section {
    padding: 2rem 1rem;
  }

  .welcome-title {
    font-size: 2rem;
  }

  .dashboard-card {
    padding: 1.5rem;
  }

  .list-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .search-input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .detail-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .login-card {
    padding: 2rem;
  }
}

@media (max-width: 576px) {
  .admin-content {
    padding: 0.75rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .welcome-title {
    font-size: 1.75rem;
  }

  .entity-title {
    font-size: 1.5rem;
  }

  .detail-title {
    font-size: 1.5rem;
  }
}

/* User Management Styles */
.user-management {
  padding: 2rem;
}

.management-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.management-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-color);
  margin: 0;
  display: flex;
  align-items: center;
}

.management-description {
  color: var(--text-muted);
  margin: 0.5rem 0 0 0;
  font-size: 1rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

@media (max-width: 768px) {
  .management-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

/* Logout Page Styles */
.logout-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2rem;
}

.logout-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.logout-header {
  margin-bottom: 2rem;
}

.logout-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: white;
  font-size: 2rem;
}

.logout-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.logout-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 0;
}

.logout-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.logout-actions .btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
}
