/* CSS Variables */

:root {
  --White: #ffffff;
  --Black: #000000;

  /* Grey */
  --Grey600: #3d6666;
  --Grey550: #547878;
  --Grey500: #5e7a7d;
  --Grey400: #7f9d9f;
  --Grey300: #9ebbbd;
  --Grey200: #c5e4e7;
  --Grey50: #f3f9fa;

  /* Green */
  --Green900: #00474b;
  --Green800: #085c61;
  --Green750: #0d686d;
  --Green400: #26c2ae;
  --Green200: #9fe8df;

  /* Orange */
  --Orange400: #e17052;
}

/* CSS Reset */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Remove default list styles */
ol,
ul {
  list-style: none;
}

/* Ensure images are responsive and don't exceed their container */
img,
picture,
video,
canvas,
svg {
  max-width: 100%;
  display: block;
}

/* Remove default anchor styles */
a {
  text-decoration: none;
  color: inherit;
}

/* Reset buttons to avoid inconsistent styling */
button,
input,
select,
textarea {
  font: inherit;
  border: none;
  background: none;
  appearance: none;
}

/* Ensure form elements don't overflow */
input,
textarea {
  width: 100%;
}

/* Remove default table spacing */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Set base font and line height */
html {
  font-size: 100%;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%; /* Prevent iOS font scaling */
  scroll-behavior: smooth;
}

/* Remove default focus outlines for better accessibility control */
:focus {
  outline: none;
}

/* Ensure body takes up at least full viewport height */
body {
  min-height: 100vh;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  background-color: var(--Grey200);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Typography Classes */

.text-preset-1 {
  font-size: 3rem;
  line-height: 4.4375rem;
  letter-spacing: -0.0625rem;
}

.text-preset-2 {
  font-size: 2rem;
  line-height: 2.9375rem;
  letter-spacing: -0.041875rem;
}

.text-preset-3 {
  font-size: 1.5rem;
  line-height: 2.25rem;
  letter-spacing: 0px;
  color: var(--Green900);
}

.text-preset-4 {
  font-size: 1.25rem;
  line-height: 1.875rem;
  letter-spacing: 0px;
}

.text-preset-5 {
  font-size: 1rem;
  line-height: 1.875rem;
  letter-spacing: 0px;
}

.text-preset-6 {
  font-size: 0.8125rem;
  line-height: 1.1875rem;
  letter-spacing: 0px;
}

::placeholder {
  color: var(--Grey300);
}

.custom-btn::placeholder {
  color: var(--Grey550);
}

/* Main Layout */

.header-image {
  margin: 2.5625rem auto;
}

.main-content {
  background-color: var(--White);
  border-top-left-radius: 1.25rem;
  border-top-right-radius: 1.25rem;
  width: 23.4375rem;
  box-shadow: 0px 0.625rem 1.25rem rgba(0, 0, 0, 0.1);
}

.content-container,
.bill-container,
.tip-contianer,
.people-container,
.result-content,
.results-details {
  display: flex;
  flex-direction: column;
}

.content-container {
  padding: 2rem 1.5rem;
  gap: 2rem;
}

.bill-container {
  gap: 2rem;
}

.label-text {
  color: var(--Grey500);
  margin-bottom: 0.5rem;
}

.text-input {
  background-color: var(--Grey50);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 50%;
}

.number-input {
  text-align: right;
}

.tip-contiainer {
  gap: 0.5rem;
}

.tip-btn {
  background-color: var(--Green900);
  color: var(--White);
  border-radius: 0.3125rem;
  padding: 0.5rem 1rem;
  width: 9.1875rem;
}

.tip-active {
  background-color: var(--Green400);
  color: var(--Green900);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.custom-btn {
  background-color: var(--Grey50);
  color: var(--Green900);
  text-align: center;
  border-radius: 0.3125rem;
  padding: 0.5rem 1rem;
  width: 9.1875rem;
}

.people-label-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.people-container-error {
  outline: 0.125rem solid var(--Orange400);
}

.error {
  color: var(--Orange400);
}

.invisible {
  display: none;
}

/* result-section */

.result-content {
  padding: 1.5rem;
  background-color: var(--Green900);
  border-radius: 0.9375rem;
  gap: 2rem;
}

.results-details {
  gap: 1.5rem;
}

.tip-amount,
.total-amount {
  display: flex;
  justify-content: space-between;
}

.amount-text {
  color: var(--Green400);
}

.amount-label {
  color: var(--White);
}

.amount-unit {
  color: var(--Grey400);
}

.reset-button {
  text-transform: uppercase;
  padding: 0.5rem 2rem;
  background-color: var(--Green750);
  color: var(--Green800);
  border-radius: 0.3125rem;
}

.reset-active {
  background-color: var(--Green400);
}

/* Hover and Focus states */
.text-input:hover {
  outline: solid 0.125rem var(--Green400);
  cursor: pointer;
}

.tip-btn:hover {
  cursor: pointer;
  background-color: var(--Green200);
  color: var(--Green900);
}

.custom-btn:hover {
  cursor: pointer;
}

.reset-button:hover {
  background-color: var(--Green200);
  cursor: pointer;
}

/* Media Queries */
@media (min-width: 768px) {
  .main-content {
    width: 38rem;
    border-radius: 1.25rem;
  }

  .content-container {
    padding: 3rem 5rem;
  }

  .button-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .tip-btn,
  .custom-btn {
    width: 8.71875rem;
  }

  .amount-text {
    font-size: 3rem;
  }
}

@media (min-width: 1440px) {
  body {
    justify-content: center;
    gap: 4rem;
  }

  .main-content {
    width: 57.5rem;
  }

  .content-container {
    flex-direction: row;
    padding: 2rem;
    gap: 3rem;
  }

  .result-container,
  .result-content {
    width: 100%;
  }

  .result-content {
    justify-content: space-between;
    padding: 1.5rem;
    height: 100%;
  }

  .results-details {
    gap: 1.5rem;
  }
}
