/* General styles and resets */
:root {
  --bg-color: #000000;
  --primary-text-color: #ffffff;
  --accent-color: #00ff41;
  --secondary-color: #52525b;
  --input-bg-color: #18181b;
  --hover-glow: rgba(0, 255, 65, 0.3);
  --button-glow: rgba(0, 255, 65, 0.5);
}

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

html,
body {
  height: auto;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--primary-text-color);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Specific dimensions for mobile view */
body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

main {
  width: 100%;
  padding: 0 1rem;
}

section {
  width: 100%;
  padding: 32px 0;
  display: flex;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 500px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;     
  background-color: rgba(24, 24, 27, 0.5);
  box-shadow: rgba(0, 0, 0, 0.5) 0px 8px 32px, rgba(0, 255, 65, 0.3) 0px 0px 1px;
  padding: 48px 40px;
  border-radius: 16px;
  gap: 40px;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(82, 82, 91, 0.3);
  border-image: initial;
}

/* Typography */
h1 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 28px;
  text-align: center;
  color: var(--primary-text-color);
  margin-bottom: 8px;
}

label {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--primary-text-color);
  display: block;
  margin-bottom: 12px;
}

.option-label {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--primary-text-color);
}

/* Password Length Section */
.length-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.length-display {
  font-size: 16px;
  color: var(--accent-color);
  font-weight: 600;
  background: var(--input-bg-color);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent-color);
}

/* Fancy Range Slider */
.slider-container {
  position: relative;
  padding: 20px 0;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
  position: relative;
  background: linear-gradient(
    to right,
    #00ff41 0%,
    #00ff41 var(--value, 14.29%),
    #52525b var(--value, 14.29%),
    #52525b 100%
  );
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Webkit browsers (Chrome, Safari, Edge) */
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 60%, #00ff41 60%);
  border: 3px solid #00ff41;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
}

input[type='range']::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.8), 0 3px 8px rgba(0, 0, 0, 0.4);
}

input[type='range']:active::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 0 24px rgba(0, 255, 65, 1), 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Firefox */
input[type='range']::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 60%, #00ff41 60%);
  border: 3px solid #00ff41;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

input[type='range']::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.8), 0 3px 8px rgba(0, 0, 0, 0.4);
}

input[type='range']::-moz-range-track {
  background: transparent;
  border: none;
}

/* Slider tick marks */
.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 4px;
}

.tick {
  width: 1px;
  height: 6px;
  background: var(--secondary-color);
  opacity: 0.3;
}

.tick-label {
  font-size: 10px;
  color: var(--secondary-color);
  margin-top: 4px;
}

/* Toggle Switches */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  padding: 4px 0;
}

.toggle-wrapper input[type='checkbox'] {
  opacity: 0;
  position: absolute;
  cursor: pointer;
  height: 0;
  width: 0;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  background: var(--input-bg-color);
  border: 1px solid var(--secondary-color);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  top: 2px;
  left: 3px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-wrapper input[type='checkbox']:checked + .option-label .toggle-switch {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.toggle-wrapper input[type='checkbox']:checked + .option-label .toggle-switch::after {
  left: 25px;
}

.toggle-switch:hover {
  transform: scale(1.05);
  box-shadow: 0 0 8px var(--hover-glow);
}

.toggle-wrapper input[type='checkbox']:checked + .option-label .toggle-switch:hover {
  box-shadow: 0 0 12px var(--button-glow);
}

.toggle-wrapper input[type='checkbox']:focus + .option-label .toggle-switch {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}

.option-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
}

.option-text {
  flex-grow: 1;
}

/* Generate Button */
#generateButton {
  height: 56px;
  background-color: var(--bg-color);
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-align: center;
  outline: none;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 24px var(--button-glow);
  transition: all 0.3s ease;
  margin-top: 8px;
}

#generateButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px var(--button-glow), 0 4px 16px rgba(0, 255, 65, 0.3);
  background: rgba(0, 255, 65, 0.05);
}

#generateButton:active {
  transform: translateY(0);
  box-shadow: 0 0 16px var(--button-glow);
}

#generateButton:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 4px;
}

/* Password Output Container */
.password-output-container {
  display: flex;
  gap: 12px;
  background-color: var(--input-bg-color);
  border-radius: 12px;
  padding: 8px;
  border: 1px solid var(--secondary-color);
  transition: all 0.3s ease;
}

.password-output-container.generated {
  border-color: var(--accent-color);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.2);
}

#generatedPassword {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
  cursor: default;
  background: transparent;
  border: none;
  color: var(--primary-text-color);
  padding: 12px;
  min-height: 48px;
  display: flex;
  align-items: center;
}

/* Copy Button */
#copyButton {
  height: 48px;
  width: 48px;
  min-width: 48px;
  background-color: var(--accent-color);
  color: var(--bg-color);
  border-radius: 8px;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

#copyButton:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 255, 65, 0.4);
}

#copyButton:active {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 255, 65, 0.3);
}

#copyButton:focus {
  outline: 2px solid var(--primary-text-color);
  outline-offset: 2px;
}

#copyButton.copied {
  background-color: #10b981;
}

/* Section spacing */
.section-spacing {
  margin-bottom: 8px;
}

/* Smooth transitions on interactive elements */
button,
a,
input,
select,
textarea,
.toggle-switch {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
    background-color 0.3s ease-in-out, border-color 0.3s ease-in-out, color 0.2s ease-in-out;
}

/* Responsiveness */
@media (min-width: 431px) {
  #generatedPassword {
    font-size: 20px;
  }

  #generateButton {
    margin-top: 16px;
  }
}

@media (max-width: 374px) {
  .container {
    padding: 24px 16px;
    gap: 24px;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  h1 {
    font-size: 24px;
  }

  #generatedPassword {
    font-size: 16px;
  }
}
