/* Updated design tokens to match elegant design brief */
:root {
  --primary-color: #8b1538;
  --secondary-color: #a0616a;
  --accent-color: #b91c3c;
  --success-color: #10b981;
  --info-color: #8b1538;
  --warning-color: #f59e0b;
  --danger-color: #dc2626;
  --background-color: #ffffff;
  --card-background: #fefefe;
  --text-primary: #2d1b1e;
  --text-secondary: #6b4c57;
  --border-color: #f4e6e9;
  --shadow-color: rgba(139, 21, 56, 0.1);
  --maroon-light: #f8f1f3;
  --maroon-medium: #e8d5d9;
  --maroon-dark: #6b1229;
}

/* Enhanced typography with elegant fonts */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@400;500;600&display=swap");

body {
  background: linear-gradient(135deg, #ffffff 0%, #f8f1f3 100%);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Added background image support for index and login pages */
body.index-page {
  background: linear-gradient(rgba(139, 21, 56, 0.05), rgba(248, 241, 243, 0.9)),
    url("/placeholder.svg?height=1080&width=1920") center / cover no-repeat fixed;
}

body.login-page {
  background: linear-gradient(rgba(139, 21, 56, 0.8), rgba(107, 18, 41, 0.8)),
    url("/placeholder.svg?height=1080&width=1920") center / cover no-repeat fixed;
}

/* Elegant header with gradient and improved branding */
.navbar {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--maroon-dark) 100%) !important;
  box-shadow: 0 4px 20px var(--shadow-color);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-family: "Playfair Display", serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-brand .logo-icon {
  font-size: 2rem;
  margin-right: 0.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Enhanced logo icon styling for proper image display */
.navbar-brand .logo-icon img,
.footer-brand .logo-icon img {
  height: 40px;
  width: auto;
  margin-right: 0.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Enhanced card design with elegant shadows and borders */
.card {
  border: none;
  border-radius: 16px;
  background: var(--background-color);
  box-shadow: 0 8px 32px var(--shadow-color);
  transition: all 0.3s ease;
  overflow: hidden;
  border-top: 4px solid var(--accent-color);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 21, 56, 0.15);
}

/* Elegant header with gradient and improved branding */
.navbar {
  background: linear-gradient(135deg, var(--primary-color) 0%, #374151 100%) !important;
  box-shadow: 0 4px 20px var(--shadow-color);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-brand .logo-icon {
  font-size: 2rem;
  margin-right: 0.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Enhanced logo icon styling for proper image display */
.navbar-brand .logo-icon img,
.footer-brand .logo-icon img {
  height: 40px;
  width: auto;
  margin-right: 0.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Enhanced card design with elegant shadows and borders */
.card {
  border: none;
  border-radius: 16px;
  background: var(--background-color);
  box-shadow: 0 8px 32px var(--shadow-color);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(31, 41, 55, 0.15);
}

/* Elegant card headers with gradient theme */
.card-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--maroon-dark) 100%);
  border: none;
  border-radius: 16px 16px 0 0 !important;
  padding: 1.5rem;
  color: white;
}

.card-header.bg-success {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.card-header.bg-info {
  background: linear-gradient(135deg, var(--info-color) 0%, #3b82f6 100%);
}

.card-header.bg-warning {
  background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
}

.card-header.bg-secondary {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--maroon-dark) 100%);
}

/* Enhanced table design with improved spacing and colors */
.table {
  margin-bottom: 0;
}

/* Enhanced table striping with more visible alternating colors */
.table-striped > tbody > tr:nth-of-type(odd) > td,
.table-striped > tbody > tr:nth-of-type(odd) > th {
  background-color: var(--maroon-light) !important;
}

.table-striped > tbody > tr:nth-of-type(even) > td,
.table-striped > tbody > tr:nth-of-type(even) > th {
  background-color: rgba(255, 255, 255, 0.95) !important;
}

.table th {
  background: var(--card-background);
  border: none;
  font-family: "Playfair Display", serif;
  font-weight: 600;
  color: var(--text-primary);
  padding: 1rem;
  font-size: 0.95rem;
}

.table td {
  border: none;
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

/* Enhanced table hover effects with better visibility */
.table-hover tbody tr:hover {
  background: linear-gradient(135deg, rgba(139, 21, 56, 0.08) 0%, rgba(185, 28, 60, 0.08) 100%) !important;
  transform: scale(1.005);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(139, 21, 56, 0.15);
}

/* Added specific styling for audit table to ensure consistent alternating colors */
.audit-table tbody tr:nth-child(odd) {
  background-color: var(--maroon-light) !important;
}

.audit-table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.95) !important;
}

.audit-table tbody tr:hover {
  background: linear-gradient(135deg, rgba(139, 21, 56, 0.12) 0%, rgba(185, 28, 60, 0.12) 100%) !important;
  transform: scale(1.005);
  box-shadow: 0 4px 12px rgba(139, 21, 56, 0.2);
}

/* Enhanced alert styling with better animations */
.alert {
  border-radius: 12px;
  border: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  animation: slideInFromTop 0.4s ease-out;
}

@keyframes slideInFromTop {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.alert-success {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #166534;
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  border-left: 4px solid var(--danger-color);
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-left: 4px solid var(--warning-color);
}

.alert-info {
  background: linear-gradient(135deg, var(--maroon-light) 0%, var(--maroon-medium) 100%);
  color: var(--maroon-dark);
  border-left: 4px solid var(--primary-color);
}

.alert .btn-close {
  filter: none;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.alert .btn-close:hover {
  opacity: 1;
}

/* Enhanced button styles with gradients and animations */
.btn {
  border-radius: 12px;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  box-shadow: 0 4px 15px rgba(139, 21, 56, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 21, 56, 0.4);
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--maroon-dark) 100%);
}

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

.btn-outline-primary:hover {
  background: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 21, 56, 0.3);
}

/* Enhanced form controls with elegant styling */
.form-control,
.form-select {
  border-radius: 12px;
  border: 2px solid var(--border-color);
  padding: 0.75rem 1rem;
  font-family: "Inter", sans-serif;
  transition: all 0.3s ease;
  background: var(--background-color);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(139, 21, 56, 0.15);
  transform: translateY(-1px);
}

/* Enhanced modal design */
.modal-content {
  border-radius: 20px;
  border: none;
  box-shadow: 0 20px 60px rgba(31, 41, 55, 0.3);
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  border: none;
  padding: 2rem;
}

.modal-body {
  padding: 2rem;
}

/* Enhanced progress bars with gradients */
.progress {
  height: 24px;
  border-radius: 12px;
  background: var(--card-background);
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
  border-radius: 12px;
  transition: all 0.6s ease;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Enhanced statistics cards */
.stats-card {
  background: linear-gradient(135deg, var(--maroon-light) 0%, rgba(139, 21, 56, 0.05) 100%);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  border-top: 4px solid var(--primary-color);
}

.stats-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(139, 21, 56, 0.2);
}

.stats-number {
  font-family: "Playfair Display", serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

/* Footer styling */
.footer {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--maroon-dark) 100%);
  color: white;
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.footer h5 {
  font-family: "Playfair Display", serif;
  font-weight: 600;
  margin-bottom: 1rem;
}

.footer-brand {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--maroon-light);
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .navbar-brand {
    font-size: 1.4rem;
  }

  .card-header {
    padding: 1rem;
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .stats-number {
    font-size: 2rem;
  }

  .progress {
    height: 20px;
  }
}

@media (max-width: 576px) {
  .card-body {
    padding: 1rem;
  }

  .modal-header,
  .modal-body {
    padding: 1.5rem;
  }

  .footer {
    padding: 2rem 0 1.5rem;
  }
}

/* Auto-refresh indicator */
.refresh-indicator {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.refresh-indicator.show {
  opacity: 1;
}

/* Added elegant toast notification system styles */
.elegant-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(139, 21, 56, 0.3);
  padding: 0;
  min-width: 320px;
  max-width: 500px;
  z-index: 9999;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  overflow: hidden;
}

.elegant-toast.show {
  transform: translateX(0);
  opacity: 1;
  animation: slideInBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInBounce {
  0% {
    transform: translateX(400px) scale(0.8);
    opacity: 0;
  }
  60% {
    transform: translateX(-10px) scale(1.05);
    opacity: 0.9;
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.elegant-toast.toast-success {
  border-color: var(--success-color);
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.elegant-toast.toast-error {
  border-color: var(--danger-color);
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.elegant-toast.toast-warning {
  border-color: var(--warning-color);
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.elegant-toast.toast-info {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--maroon-light) 0%, var(--maroon-medium) 100%);
}

.toast-content {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  gap: 0.75rem;
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  animation: iconPulse 0.6s ease-out;
}

@keyframes iconPulse {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.toast-success .toast-icon {
  background: var(--success-color);
  color: white;
}

.toast-success .toast-icon::before {
  content: "✓";
  font-weight: bold;
  animation: checkmarkDraw 0.5s ease-out 0.2s both;
}

.toast-error .toast-icon {
  background: var(--danger-color);
  color: white;
}

.toast-error .toast-icon::before {
  content: "✕";
  font-weight: bold;
  animation: errorShake 0.5s ease-out 0.2s both;
}

.toast-warning .toast-icon {
  background: var(--warning-color);
  color: white;
}

.toast-warning .toast-icon::before {
  content: "⚠";
  font-weight: bold;
  animation: warningBounce 0.5s ease-out 0.2s both;
}

.toast-info .toast-icon {
  background: var(--primary-color);
  color: white;
}

.toast-info .toast-icon::before {
  content: "ℹ";
  font-weight: bold;
  animation: infoPulse 0.5s ease-out 0.2s both;
}

@keyframes checkmarkDraw {
  0% {
    transform: scale(0) rotate(-45deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes errorShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

@keyframes warningBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes infoPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.toast-message {
  flex: 1;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
  transform: scale(1.1);
}

/* Dynamic background system with blur effects */
body.has-background {
  position: relative;
}

body.has-background::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(8px);
  opacity: 0.8;
  z-index: -2;
}

body.has-background::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(2px);
  z-index: -1;
}

/* Enhanced navigation buttons with better animations */
.elegant-nav-btn {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem !important;
  margin: 0 0.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white !important;
  text-decoration: none;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.elegant-nav-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.elegant-nav-btn:hover::before {
  left: 100%;
}

.elegant-nav-btn:hover {
  transform: translateY(-2px) scale(1.05);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 25px rgba(139, 21, 56, 0.3);
  color: white !important;
}

.elegant-nav-btn:active {
  transform: translateY(0) scale(1);
}

.btn-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
}

.elegant-nav-btn:hover .btn-icon {
  transform: scale(1.2) rotate(5deg);
}

.btn-text {
  font-size: 0.95rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Enhanced mobile responsiveness for toast notifications */
@media (max-width: 768px) {
  .elegant-toast {
    right: 10px;
    left: 10px;
    min-width: auto;
    max-width: none;
    transform: translateY(-100px);
  }

  .elegant-toast.show {
    transform: translateY(0);
  }

  .elegant-nav-btn {
    padding: 0.6rem 1rem !important;
    margin: 0 0.1rem;
  }

  .btn-text {
    font-size: 0.85rem;
  }

  .btn-icon {
    font-size: 1rem;
  }
}

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

  .toast-message {
    font-size: 0.9rem;
  }

  .elegant-nav-btn {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem !important;
  }

  .btn-text {
    font-size: 0.75rem;
  }
}

/* Added bronze medal styling with dark orange color */
.text-bronze {
  color: #cc5500 !important;
}

.bg-bronze {
  background-color: #cc5500 !important;
  color: white !important;
}

.badge.bg-bronze {
  background-color: #cc5500 !important;
  color: white !important;
  border-color: #cc5500 !important;
}

/* Enhanced sidebar navigation styling for better layout */
.sidebar-nav {
  position: sticky;
  top: 20px;
  margin-bottom: 2rem;
}

.sidebar-nav .card-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--maroon-dark) 100%);
  color: white;
  font-family: "Playfair Display", serif;
  font-weight: 600;
  border-radius: 16px 16px 0 0 !important;
}

.sidebar-nav .list-group-item {
  border: none;
  padding: 1rem 1.5rem;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.3s ease;
  background: transparent;
}

.sidebar-nav .list-group-item:hover {
  background: linear-gradient(135deg, var(--maroon-light) 0%, rgba(139, 21, 56, 0.05) 100%);
  color: var(--primary-color);
  transform: translateX(5px);
  border-left: 4px solid var(--primary-color);
}

.sidebar-nav .list-group-item.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  border-left: 4px solid var(--maroon-dark);
  font-weight: 600;
}

.sidebar-nav .list-group-item i {
  width: 20px;
  text-align: center;
  margin-right: 0.75rem;
  transition: transform 0.3s ease;
}

.sidebar-nav .list-group-item:hover i {
  transform: scale(1.1);
}

.sidebar-nav .list-group-item.active i {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Enhanced dashboard layout for better spacing */
.dashboard-container {
  min-height: calc(100vh - 120px);
}

.dashboard-stats-row {
  margin-bottom: 2rem;
}

.dashboard-stats-row .card {
  height: 100%;
  display: flex;
  align-items: center;
}

.dashboard-stats-row .card-body {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 1.5rem;
}

/* Mobile responsiveness improvements for sidebar */
@media (max-width: 768px) {
  .sidebar-nav {
    position: static;
    margin-bottom: 1rem;
  }

  .sidebar-nav .list-group-item {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .sidebar-nav .list-group-item i {
    margin-right: 0.5rem;
  }
}

@media (max-width: 576px) {
  .sidebar-nav .card-header {
    padding: 1rem;
  }

  .sidebar-nav .list-group-item {
    padding: 0.6rem 0.75rem;
  }
}
