/* =================================================
   RESET
   Removes default browser spacing and ensures
   consistent box sizing across all elements
================================================= */

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

html, body, .wrapper {
  height: 100%;
  margin: 0;
  padding: 0;
}


/* =================================================
   BASE STYLES
   Default typography, colours, and transitions
================================================= */

body {
  font-family: sans-serif;
  background: #f9fbfd;
  color: #111;
  transition: 0.4s ease;
}


/* =================================================
   THEMES
   Different visual styles that can be selected
   using the theme dropdown in the UI
================================================= */

/* Default dark theme */
body.dark {
  background: #121212;
  color: #f5f5f5;
}

/* Default light theme */
body.light {
  background: #f9fbfd;
  color: #111;
}

/* Cyberpunk theme (neon futuristic look) */
body.cyberpunk {
  background: #1a1033; /* deep neon purple */
  color: #c84e89;
}

/* Aurora theme (calm teal inspired theme) */
body.aurora {
  background: #0ea5a5; /* teal */
  color: #022;
}

/* Synthwave theme (retro neon aesthetic) */
body.synthwave {
  background: #2a0a4f; /* synth purple */
  color: #8A00FF;
}

/* Comic book theme (bold and playful style) */
body.comic-book {
  background: #ffe600;
  color: #111;
  font-weight: bold;
  letter-spacing: 1px;
}


/* =================================================
   LAYOUT
   Main page structure and header styling
================================================= */

.wrapper {
  padding: 30px 20px;
}

/* Page header containing title and theme selector */
header {
  text-align: center;
  padding: 20px 0;
}

/* Theme dropdown styling */
header select {
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 6px;
}


/* =================================================
   CARD
   Main container that holds the password generator
================================================= */

.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 30px 40px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  transition: 0.3s;
}

/* Dark-friendly cards for darker themes */
body.dark .card,
body.cyberpunk .card,
body.synthwave .card {
  background: rgba(20, 20, 20, 0.95);
}


/* =================================================
   CARD DIVIDERS
   Decorative lines separating sections
================================================= */

.card-header::after,
.card-footer::before {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: rgba(0,0,0,0.1);
  margin: 15px 0;
}

/* Lighter divider for dark theme */
body.dark .card-header::after,
body.dark .card-footer::before {
  background: rgba(255,255,255,0.1);
}


/* =================================================
   PASSWORD DISPLAY FIELD
   Area where the generated password appears
================================================= */

#password {
  width: 100%;
  padding: 15px;
  font-size: 1.2rem;
  text-align: center;
  border: 2px dashed #c0c7cf;
  border-radius: 6px;
  resize: none;
  transition: 0.3s;
}

/* Adjust border colour for darker themes */
body.dark #password,
body.cyberpunk #password,
body.synthwave #password {
  border-color: #555;
}


/* =================================================
   PASSWORD STRENGTH INDICATOR
   Visual bar and label showing password strength
================================================= */

.strength-container {
  margin-top: 10px;
}

#strength-bar {
  height: 8px;
  width: 0%;
  border-radius: 5px;
  background: red;
  transition: 0.3s;
}

#strength-text {
  margin: 5px 0;
  font-size: 14px;
}


/* =================================================
   CONTROLS
   Sliders and checkboxes used to customise passwords
================================================= */

.controls {
  margin-top: 20px;
}

/* Checkbox and label spacing */
.controls label {
  display: block;
  margin: 8px 0;
}

/* Password length slider */
input[type="range"] {
  width: 100%;
}


/* =================================================
   BUTTONS
   Main action buttons (Generate, Copy)
================================================= */

.btn {
  border: none;
  background: #ff4b2b;
  color: #fff;
  border-radius: 25px;
  font-size: 16px;
  padding: 12px 24px;
  margin: 10px;
  cursor: pointer;
  transition: 0.25s;
}

/* Hover animation for better UX */
.btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(255,75,43,0.6);
}


/* =================================================
   THEME-SPECIFIC BUTTON STYLES
================================================= */

body.cyberpunk .btn {
  background: #ff00cc;
}

body.aurora .btn {
  background: #00ffa3;
  color: #fff;
}

body.synthwave .btn {
  background: #ff0080;
  color: #fff;
}

body.comic-book .btn {
  background: #000;
  color: #fff;
}


/* =================================================
   PASSWORD HISTORY
   Displays previously generated passwords
================================================= */

.history {
  margin-top: 20px;
}

/* History list styling */
.history ul {
  list-style: none;
  padding: 0;
}

/* Individual password history item */
.history li {
  background: rgba(240,240,240,0.95);
  margin: 5px 0;
  padding: 8px;
  border-radius: 6px;
  font-family: monospace;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

/* Dark theme adjustments */
body.dark .history li,
body.cyberpunk .history li,
body.synthwave .history li {
  background: rgba(50,50,50,0.9);
  color: #fff;
}

/* Highlight favourite passwords */
.history li.favorite {
  border: 2px solid gold;
  background: rgba(255,223,0,0.2);
}


/* =================================================
   ANIMATIONS
================================================= */

/* Shake animation used for invalid input feedback */
@keyframes shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Applied to controls when validation fails */
.controls.shake {
  animation: shake 0.5s;
  box-shadow: 0 0 10px red;
}

/* Fade animation for UI elements */
.fade {
  animation: fadeIn 0.3s;
}

/* Simple fade in effect */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* =================================================
   HISTORY SEARCH
   Input used to filter password history
================================================= */

#history-search {
  width:100%;
  padding:8px;
  margin-bottom:10px;
}


/* =================================================
   TOAST NOTIFICATION
   Temporary popup messages (copy success, etc.)
================================================= */

#toast {
  position:fixed;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  padding:10px 20px;
  border-radius:20px;
  opacity:0;
  transition:0.3s;
}

/* Toast visibility toggle */
#toast.show { opacity:1; }

/* Toast message types */
#toast.success { background:#39ff14; }
#toast.warning { background:#ffb700; }
#toast.info { background:#00cfff; }


/* =================================================
   THEME-SPECIFIC CARD STYLES
================================================= */

/* Cyberpunk visual effects */
body.cyberpunk .card {
  border: 1px solid #ff00cc;
  box-shadow: 0 0 20px #ff00cc55;
}

/* Aurora glow effect */
body.aurora .card {
  background: rgba(255,255,255,0.9);
  box-shadow: 0 0 20px #00ffa355;
}

/* Synthwave neon border */
body.synthwave .card {
  border: 1px solid #ff0080;
  box-shadow: 0 0 20px #ff008055;
}

/* Comic book bold outline */
body.comic-book .card {
  border: 3px solid #000;
  box-shadow: 5px 5px 0 #000;
}


/* =================================================
   GLOBAL THEMED INPUT STYLES
================================================= */

body.dark input,
body.dark textarea,
body.dark select {
  background: #1e1e1e;
  color: #fff;
  border: 1px solid #555;
}

body.cyberpunk input,
body.cyberpunk textarea,
body.cyberpunk select {
  background: #0f0820;
  color: #ff00cc;
  border: 1px solid #ff00cc;
}

body.aurora input,
body.aurora textarea,
body.aurora select {
  background: #e6fffa;
  color: #022;
  border: 1px solid #00ffa3;
}

body.synthwave input,
body.synthwave textarea,
body.synthwave select {
  background: #140024;
  color: #ff0080;
  border: 1px solid #ff0080;
}

body.comic-book input,
body.comic-book textarea,
body.comic-book select {
  background: #fff;
  color: #000;
  border: 2px solid #000;
}


/* =================================================
   THEMED HISTORY LIST BORDERS
================================================= */

body.cyberpunk .history li {
  border: 1px solid #ff00cc;
}

body.aurora .history li {
  border: 1px solid #00ffa3;
}

body.synthwave .history li {
  border: 1px solid #ff0080;
}

body.comic-book .history li {
  border: 2px solid #000;
}

/* =================================================
   CARD FOOTER BUTTONS
   Make Generate and Copy buttons even and aligned
================================================= */

.card-footer {
  display: flex;
  justify-content: center;  /* centers the buttons horizontally */
  gap: 20px;                /* even spacing between buttons */
  flex-wrap: wrap;          /* ensures responsiveness on small screens */
}

.card-footer .btn {
  min-width: 160px;         /* ensures both buttons have same width */
  padding: 12px 24px;
  text-align: center;
  display: inline-block;
}