/* ===============================
   Grundfarben (Dark Mode)
   =============================== */
:root {
  --bg: #161620;
  --panel: #262637;
  --text: #f1f1f1;
  --subtext: #c5c5c5;
  --accent: #ffdd57;
  --accent-hover: #ffd633;
  --input-bg: #e9ebf1;
  --input-text: #111;
  --readonly-bg: #111216;
  --shadow: rgba(0, 0, 0, 0.4);
  --border-radius: 12px;
}

/* ===============================
   Light Mode
   =============================== */
[data-theme="light"] {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #1c1c1e;
  --subtext: #555;
  --accent: #ffcc00;
  --accent-hover: #e6b800;
  --input-bg: #f3f3f3;
  --input-text: #000;
  --readonly-bg: #ddd;
  --shadow: rgba(0, 0, 0, 0.15);
}

/* ===============================
   Allgemeine Stile
   =============================== */
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", sans-serif;
  margin: 0;
  padding: 0;
  transition: background 0.3s, color 0.3s;
}

h1,
h2,
h3 {
  font-weight: 600;
}

section {
  background: var(--panel);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 10px var(--shadow);
  padding: 20px;
  max-width: 700px;
  margin: 30px auto;
  transition: background 0.3s;
}

/* ===============================
   Header
   =============================== */
header {
  background: var(--panel);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 10px var(--shadow);
  text-align: center;
  padding: 25px 20px;
  margin: 30px auto;
  max-width: 700px;
  position: relative;
}

header h1 {
  font-size: 1.6rem;
  color: var(--text);
}

header p {
  color: var(--subtext);
  font-size: 0.9rem;
  margin: 5px 0 0;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 25px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s;
}

.theme-toggle:hover {
  transform: scale(1.1);
  color: var(--accent-hover);
}

/* ===============================
   Inputs & Buttons
   =============================== */
textarea,
input {
  width: 95%;
  border: none;
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 10px;
  font-size: 0.95rem;
  resize: none;
  margin-top: 10px;
}

textarea[readonly] {
  background: var(--readonly-bg);
  color: var(--subtext);
}

button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #000;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  margin-right: 8px;
  transition: background 0.3s, transform 0.2s;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.secondary {
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid #ccc;
}

.buttons {
  margin-top: 10px;
}

/* ===============================
   Info-Sektion
   =============================== */
.info-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

.info-section ul {
  list-style: none;
  padding: 0;
}

.info-section li {
  margin-bottom: 8px;
  color: var(--text);
}

.info-section li::before {
  content: "• ";
  color: var(--accent);
}

/* ===============================
   Passwort-Generator
   =============================== */
.password-section h2 {
  color: var(--accent);
}

.pw-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pw-options label {
  font-size: 0.9rem;
}

.pw-length {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
}

#pwOutput {
  margin-top: 10px;
}

/* Passwort-Stärke */
#pwStrength {
  width: 100%;
  height: 8px;
  margin-top: 8px;
  margin-bottom: 5px;
  border-radius: 5px;
}

#strengthBar {
  height: 8px;
  width: 0;
  background: #444;
  border-radius: 8px;
  transition: width 0.3s ease, background 0.3s ease;
}

#strengthText {
  display: block;
  text-align: center;
  margin-top: 6px;
  color: var(--subtext);
  font-size: 0.85rem;
}

/* ===============================
   Toasts
   =============================== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: var(--panel);
  color: var(--text);
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 0 3px 8px var(--shadow);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toast.success { border-left: 5px solid #22c55e; }
.toast.error   { border-left: 5px solid #ef4444; }
.toast.info    { border-left: 5px solid var(--accent); }

/* ===============================
   Footer
   =============================== */
footer {
  text-align: center;
  color: var(--subtext);
  margin: 40px 0;
  font-size: 0.85rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ===============================
   Bild-Encoder (Base64)
   =============================== */
.image-encoder-section h2 {
  color: var(--accent);
  margin-bottom: 10px;
}

.image-encoder-section h3 {
  color: var(--accent);
  margin-top: 0;
  font-size: 1.1rem;
  text-align: left;
}

.image-encoder-section input[type="file"] {
  background: var(--input-bg);
  border: 1px solid #ccc;
  padding: 8px;
  border-radius: 8px;
  color: var(--text);
  width: 100%;
}

.image-encoder-section textarea {
  margin-top: 10px;
}

#imagePreview img {
  box-shadow: 0 4px 12px var(--shadow);
  border-radius: 12px;
  max-width: 100%;
}

/* ===============================
   Responsive
   =============================== */
@media (max-width: 700px) {
  section,
  header {
    width: 90%;
    margin: 20px auto;
  }

  .pw-options {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===============================
   Text-Encrypt & Decrypt gemeinsame Sektion
   =============================== */
.text-crypto-section {
  padding: 25px;
}
.text-crypto-section h2 {
  color: var(--accent);
  margin-bottom: 10px;
  text-align: center;
}
.text-crypto-section h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-top: 0;
  text-align: left;
}
.text-crypto-section textarea { margin-top: 10px; }
.text-crypto-section hr {
  border: none;
  border-top: 1px solid var(--subtext);
  opacity: 0.3;
}

/* ===============================
   Gleicher Abstand für Bild-Encoder & Passwort-Generator
   =============================== */
.image-encoder-section { padding: 25px; }
.image-encoder-section h2 { text-align: center; }

.password-section { padding: 25px; }
.password-section h2 { text-align: center; }

/* ===============================
   Datei-Verschlüsselung (NEU)
   =============================== */
.file-crypto-section { padding: 25px; }
.file-crypto-section h2 {
  color: var(--accent);
  text-align: center;
  margin-bottom: 10px;
}
.file-crypto-section .note {
  color: var(--subtext);
  text-align: center;
  margin: 0 0 10px 0;
  font-size: 0.9rem;
}
.file-crypto-section h3 {
  color: var(--accent);
  margin-top: 0;
  font-size: 1.1rem;
  text-align: left;
}
.file-crypto-section input[type="file"] {
  background: var(--input-bg);
  border: 1px solid #ccc;
  padding: 8px;
  border-radius: 8px;
  color: var(--text);
 width: 70%;        /* Feldbreite */
  margin: 0 auto;    /* Zentriert */
  display: block;    /* nötig zum Zentrieren */
}
.file-crypto-section hr {
  border: none;
  border-top: 1px solid var(--subtext);
  opacity: 0.3;
}

/* ===============================
   Passwort-Stärke Balken
   =============================== */
#pwStrength {
  width: 90%;           /* gleiche Breite wie Eingabefeld */
  height: 8px;           /* angenehme Höhe */
  margin-top: 8px;       /* etwas Abstand nach oben */
  margin-bottom: 25px;    /* etwas Abstand nach unten */
  border-radius: 5px;    /* weiche Ecken */
}

/* Slider (Länge) im Passwort-Generator anpassen */
.password-section input[type="range"] {
  width: 70%; /* ändert die Breite – Standard war 100% */
  display: block;
  margin: 10px auto; /* zentriert den Slider */
}

/* Nur das "Datei auswählen"-Feld bei Bild → Base64 anpassen */
.image-encoder-section input[type="file"] {
  width: 70%;          /* z. B. 80 % der Sektion, kannst du selbst anpassen */
  display: block;      /* wichtig für zentrieren */
  margin: 0 auto;      /* zentriert das Feld */
}

/* =====================================
   Rahmenfarben für jede Hauptsektion
   ===================================== */

/* 🔐 Text-Verschlüsselung */
.text-crypto-section {
  border: 2px solid #ef4444;
  /*box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);*/
}

/* 🔑 Passwort-Generator */
.password-section {
  border: 2px solid #22c55e;
}

/* 🖼️ Bild-Encoder */
.image-encoder-section {
  border: 2px solid #3b82f6;
}

/* 📎 Datei-Verschlüsselung */
.file-crypto-section {
  border: 2px solid #ff9800; /* schönes kräftiges Orange */
}
