/* ====================== */
/* Base Styles */
/* ====================== */
body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 20px;
  background-color: #f5f5f5;
  color: #333;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

h1, h2, h3 {
  color: #2c3e50;
  margin-top: 0;
}

h1 {
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

h2 {
  color: #2980b9;
  margin: 1.5rem 0 1rem;
}

/* ====================== */
/* Form Styles */
/* ====================== */
.form-section {
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid #eee;
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
  flex: 1;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: #2c3e50;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
  width: 100%;
}

button:hover {
  background-color: #2980b9;
}

button:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
}

/* ====================== */
/* Loading Indicator */
/* ====================== */
.loading-container {
  text-align: center;
  margin: 2rem 0;
  padding: 2rem;
}

.loader {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ====================== */
/* Results Section */
/* ====================== */
#results {
  margin-top: 2rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.patient-summary {
  background: #eaf7fd;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border-left: 4px solid #3498db;
}

.patient-summary h3 {
  margin-top: 0;
  color: #2c3e50;
}

.patient-summary p {
  margin: 0.5rem 0;
}

#printBtn {
  background-color: #27ae60;
  padding: 10px 15px;
  align-self: flex-start;
}

#printBtn:hover {
  background-color: #219653;
}

#recommendations h3 {
  color: #2980b9;
  margin: 1.5rem 0 0.5rem;
}

#recommendations ul {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
}

#recommendations li {
  margin-bottom: 0.5rem;
}

.error {
  background: #fdecea;
  padding: 1rem;
  border-radius: 4px;
  border-left: 4px solid #e74c3c;
  color: #c0392b;
}

/* ====================== */
/* Print Styles */
/* ====================== */
@media print {
  body * {
    visibility: hidden;
  }
  
  #results, #results * {
    visibility: visible;
  }
  
  #results {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    background: white;
  }
  
  .patient-summary {
    background: none;
    border-left: none;
    padding: 0;
    margin-bottom: 1rem;
  }
  
  #recommendations h3 {
    page-break-after: avoid;
  }
  
  #recommendations ul {
    page-break-inside: avoid;
  }
  
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8em;
    color: #7f8c8d;
  }
}

/* ====================== */
/* Responsive Design */
/* ====================== */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .form-section {
    padding: 1rem;
  }
  
  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  #printBtn {
    align-self: flex-start;
  }
}

/* ====================== */
/* Utility Classes */
/* ====================== */
.hidden {
  display: none;
}

/* Animation for showing results */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#results.showing {
  animation: fadeIn 0.3s ease-out;
}