/* CSS Variables for Color Palette */
:root {
  --primary-color: #05386B;
  --secondary-color: #379683;
  --accent-color: #5CDB95;
  --light-accent: #8EE4AF;
  --background-light: #EDF5E1;
  --text-dark: #2c3e50;
  --text-light: #ffffff;
  --shadow: rgba(5, 56, 107, 0.1);
  --gradient-primary: linear-gradient(135deg, #05386B 0%, #379683 100%);
  --gradient-secondary: linear-gradient(135deg, #379683 0%, #5CDB95 100%);
  --gradient-accent: linear-gradient(135deg, #5CDB95 0%, #8EE4AF 100%);
  --gradient-hero: linear-gradient(135deg, #05386B 0%, #379683 50%, #5CDB95 100%);
  --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --background-light: #1a1a1a;
  --text-dark: #ffffff;
  --shadow: rgba(255, 255, 255, 0.1);
}

/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--background-light);
  transition: var(--transition);
}

/* Bootstrap Overrides */
.bg-primary {
  background: var(--gradient-primary) !important;
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--gradient-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn-success {
  background: var(--gradient-secondary);
  border: none;
  transition: var(--transition);
}

.btn-success:hover {
  background: var(--gradient-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

/* Navigation Styles */
.navbar {
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px var(--shadow);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
}

.nav-link {
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--accent-color) !important;
}

/* Hero Section */
.hero-section {
  background: var(--gradient-hero);
  position: relative;
  overflow: hidden;
  padding-top: 80px;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="rgba(255,255,255,0.1)"><polygon points="1000,100 1000,0 0,100"/></svg>');
  background-size: cover;
}

.hero-section .container {
  position: relative;
  z-index: 1;
}

.text-white-75 {
  color: rgba(255, 255, 255, 0.75) !important;
}

/* Card Styles */
.card {
  border: none;
  border-radius: 15px;
  box-shadow: 0 10px 30px var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px var(--shadow);
}

.card-header {
  background: var(--gradient-primary) !important;
  border-bottom: none;
  padding: 1.5rem;
}

.card-header.bg-success {
  background: var(--gradient-secondary) !important;
}

.card-body {
  padding: 2rem;
}

/* Form Styles */
.form-control {
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: var(--transition);
  background-color: var(--background-light);
  color: var(--text-dark);
}

.form-control:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 0.2rem rgba(55, 150, 131, 0.25);
  background-color: var(--background-light);
  color: var(--text-dark);
}

.form-select {
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  transition: var(--transition);
  background-color: var(--background-light);
  color: var(--text-dark);
}

.form-select:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 0.2rem rgba(55, 150, 131, 0.25);
  background-color: var(--background-light);
  color: var(--text-dark);
}

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

/* Progress Bar Styles */
.progress {
  border-radius: 50px;
  background-color: rgba(0, 0, 0, 0.1);
}

.progress-bar {
  border-radius: 50px;
  background: var(--gradient-accent) !important;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Alert Styles */
.alert {
  border: none;
  border-radius: 10px;
  padding: 1rem 1.5rem;
}

.alert-success {
  background: linear-gradient(135deg, rgba(92, 219, 149, 0.1) 0%, rgba(142, 228, 175, 0.1) 100%);
  border-left: 4px solid var(--accent-color);
  color: var(--primary-color);
}

.alert-warning {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 235, 59, 0.1) 100%);
  border-left: 4px solid #ffc107;
  color: #856404;
}

.alert-info {
  background: linear-gradient(135deg, rgba(55, 150, 131, 0.1) 0%, rgba(92, 219, 149, 0.1) 100%);
  border-left: 4px solid var(--secondary-color);
  color: var(--primary-color);
}

.alert-danger {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(248, 215, 218, 0.1) 100%);
  border-left: 4px solid #dc3545;
  color: #721c24;
}

/* Modal Styles */
.modal-content {
  border: none;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  background: var(--gradient-primary);
  color: white;
  border-bottom: none;
  border-radius: 15px 15px 0 0;
}

.modal-title {
  font-weight: 600;
}

.btn-close {
  filter: invert(1);
}

/* Accordion Styles */
.accordion-button {
  background: var(--background-light);
  color: var(--text-dark);
  border: none;
  font-weight: 600;
}

.accordion-button:not(.collapsed) {
  background: var(--gradient-primary);
  color: white;
  box-shadow: none;
}

.accordion-button:focus {
  box-shadow: none;
  border-color: transparent;
}

/* Results Section Styles */
.result-card {
  background: var(--gradient-accent);
  color: white;
  border-radius: 15px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.result-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Saved Simulations Styles */
.simulation-item {
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition);
  background-color: var(--background-light);
}

.simulation-item:hover {
  border-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

/* Dark Mode Styles */
[data-theme="dark"] {
  background-color: #1a1a1a;
  color: #ffffff;
}

[data-theme="dark"] .card {
  background-color: #2d2d2d;
  color: #ffffff;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #3d3d3d;
  border-color: #555;
  color: #ffffff;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #3d3d3d;
  border-color: var(--secondary-color);
  color: #ffffff;
}

[data-theme="dark"] .modal-content {
  background-color: #2d2d2d;
  color: #ffffff;
}

[data-theme="dark"] .accordion-button {
  background-color: #3d3d3d;
  color: #ffffff;
}

[data-theme="dark"] .simulation-item {
  background-color: #3d3d3d;
  border-color: #555;
  color: #ffffff;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-section {
    padding-top: 100px;
    text-align: center;
  }
  
  .display-4 {
    font-size: 2rem;
  }
  
  .card-body {
    padding: 1.5rem;
  }
  
  .result-value {
    font-size: 1.5rem;
  }
  
  .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 15px;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .hero-section .display-4 {
    font-size: 1.75rem;
  }
  
  .hero-section .lead {
    font-size: 1rem;
  }
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.fade-in.show {
  opacity: 1;
  transform: translateY(0);
}

.slide-up {
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.8s ease;
}

.slide-up.show {
  transform: translateY(0);
  opacity: 1;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Utility Classes */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-gradient-primary {
  background: var(--gradient-primary);
}

.bg-gradient-secondary {
  background: var(--gradient-secondary);
}

.bg-gradient-accent {
  background: var(--gradient-accent);
}

/* Footer Styles */
footer {
  background: var(--gradient-primary) !important;
  margin-top: auto;
}

footer h5 {
  color: var(--accent-color);
  font-weight: 600;
}

/* Offcanvas Styles */
.offcanvas {
  background: var(--gradient-primary);
  color: white;
}

.offcanvas .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  transition: var(--transition);
}

.offcanvas .nav-link:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Print Styles */
@media print {
  .navbar,
  .btn,
  .modal,
  footer {
    display: none !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* Accessibility Improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Styles */
.btn:focus,
.form-control:focus,
.form-select:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --shadow: rgba(0, 0, 0, 0.5);
  }
  
  .card {
    border: 2px solid var(--text-dark);
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
