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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 2rem 1rem;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.95;
  font-weight: 300;
  margin-bottom: 1rem;
}

.header-nav {
  margin-top: 1rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 2px solid white;
  border-radius: 8px;
  display: inline-block;
  transition: all 0.3s ease;
  font-weight: 600;
}

.nav-link:hover {
  background: white;
  color: #667eea;
}

/* Main Content */
main {
  padding: 2rem;
}

section {
  margin-bottom: 2rem;
}

h2 {
  color: #333;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #667eea;
}

/* Form Styles */
.input-section {
  background: #f8f9fa;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-icon {
  cursor: help;
  color: #667eea;
  font-size: 0.9rem;
  border: 1px solid #667eea;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.currency {
  color: #666;
  font-weight: 600;
  font-size: 1rem;
  min-width: 20px;
}

.input-wrapper input {
  flex: 1;
}

input[type="number"] {
  width: 100%;
  padding: 0.75rem 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

input[type="number"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.calculate-btn {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 1rem;
}

.calculate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active {
  transform: translateY(0);
}

/* Results Section */
.results-section {
  animation: fadeIn 0.5s ease;
}

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

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.result-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid #e9ecef;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.result-card h3 {
  color: #667eea;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #667eea;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e9ecef;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row.highlight {
  background: rgba(102, 126, 234, 0.08);
  padding: 0.75rem 0.5rem;
  border-radius: 6px;
  margin: 0.25rem 0;
  border-bottom: none;
}

.result-row.total {
  background: rgba(102, 126, 234, 0.15);
  padding: 0.75rem 0.5rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  border-bottom: none;
  font-weight: 700;
}

.result-row .label {
  color: #555;
  font-weight: 500;
}

.result-row .value {
  color: #333;
  font-weight: 600;
  font-size: 1.1rem;
}

.result-row.total .value {
  color: #667eea;
  font-size: 1.2rem;
}

.result-card.summary {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-color: #667eea;
}

/* Error Messages */
.error-messages {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8d7da;
  border: 2px solid #f5c6cb;
  border-radius: 8px;
  color: #721c24;
}

.error-messages:empty {
  display: none;
}

.error-messages ul {
  list-style: none;
  padding-left: 0;
}

.error-messages li {
  padding: 0.25rem 0;
}

.error-messages li:before {
  content: "⚠️ ";
  margin-right: 0.5rem;
}

/* Toast notification */
.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 9999;
  animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-in 2.7s;
  pointer-events: none;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

  header h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  main {
    padding: 1rem;
  }

  #calculator-form {
    grid-template-columns: 1fr;
  }

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

  .result-card {
    padding: 1rem;
  }
}

@media print {
  body {
    background: white;
    padding: 0;
  }

  .input-section {
    display: none;
  }

  .results-section {
    display: block !important;
  }

  .result-card {
    break-inside: avoid;
  }
}
