/* ===== CSS Variables ===== */
:root {
  --primary-color: #05386B;
  --secondary-color: #379683;
  --accent-color: #5CDB95;
  --light-accent: #8EE4AF;
  --background-color: #EDF5E1;
  --text-dark: #2c3e50;
  --text-light: #ffffff;
  --border-color: #e9ecef;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  --gradient-accent: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
  --gradient-light: linear-gradient(135deg, var(--light-accent), var(--background-color));
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

/* ===== Dark Mode Variables ===== */
[data-theme="dark"] {
  --background-color: #1a1a1a;
  --text-dark: #ffffff;
  --border-color: #404040;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

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

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-bottom: 1rem;
}

.display-4 {
  font-weight: 700;
}

/* ===== Layout ===== */
.main-content {
  margin-top: 80px;
  min-height: calc(100vh - 160px);
  padding: 2rem 0;
}

.section-content {
  padding: 2rem 0;
}

/* ===== Navigation ===== */
.navbar {
  background: var(--gradient-primary) !important;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

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

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

.list-group-item {
  border: none;
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

.list-group-item:hover {
  background: var(--gradient-light);
  transform: translateX(5px);
}

.list-group-item.active {
  background: var(--gradient-accent);
  border-color: var(--accent-color);
}

/* ===== Cards ===== */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

.card-body {
  padding: 2rem;
}

.welcome-card {
  background: var(--gradient-light);
  padding: 3rem;
  border-radius: var(--border-radius);
  text-align: center;
  box-shadow: var(--shadow);
}

/* ===== Forms ===== */
.form-control,
.form-select {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 0.2rem rgba(92, 219, 149, 0.25);
}

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

/* ===== Buttons ===== */
.btn {
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-light);
}

.btn-primary:hover {
  background: var(--gradient-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(5, 56, 107, 0.3);
}

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

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

.btn-success {
  background: var(--gradient-accent);
  color: var(--text-light);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* ===== Results Section ===== */
.result-card {
  background: var(--gradient-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent-color);
}

.result-summary {
  background: var(--gradient-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.progress {
  height: 20px;
  border-radius: 10px;
  background-color: rgba(92, 219, 149, 0.2);
}

.progress-bar {
  background: var(--gradient-accent);
  border-radius: 10px;
  transition: width 0.6s ease;
}

/* ===== Tips Section ===== */
.tip-card {
  background: var(--gradient-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  height: 100%;
  border-left: 4px solid var(--secondary-color);
  transition: var(--transition);
}

.tip-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.tip-card h5 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

/* ===== History Section ===== */
.history-item {
  background: var(--gradient-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent-color);
  transition: var(--transition);
}

.history-item:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow);
}

.history-date {
  color: var(--secondary-color);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===== Comparison Section ===== */
.comparison-table {
  background: var(--gradient-light);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table th {
  background: var(--gradient-primary);
  color: var(--text-light);
  border: none;
  padding: 1rem;
}

.table td {
  padding: 1rem;
  border-color: var(--border-color);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(92, 219, 149, 0.1);
}

/* ===== Modals ===== */
.modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.modal-body {
  padding: 2rem;
}

/* ===== Charts ===== */
#progressChart {
  max-width: 100%;
  height: auto;
}

/* ===== Ads ===== */
.ad-banner {
  background: var(--gradient-light);
  border-radius: var(--border-radius);
  padding: 1rem;
  text-align: center;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-banner .adsbygoogle {
  display: block;
  width: 100%;
}

/* ===== Alerts ===== */
.alert {
  border: none;
  border-radius: var(--border-radius);
  border-left: 4px solid;
}

.alert-success {
  background: rgba(92, 219, 149, 0.1);
  border-left-color: var(--accent-color);
  color: var(--primary-color);
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  border-left-color: #ffc107;
  color: #856404;
}

.alert-danger {
  background: rgba(220, 53, 69, 0.1);
  border-left-color: #dc3545;
  color: #721c24;
}

.alert-info {
  background: rgba(55, 150, 131, 0.1);
  border-left-color: var(--secondary-color);
  color: var(--primary-color);
}

/* ===== Footer ===== */
.footer {
  background: var(--gradient-primary);
  margin-top: auto;
}

.footer a {
  color: var(--light-accent);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: var(--text-light);
  text-decoration: underline;
}

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

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

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: #2d2d2d;
  border-color: #404040;
  color: #ffffff;
}

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

[data-theme="dark"] .welcome-card,
[data-theme="dark"] .result-card,
[data-theme="dark"] .tip-card,
[data-theme="dark"] .history-item {
  background: #2d2d2d;
  color: #ffffff;
}

[data-theme="dark"] .table {
  color: #ffffff;
}

[data-theme="dark"] .table td {
  border-color: #404040;
}

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

/* ===== Private Mode ===== */
.private-mode .sensitive-data {
  filter: blur(5px);
  transition: filter 0.3s ease;
}

.private-mode .sensitive-data:hover {
  filter: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .main-content {
    margin-top: 70px;
    padding: 1rem 0;
  }
  
  .section-content {
    padding: 1rem 0;
  }
  
  .welcome-card {
    padding: 2rem 1rem;
  }
  
  .card-body {
    padding: 1.5rem;
  }
  
  .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
  
  .display-4 {
    font-size: 2rem;
  }
  
  .navbar-brand {
    font-size: 1.2rem;
  }
  
  .result-card,
  .tip-card,
  .history-item {
    padding: 1rem;
  }
  
  .modal-body {
    padding: 1.5rem;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 1rem;
  }
  
  .welcome-card {
    padding: 1.5rem 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
  }
  
  .btn-lg {
    padding: 0.75rem 1.25rem;
  }
  
  .display-4 {
    font-size: 1.75rem;
  }
  
  .result-card,
  .tip-card,
  .history-item {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .d-flex.gap-2 {
    flex-direction: column;
  }
  
  .d-flex.gap-2 .btn {
    margin-bottom: 0.5rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-in {
  animation: slideIn 0.6s ease-out;
}

/* ===== Loading States ===== */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear 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-accent {
  background: var(--gradient-accent);
}

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

.border-gradient {
  border: 2px solid;
  border-image: var(--gradient-accent) 1;
}

.shadow-lg {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

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

/* ===== Print Styles ===== */
@media print {
  .navbar,
  .offcanvas,
  .modal,
  .footer,
  .ad-banner,
  .btn {
    display: none !important;
  }
  
  .main-content {
    margin-top: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ===== Accessibility ===== */
.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 for keyboard navigation */
button:focus,
.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: 0 4px 6px rgba(0, 0, 0, 0.5);
  }
  
  .card {
    border: 2px solid var(--border-color);
  }
  
  .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;
  }
}
