:root {
  --blue: rgba(84, 165, 235);
  --light-blue: rgba(84, 165, 235, 0.5);
  --red: rgba(235, 84, 84, 1);
  --light-red: rgba(255, 160, 160, 1);
  --green: rgba(84, 235, 165, 1);
  --light-green: rgba(84, 235, 165, 0.5);
  --light-gray: rgba(234, 234, 234, 1);
  --dark-gray: rgba(204, 204, 204, 1);
  --black: #000000;
  --white: #ffffff;

  --elevation-1:
    0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --elevation-2:
    0 1px 2px 0 rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --elevation-3:
    0 4px 8px 3px rgba(0, 0, 0, 0.15), 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Nunito", sans-serif;
  font-optical-sizing: auto;
  font-weight: bold;
  background-color: var(--white);
  color: var(--black);
}

input[type="number"] {
  -moz-appearance: textfield;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: row;
  font-weight: 500;
  background-color: var(--white);
}

/* Input Panel */
.lens-configurator {
  display: flex;
  flex-direction: column;
  width: 20vw;
  min-width: 280px;
  height: 100vh;
  gap: 12px;
  padding: 24px 16px;
  overflow-y: auto;
  overflow-x: auto;
}

/* Scrollbar styling */
.lens-configurator::-webkit-scrollbar {
  width: 8px;
}

.lens-configurator::-webkit-scrollbar-track {
  background: transparent;
}

.lens-configurator::-webkit-scrollbar-thumb {
  background: var(--dark-gray);
  border-radius: 4px;
}

.lens-configurator::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Lens Entry Card */
.card {
  padding: 16px;
  width: 100%;
  background: var(--white);
  border-radius: 16px;
  border: 4px solid var(--light-gray);
  flex-shrink: 0;
  position: relative;
}

/* Labels */
.card label {
  font-size: 14px;
  font-weight: 600;
  align-self: center;
  letter-spacing: 0.1px;
}

/* Input Fields */
.card input {
  width: 100%;
  padding: 8px 12px;
  font-family: "Nunito", sans-serif;
  font-size: 16px;
  font-weight: 400;
  background-color: var(--light-gray);
  border: none;
  border-radius: 4px;
  color: var(--black);
  outline: none;
  text-align: center;
}

.card input:hover {
  background-color: #e0e0e0;
}

.card input:focus {
  border: 3px solid var(--blue);
  background-color: var(--white);
}

/* Input Group (for inputs with stepper buttons) */
.input-group {
  grid-column: 1 / -1;
}

/* Slider Customization */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--dark-gray);
  outline: none;
  margin: 10px 0;
}

/* Radius Display */
.entry p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  background-color: var(--light-gray);
  border-radius: 8px;
  letter-spacing: 0.5px;
}

/* Buttons Base */
.input button {
  font-family: "Nunito", sans-serif;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.input button .icon {
  padding-top: 5px;
  filter: invert(100%);
}

.input button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

/* Add Button */
.add-button {
  width: 50px;
  height: 50px;
  background-color: var(--light-green);
  color: var(--black);
  border-radius: 50%;
  margin-top: 8px;
  margin-bottom: 8px;
  display: flex;
  align-self: center;
}

.add-button .icon {
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.add-button .text {
  font-size: 16px;
  font-weight: 600;
  position: absolute;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
  letter-spacing: 0.1px;
  color: var(--black);
}

.add-button:not(:disabled):hover {
  width: calc(100% - 32px);
  border-radius: 50px;
  background-color: var(--green);
}

.add-button:not(:disabled):hover .icon {
  opacity: 0;
}

.add-button:not(:disabled):hover .text {
  opacity: 1;
}

.add-button:not(:disabled):active {
  transform: scale(0.98);
}

/* Delete Button */
.delete-button {
  grid-column: 2;
  width: 40px;
  height: 40px;
  border-radius: 100%;
  padding: 0;
  background-color: var(--light-red);
  font-size: 14px;
  letter-spacing: 0.1px;
  display: flex;
  justify-self: end;
}

.delete-button .icon {
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.delete-button .text {
  font-size: 14px;
  font-weight: 600;
  position: absolute;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
  letter-spacing: 0.1px;
  color: var(--black);
}

.delete-button:hover {
  width: 130px;
  border-radius: 50px;
  background-color: var(--light-red);
}

.delete-button:hover .icon {
  opacity: 0;
}

.delete-button:hover .text {
  opacity: 1;
}

.delete-button:active {
  background-color: var(--red);
  color: var(--white);
  transform: scale(0.98);
}

/* Stepper Buttons */
.stepper-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  padding: 0;
  background-color: var(--light-gray);
  color: var(--black);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.stepper-button:hover {
  background-color: #999;
}

.stepper-button:active {
  background-color: #888;
  transform: scale(0.95);
}

/* Info Button */
.info-button {
  width: 40px;
  height: 40px;
  background-color: var(--dark-gray);
  justify-content: center;
  align-self: center;
}

/* Renderer */
.renderer {
  height: calc(100vh - 32px);
  margin: 16px;
  border: 4px solid var(--dark-gray);
  border-radius: 28px;
  background-color: var(--white);
  overflow: hidden;
  flex: 1;
}

.renderer div {
  width: 100%;
  height: 100%;
}

/* Lens Visualization */
.lens {
  stroke: var(--blue);
  stroke-width: 4px;
  fill: var(--light-blue);
  opacity: 0.9;
}

/* Ray Visualization */
.ray {
  stroke: var(--red);
  stroke-width: 2px;
  fill: none;
  opacity: 0.85;
}

/* Ripple effect */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.input button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.input button:active::after {
  width: 100px;
  height: 100px;
  opacity: 0;
  transition: 0s;
}

/* Media query for mobile */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .input {
    width: 100%;
    min-width: unset;
    height: 40vh;
    max-height: 40vh;
    padding-top: 4px;
    padding-bottom: 4px;
    order: 2; /* The input goes at the bottom */
  }

  .renderer {
    width: calc(100% - 10px);
    height: 60svh;
    margin: 5px;
    margin-bottom: 0px;
    order: 1; /* The renderer goes at the top */
  }
}
