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

/* Dark Mode Variables */
[data-theme="dark"] {
  --background-light: #1a1a1a;
  --text-dark: #e0e0e0;
  --gradient-bg: linear-gradient(135deg, #2d2d2d, #1a1a1a);
  --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--gradient-bg);
  min-height: 100vh;
  padding-top: 80px;
  transition: var(--transition);
}

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

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

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.btn-success {
  background: var(--gradient-accent);
  border: none;
  color: var(--text-dark);
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  color: var(--text-dark);
}

.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .card {
  background: rgba(45, 45, 45, 0.95);
  color: var(--text-dark);
}

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

.form-control, .form-select {
  border-radius: var(--border-radius);
  border: 2px solid #e9ecef;
  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);
}

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

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  transition: var(--transition);
}

.navbar-brand:hover {
  transform: scale(1.05);
}

/* Hero Section */
.hero-section {
  padding: 4rem 0;
  background: var(--gradient-accent);
  border-radius: var(--border-radius);
  margin-bottom: 3rem;
  color: var(--text-dark);
  position: relative;
  overflow: hidden;
}

.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 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

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

/* Calculator Section */
.calculator-section .card-header {
  background: var(--gradient-primary) !important;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Results Section */
.results-section {
  animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chart Container */
#progressChart {
  max-width: 100%;
  height: auto !important;
  border-radius: var(--border-radius);
}

/* Suggestion Cards */
.suggestion-card {
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.suggestion-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
}

/* History Items */
.history-item {
  padding: 1rem;
  border: 1px solid #e9ecef;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.8);
  transition: var(--transition);
}

[data-theme="dark"] .history-item {
  background: rgba(45, 45, 45, 0.8);
  border-color: #495057;
}

.history-item:hover {
  background: rgba(92, 219, 149, 0.1);
  border-color: var(--accent-color);
}

.history-item h6 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .history-item h6 {
  color: var(--accent-color);
}

.history-item small {
  color: #6c757d;
}

/* Comparison Table */
.comparison-table {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius);
  overflow: hidden;
}

[data-theme="dark"] .comparison-table {
  background: rgba(45, 45, 45, 0.95);
}

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

.comparison-table td {
  padding: 1rem;
  border-color: #e9ecef;
}

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

/* Ad Containers */
.ad-container {
  text-align: center;
  margin: 2rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  border: 1px dashed #ccc;
}

.ad-container::before {
  content: 'Publicidade';
  display: block;
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

/* Theme Toggle */
#themeToggle {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#themeToggle:hover {
  transform: rotate(180deg);
}

/* Modals */
.modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .modal-content {
  background: rgba(45, 45, 45, 0.98);
  color: var(--text-dark);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Offcanvas */
.offcanvas {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .offcanvas {
  background: rgba(45, 45, 45, 0.98);
  color: var(--text-dark);
}

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

/* Loading Animation */
.loading {
  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); }
}

/* Result Cards */
.result-card {
  background: var(--gradient-accent);
  color: var(--text-dark);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-light);
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-section {
    padding: 2rem 0;
  }
  
  .hero-section h1 {
    font-size: 2.5rem;
  }
  
  .result-value {
    font-size: 1.5rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .btn-lg {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
  }
}

@media (max-width: 576px) {
  body {
    padding-top: 70px;
  }
  
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .modal-dialog {
    margin: 1rem;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.4);
  }
  
  .card {
    border: 2px solid var(--primary-color);
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

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

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

/* 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;
}

/* Error States */
.is-invalid {
  border-color: #dc3545 !important;
}

.invalid-feedback {
  display: block;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Success States */
.is-valid {
  border-color: var(--accent-color) !important;
}

.valid-feedback {
  display: block;
  color: var(--secondary-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}
