/* Basic styling for the Ring Calculator */

header,
footer {
  background-color: #fff;
  max-width: 900px; /* Same as calculator-container */
  min-width: 300px; /* Added min-width */
  margin: 20px auto; /* Center the header/footer */
  padding: 10px 20px; /* Padding inside the constrained width */
  border-radius: 8px; /* Match calculator-container */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Match calculator-container */
}

:root {
  --primary-color: #bcd454;
  /* Add other styling constants here */
}

body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background-color: #f4f4f4;
  color: #333;
}

h1 {
  color: var(--primary-color);
}

.calculator-container {
  display: flex;
  flex-wrap: wrap; /* Allows items to wrap to the next line on smaller screens */
  gap: 20px; /* Space between input and output sections */
  max-width: 900px;
  min-width: 300px; /* Added min-width */
  margin: 20px auto; /* Center the container */
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.input-section,
.output-section {
  flex: 1; /* Allows sections to grow and shrink */
  min-width: 300px; /* Minimum width before wrapping */
}

.output-section {
  margin-left: 2em; /* Space between input and output sections */
}

.input-section label {
  display: block; /* Labels on their own line */
  margin-bottom: 5px;
  /* font-weight: bold; */ /* Remove this */
  line-height: 1.5em;
  min-height: 20px;
}

.input-section input[type="number"],
.input-section select {
  width: calc(100% - 16px); /* Full width minus padding */
  padding: 8px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.options {
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  padding: 12px;
}
.option {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 8px 6px;
  border-radius: 6px;
}
.option:hover {
  background: #fafafa;
}
.option input {
  margin-top: 0.1rem;
}
.text .hint {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.15rem;
}

.output-section h2 {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 10px;
  margin-top: 0;
}

.recent__header h2 {
  font-size: 1em;
  font-weight: 400;
  color: inherit;
  margin: 0;
  padding: 0;
  display: inline;
  border: 0;
}

.result-item {
  background-color: #f9f9f9; /* Light background for contrast */
  border: 1px solid #eee;
  border-radius: 5px;
  padding: 15px;
  margin-bottom: 15px;
  display: flex; /* Use flexbox for internal layout */
  flex-direction: column; /* Revert to column */
  align-items: flex-start; /* Align content to the start */
  position: relative; /* For absolute positioning of button if needed */
}

/* Apply flex-direction: row specifically to the last result-item (Ring Description) */
.result-item:last-of-type {
  flex-direction: row; /* Align label/value content and button horizontally */
  align-items: center; /* Vertically align items */
  justify-content: space-between; /* Distribute space between content and button */
}

.description-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1; /* Allow content to take available space */
}

.result-item .label {
  font-size: 0.9em; /* Smaller label */
  color: #444; /* Darker color for better contrast */
  margin-bottom: 5px;
  /* font-weight: bold; */ /* Remove this */
  line-height: 1.5em;
  min-height: 20px;
}

.result-item .value {
  font-size: 1.8em; /* Significantly larger value */
  font-weight: bold;
  color: #367c2b; /* A darker green, derived from primary-color */
  flex-grow: 1; /* Allow value to take available space */
}

/* Special styling for the nameOfRings as it's a full description */
#nameOfRings {
  font-size: 1.2em; /* Larger than before */
  color: #222; /* Darker for better contrast */
  font-weight: bold;
  display: block;
  margin-top: 0; /* Reset margin-top */
  background-color: transparent; /* Reset background */
  padding: 0; /* Reset padding */
  border-radius: 0; /* Reset border-radius */
  flex-grow: 1; /* Allow it to take available space */
}

.copy-button {
  background: none;
  border: none;
  cursor: pointer;
  color: #666; /* A neutral color */
  margin-left: 10px; /* Space from the description */
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s;
  flex-shrink: 0; /* Prevent button from shrinking */
}

.copy-button:hover {
  background-color: #eee;
}

.copy-button svg {
  vertical-align: middle; /* Align icon with text */
}

/* Recent calculations styling */
.recent.hidden {
  display: none;
}
.recent {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--panel, #fff);
  margin-top: 3em;
}

.recent__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.recent__clear {
  font: inherit;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  background: transparent;
  cursor: pointer;
}

.recent__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  max-height: 16rem;
  overflow: auto; /* scroll if long */
  padding: 0;
  margin: 0;
}

.recent__item {
  list-style: none;
}

.recent__btn {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  background: var(--chip, #f8fafc);
  cursor: pointer;
}

.recent__btn:hover {
  background: #f1f5f9;
}
.recent__btn:focus-visible {
  outline: 3px solid var(--focus, #2563eb);
  outline-offset: 2px;
}

/* Small metadata row inside the button */
.recent__title {
  display: block;
  font-size: 1.1em;
  margin-bottom: 0.35rem;
}
.recent__meta {
  display: block;
  font-size: 0.875rem;
  opacity: 0.8;
}

/* Remove button inside each row (visually secondary) */
.recent__remove {
  margin-left: 0.5rem;
  float: right; /* keep it simple */
  border: 0;
  background: none;
  cursor: pointer;
}

/* Notification styles */
.notification-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  justify-content: center;
  pointer-events: none; /* Allows clicks to pass through when hidden */
}

.notification-message {
  background-color: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 1em;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  text-align: center;
  white-space: nowrap; /* Prevent text from wrapping */
}

.notification-message.show {
  opacity: 1;
}

/* Responsive adjustments */
/* Mobile View */
@media (max-width: 450px) {
  body {
    margin: 0;
  }
  header,
  footer {
    margin: 10px 0;
    padding: 10px 15px;
    border-radius: 0;
    box-shadow: none;
  }
  .calculator-container {
    border-radius: 0;
    box-shadow: none;
  }
  .output-section {
    margin-left: 0;
  }
}

/* Tablet View */
@media (max-width: 768px) {
  header,
  footer {
    margin: 0;
    padding: 10px 15px;
  }
  .calculator-container {
    flex-direction: column; /* Stack sections vertically on small screens */
    margin: 10px 0;
    padding: 15px;
  }
  .input-section,
  .output-section {
    flex: none;
    width: 100%;
  }
  .output-section {
    margin-left: 0;
  }
}

/* Desktop View */
@media (min-width: 1001px) {
  header,
  footer {
    margin: 20px 0 20px 20px; /* Anchor to left with 20px margin */
  }
  .calculator-container {
    margin: 20px 0 20px 20px; /* Anchor to left with 20px margin */
  }
  .notification-container {
    left: 450px;
    transform: translateX(-50%);
  }
}
