/* 
  STYLE MAP
  1. Layout
  2. Navigation
  3. Main panels
  4. Buttons
  5. Password strength
  6. Tooltips
  7. Audio
  8. Footer
  9. Animations
  10. Tryb minimalistyczny
*/

/* ==================================================
   GLOBAL LAYOUT
================================================== */
body {
    background-color: #000;
    color: #fff;
    font-family: 'Galactic', sans-serif;
    margin: 0;

    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 24px;
}

/* ==================================================
   NAVIGATION
================================================== */
nav {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 15px;

    background: rgba(17, 17, 17, 0.6);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(6px);
    z-index: 10;

    box-shadow: 0 0 15px rgba(0, 170, 255, 0.3);
    animation: slideInTopLeft 0.8s ease-out forwards;
}

nav button {
    background: transparent;
    color: #fff;
    border: 1.5px solid #00aaff;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;

    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.25s ease;
}

nav button:nth-child(1) { animation: fadeInButtons 0.4s 0.2s forwards; }
nav button:nth-child(2) { animation: fadeInButtons 0.4s 0.4s forwards; }
nav button:nth-child(3) { animation: fadeInButtons 0.4s 0.6s forwards; }

nav button:hover {
    color: #00ffff;
    background: rgba(0, 123, 255, 0.2);
    transform: scale(1.08);
    box-shadow: 0 0 8px #00ffff, 0 0 16px #00aaff;
}

nav button.active {
    background: rgba(0, 123, 255, 0.5);
    border-color: #00ccff;
    animation: pulse 2.5s infinite ease-in-out;
}

/* ==================================================
   HEADER / LOGO
================================================== */
#logo {
    position: absolute;
    top: 15px;
    right: 25px;
    width: 150px;
}

h1 {
    margin-top: 140px;
    font-size: 24px;
}

/* ==================================================
   MAIN PANELS
================================================== */
#password-container,
#password-list-container {
    width: 400px;
    margin-top: 20px;
    padding: 20px;

    background: #333;
    border-radius: 10px;
    text-align: center;

    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#password-list-container {
    width: 400px;
    padding: 0;                
    border-radius: 10px;
    overflow: visible;
    box-sizing: border-box;     
}


#generated-password {
    font-size: 22px;
    font-weight: bold;
    margin: 10px 0;
}

#password-list {
    width: 100%;
    max-height: 200px;
    font-size: 14px;
    text-align: left;
}

.danger-btn {
    border-color: #ff5555;
}

.danger-btn:hover {
    color: #ffcccc;
    background: rgba(255, 85, 85, 0.15);
    box-shadow: 0 0 8px rgba(255, 85, 85, 0.6);
}
.password-history {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    font-size: 13px;
}

.password-history li {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 6px 8px;
    margin-bottom: 4px;

    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
}
.password-history li:hover {
    background: rgba(0, 170, 255, 0.15);
}

.password-text {
    font-weight: 600;
    word-break: break-all;
}

.password-meta {
    font-size: 11px;
    opacity: 0.7;
    white-space: nowrap;
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ff6666;
    font-size: 14px;
    padding: 0 4px;
}

.delete-btn:hover {
    color: #ffaaaa;
}
.password-list-scroll {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-right: -8px;     /* kompensacja scrollbara */
    padding-right: 8px;
    box-sizing: content-box;
}
.password-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.password-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 170, 255, 0.6);
    border-radius: 6px;
}

.password-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.panel-inner {
    padding: 20px;
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.password-history li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;

    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
}

.password-history li:hover {
    background: rgba(0, 170, 255, 0.15);
}

.password-text {
    font-weight: 600;
    cursor: pointer;
    word-break: break-all;
}

.password-meta {
    font-size: 11px;
    opacity: 0.7;
    white-space: nowrap;
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ff6666;
    font-size: 14px;
}

.delete-btn:hover {
    color: #ffaaaa;
}


/* ==================================================
   BUTTONS
================================================== */
.action-button {
    background: transparent;
    color: #fff;
    border: 1.5px solid #00aaff;
    border-radius: 6px;
    padding: 8px 16px;
    min-width: 140px;

    cursor: pointer;
    transition: all 0.25s ease;
}

.action-button:hover {
    color: #00ffff;
    background: rgba(0, 123, 255, 0.2);
    transform: scale(1.08);
    box-shadow: 0 0 8px #00ffff, 0 0 16px #00aaff;
}

.copy-btn {
    border-color: #00ff99;
}
.panel-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    position: relative; 
}

.panel-actions .action-button {
    width: 100%;
    min-width: 0; 
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Na wąskich ekranach układ w kolumnie */
@media (max-width: 460px) {
    .panel-actions {
        grid-template-columns: 1fr;
    }
}

/* ==================================================
   PASSWORD STRENGTH + ENTROPY
================================================== */
.strength-container {
    width: 100%;
    height: 10px;
    margin-top: 8px;

    background: #000;
    border: 1px solid #333;
    border-radius: 6px;
    overflow: hidden;
}

#strength-bar {
    height: 100%;
    width: 0%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

#strength-text,
#entropy-text {
    margin-top: 6px;
    font-size: 12px;
    color: #f0f0f0;
    text-align: center;
}

#entropy-text {
    font-size: 11px;
    opacity: 0.85;
}

.strength-weak { background: #ff4444; }
.strength-medium { background: #ffaa00; }
.strength-strong { background: #00ff99; }
.strength-very-strong { background: #00ccff; }

/* ==================================================
   INFO TOOLTIP
================================================== */
.info-icon {
    margin-left: 6px;
    color: #00ccff;
    cursor: help;
    position: relative;
}

.info-tooltip {
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);

    width: 220px;
    padding: 8px 10px;
    font-size: 11px;

    background: #000;
    color: #f0f0f0;
    border-radius: 6px;
    opacity: 0;
    pointer-events: auto;

    box-shadow: 0 0 10px rgba(0, 204, 255, 0.4);
    transition: opacity 0.2s ease;
}

.info-icon:hover .info-tooltip {
    opacity: 1;
}

/* ==================================================
   MANUAL PASSWORD INPUT
================================================== */
#manual-password {
    width: 100%;
    margin-top: 10px;
    padding: 8px;

    background: #000;
    color: #fff;
    border: 1px solid #00aaff;
    border-radius: 6px;
    text-align: center;
}

/* ==================================================
   MUSIC CONTROLS
================================================== */
#music-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 20;

    display: flex;
    flex-direction: column;
    gap: 8px;
}

#mute-button {
    background: rgba(0, 0, 0, 0.5);
    color: #00ffff;
    border: 1px solid #00aaff;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
}

#volume-slider {
    width: 100px;
}

/* ==================================================
   CANVAS
================================================== */
canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

/* ==================================================
   FOOTER
================================================== */
#footer {
    margin-top: 12px;
    padding: 14px 0;
    font-size: 14px;
    text-align: center;
    color: #d0d0d0;
}

.footer-separator {
    width: 60%;
    height: 1px;
    margin: 0 auto 8px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(0, 170, 255, 0.6),
        transparent
    );
}

/* ==================================================
   ANIMATIONS
================================================== */
@keyframes slideInTopLeft {
    from { opacity: 0; transform: translate(-20px, -20px); }
    to { opacity: 1; transform: translate(0, 0); }
}

@keyframes fadeInButtons {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 6px #00aaff; }
    50% { box-shadow: 0 0 20px #00ccff; }
    100% { box-shadow: 0 0 6px #00aaff; }
}

/* =========================
   TRYB MINIMALISTYCZNY
========================= */
body.minimal-mode {
    background: #000;
}

body.minimal-mode canvas,
body.minimal-mode #music-controls,
body.minimal-mode #password-list-container {
    display: none !important;
}

body.minimal-mode nav,
body.minimal-mode #logo {
    display: none;
}

body.minimal-mode .action-button {
    box-shadow: none;
    animation: none;
}

body.minimal-mode .strength-container {
    background: #111;
    border-color: #444;
}

/* =========================
   EXPORT – STABILNY DROPDOWN (FINAL)
========================= */

#password-list-container .export-container {
  position: relative;
  width: 100%;
}

#password-list-container .export-toggle {
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* layout przycisków: Zapisz + Wyczyść */
#password-list-container .panel-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 460px) {
  #password-list-container .panel-actions {
    grid-template-columns: 1fr;
  }
}

/* === DROPDOWN === */
#password-list-container .export-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;

  display: none;
  flex-direction: column;
  gap: 8px;

  padding: 10px;

  background: rgba(10,10,10,0.95);
  border: 1.5px solid #00aaff;
  border-radius: 10px;

  box-shadow:
    0 0 12px rgba(0,170,255,.45),
    inset 0 0 10px rgba(0,170,255,.15);

  z-index: 1000;
}

#password-list-container .export-container.open .export-dropdown {
  display: flex;
}

/* =========================
   EXPORT – FINAL (STABILNY)
========================= */

.export-container {
  position: relative;
  width: 100%;
}

.export-toggle {
  width: 100%;
}

/* panel */
.export-options {
  display: none;
  margin-top: 8px;

  flex-direction: column;
  gap: 8px;
}

/* pokazanie */
.export-container.open .export-options {
  display: flex;
}

/* opcje = normalne przyciski */
.export-option {
  width: 100%;
}
/* === MANUAL PASSWORD – FIX === */
#password-list-container .panel-inner {
  align-items: stretch; /* wymusza poprawną szerokość dzieci */
}

#manual-password {
  width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
}
/* =========================
   MANUAL PASSWORD – FEEDBACK (FIXED)
========================= */

#manual-password {
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
    outline: none;
}

/* ✅ DODANO */
#manual-password.manual-added {
    border-color: #00ff99 !important;
    box-shadow:
        0 0 8px #00ff99,
        0 0 18px #00ff99 !important;
    animation: manualPulse 0.6s ease;
}

/* ❌ DUPLIKAT */
#manual-password.manual-duplicate {
    border-color: #ff4444 !important;
    box-shadow:
        0 0 8px #ff4444,
        0 0 18px #ff4444 !important;
    animation: manualShake 0.4s ease;
}

/* ANIMACJE */
@keyframes manualPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.04); }
    100% { transform: scale(1); }
}

@keyframes manualShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}
/* =========================
   HISTORY FILTERS
========================= */

.history-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-btn {
    flex: 1;
    background: transparent;
    color: #fff;
    border: 1.5px solid #00aaff;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-btn:hover {
    color: #00ffff;
    background: rgba(0, 123, 255, 0.2);
    box-shadow: 0 0 6px #00ffff;
}

.filter-btn.active {
    background: rgba(0, 123, 255, 0.45);
    border-color: #00ffcc;
    box-shadow: 0 0 10px #00ffcc;
}
/* =========================
   HISTORY FILTERS – ONE ROW FIX
========================= */

.history-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

/* mniejsze, zwarte */
.filter-btn {
    padding: 6px 0;
    font-size: 12px;
    min-width: 0;
    width: 100%;
    line-height: 1.2;
}


/* żeby NIE rozjeżdżały się na 2 linie */
@media (max-width: 460px) {
    .history-filters {
        flex-wrap: nowrap;
    }
}
