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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
}

.logo h1 {
  font-size: 1.5rem;
  color: #000000;
  font-weight: 600;
}

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

.checkout-container {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 2rem;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  color: #000000;
  margin-bottom: 2rem;
  font-size: 1.8rem;
}

/* Patient Info Section */
.patient-info {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.patient-info h3 {
  margin-bottom: 1rem;
  color: #000000;
}

/* Added styles for info-grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  align-items: baseline; /* Align items along their baseline */
}

.info-grid p {
  margin-bottom: 0.5rem;
}

.info-grid strong {
  font-weight: 600;
  color: #333;
}

/* Styles for the phone input container and input */
.phone-input-container {
  display: flex;
  align-items: center; /* Align items vertically */
  gap: 0.5rem; /* Space between label, input, and button */
}

/* Remove grid layout influence if it's inside info-grid */
.info-grid .phone-input-container {
    grid-column: span 1; /* Or adjust as needed */
}

.phone-input-container label {
  flex-shrink: 0; /* Prevent label from shrinking */
  margin-right: 0.5rem; /* Space after label */
}

input.phone-input {
  /* Basic input styling */
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  height: 32px; /* Match button height */
  flex-grow: 1; /* Allow input to take available space */
  min-width: 120px; /* Ensure minimum width - Reduced from 150px */
}

/* Adjust the update button specifically if needed */
#update-phone-btn {
  /* Ensure it doesn't shrink */
  flex-shrink: 0;
  /* Potentially remove fixed height if select-treatment-btn has one */
  /* height: auto; */ 
}

/* Treatments Section */
.treatments-section {
  margin-bottom: 2rem;
}

.treatments-section h3 {
  margin-bottom: 1rem;
  color: #000000;
}

.treatment-rows {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.treatment-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

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

.treatment-info {
    flex: 1 1 200px;
    margin-right: 1rem;
}

.treatment-name {
  font-weight: 500;
  display: block;
}

.treatment-price {
  font-weight: 600;
  color: #333;
  display: block;
}

.treatment-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.quantity-control {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden; 
  transition: opacity 0.2s;
}

.quantity-control:has(input:disabled) {
  opacity: 0.5;
  background-color: #f8f9fa;
}

.quantity-btn {
  background-color: #f1f1f1;
  border: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
  color: #333;
}

.quantity-btn:hover:not(:disabled) {
  background-color: #e0e0e0;
}

.quantity-btn:disabled {
  color: #999;
  cursor: not-allowed;
  background-color: #f8f9fa; /* Match disabled input */
}

.quantity-input {
  width: 40px;
  height: 30px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  font-size: 0.9rem;
  background-color: white;
}

.quantity-input:disabled {
  background-color: #f8f9fa;
  color: #999;
  cursor: not-allowed;
}

/* Hide spinner arrows */
.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.quantity-input[type=number] {
  -moz-appearance: textfield; /* Firefox */
}

.select-treatment-btn {
  background-color: #000000;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  height: 32px; /* Match quantity control height */
  line-height: 1;
}

.select-treatment-btn:hover:not(.selected) {
  background-color: #333333;
}

.select-treatment-btn.selected {
  background-color: #e0e0e0; /* Light gray for selected/deselect */
  color: #333;
  border: 1px solid #ccc;
}

.select-treatment-btn.selected:hover {
  background-color: #ccc;
}

/* Checkout Summary */
.checkout-summary {
  background-color: #f9f9f9;
  border-radius: 8px;
  padding: 1.5rem;
}

.summary-header {
  margin-bottom: 1rem;
}

.summary-header h3 {
  color: #000000;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.summary-item-name {
  flex: 2;
}

.summary-item-quantity {
  flex: 1;
  text-align: center;
}

.summary-item-price {
  flex: 1;
  text-align: right;
}

/* Discount items styling */
.discount-details {
  margin: 0.5rem 0;
  padding: 0.5rem 0;
  display: none; /* Hide by default */
}

.discount-heading {
  font-weight: 600;
  color: #333;
  display: block;
  margin-bottom: 0.3rem;
}

.discount-items {
  list-style-type: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}

.discount-item {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  color: #555;
}

.discount-item-value {
  color: #2a9d2a;
  font-weight: 500;
}

.no-discounts {
  color: #888;
  font-style: italic;
  text-align: center;
  padding: 0.3rem 0;
}

.empty-cart-message {
  text-align: center;
  color: #888;
  padding: 1rem 0;
}

.summary-total {
  margin-top: 1rem;
  padding-top: 1rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.final-total {
  font-weight: bold;
  font-size: 1.2rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e0e0e0;
}

.checkout-button {
  background-color: #000000;
  color: white;
  border: none;
  width: 100%;
  padding: 1rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background-color 0.3s;
}

.checkout-button:hover:not(:disabled) {
  background-color: #333333;
}

.checkout-button:disabled {
  background-color: #999999;
  cursor: not-allowed;
}

/* Footer */
footer {
  background-color: #fff;
  padding: 1.5rem 0;
  border-top: 1px solid #e0e0e0;
  margin-top: 2rem;
}

footer p {
  text-align: center;
  color: #666;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .checkout-container {
    padding: 1.5rem;
  }
  
  /* Removed old treatment-item-row adjustments */
  /* Allow actions to stack below info */
  .treatment-item-row {
    gap: 0.5rem;
  }
  .treatment-info {
      margin-right: 0; /* Remove margin when stacking */
      flex-basis: 100%; /* Take full width */
  }
  .treatment-actions {
      justify-content: space-between; /* Space out controls and button */
      width: 100%;
  }
  
  /* Removed old treatment-price adjustments */
  /* Removed old select-treatment-btn adjustments */
}