:root {
    --dark: #002159;
    --pink: #ff5c8a;
    --light-pink: #ffc1d6;
    --gray: #d9d9d9;
    --white: #ffffff;
    --success: #6cff92;
    --danger: #ff6b6b;
    --glass: rgba(255, 255, 255, 0.12);
    --glass-strong: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.25);
    --field-background: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.3);
}

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

html {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    padding: 30px;
    background:
        url("Imagens Gerador De Senhas/lobo-capa2.0.png")
        center / cover no-repeat fixed;
    font-family: "Poppins", sans-serif;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: 100%;
    max-width: 430px;
    padding: 35px;
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    background: var(--glass);
    box-shadow:
        0 10px 40px var(--shadow),
        inset 0 0 25px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
}

.app-header {
    text-align: center;
}

.lock-area {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.lock-icon {
    color: var(--pink);
    font-size: 60px;
    transition: transform 0.4s;
}

.lock-icon.animate {
    transform: rotate(-20deg) scale(1.2);
}

h1 {
    margin-bottom: 8px;
    color: var(--white);
    font-size: 32px;
    line-height: 1.2;
}

.subtitle {
    margin-bottom: 30px;
    color: var(--dark);
}

.field-card,
.password-field {
    border: 1px solid rgba(255, 92, 138, 0.5);
    border-radius: 20px;
    background: var(--field-background);
    transition:
        border-color 0.3s,
        box-shadow 0.3s;
}

.field-card:focus-within,
.password-field:focus-within {
    border-color: var(--light-pink);
    box-shadow: 0 0 15px rgba(255, 193, 214, 0.2);
}

.field-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    padding: 15px;
}

.field-card label {
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
}

.field-card input,
.password-field input {
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--white);
}

.field-card input {
    width: 100%;
    font-size: 16px;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.field-card.invalid {
    border-color: var(--danger);
}

.field-error,
.options-error {
    min-height: 0;
    color: #ffe0e0;
    font-size: 12px;
}

.field-error:not(:empty) {
    min-height: 18px;
}

.password-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 12px;
}

.password-field input {
    flex: 1;
    font-size: 18px;
    font-weight: 500;
}

.password-field input::selection {
    background: var(--pink);
}

.icon-button,
.delete-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: var(--pink);
    cursor: pointer;
    transition:
        color 0.25s,
        background 0.25s,
        transform 0.25s,
        opacity 0.25s;
}

.icon-button {
    width: 45px;
    height: 45px;
    border-radius: 15px;
    font-size: 18px;
}

.icon-button:hover:not(:disabled),
.delete-button:hover:not(:disabled) {
    background: var(--pink);
    color: var(--white);
    transform: scale(1.06);
}

.icon-button:active:not(:disabled),
.delete-button:active:not(:disabled) {
    transform: scale(0.95);
}

.icon-button:disabled,
.delete-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.slider-section {
    margin-bottom: 25px;
}

.slider-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
    color: var(--white);
}

.slider-info label {
    font-size: 15px;
}

#lengthValue {
    color: var(--pink);
    font-size: 20px;
    font-weight: 700;
}

#passwordLength {
    width: 100%;
    height: 10px;
    appearance: none;
    border-radius: 50px;
    outline: 0;
    background: rgba(255, 255, 255, 0.15);
}

#passwordLength::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    appearance: none;
    border: 3px solid var(--white);
    border-radius: 50%;
    background: var(--pink);
    box-shadow: 0 0 15px var(--pink);
    cursor: pointer;
    transition: transform 0.25s;
}

#passwordLength::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

#passwordLength::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--white);
    border-radius: 50%;
    background: var(--pink);
    cursor: pointer;
}

.strength-section {
    margin-bottom: 28px;
}

.strength-bar {
    width: 100%;
    height: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
}

#strengthProgress {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--gray);
    transition:
        width 0.45s,
        background-color 0.45s;
}

#strengthText {
    display: block;
    color: var(--white);
    font-size: 15px;
    font-weight: 600;
    text-align: right;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
    border: 0;
}

.options label {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    background: var(--field-background);
    cursor: pointer;
    transition:
        border-color 0.25s,
        background 0.25s,
        transform 0.25s;
}

.options label:hover {
    border-color: rgba(255, 92, 138, 0.5);
    background: rgba(255, 255, 255, 0.11);
    transform: translateX(4px);
}

.options span {
    color: var(--white);
    font-size: 15px;
}

.options input,
.history-option input {
    position: relative;
    flex: 0 0 auto;
    appearance: none;
    border: 2px solid var(--light-pink);
    background: transparent;
    cursor: pointer;
    transition:
        background 0.25s,
        border-color 0.25s,
        transform 0.25s;
}

.options input {
    width: 24px;
    height: 24px;
    border-radius: 8px;
}

.options input:hover,
.history-option input:hover {
    transform: scale(1.08);
}

.options input:checked,
.history-option input:checked {
    border-color: var(--pink);
    background: var(--pink);
}

.options input:checked::after,
.history-option input:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    color: var(--white);
    font-weight: 700;
    transform: translate(-50%, -50%);
}

.options input:checked::after {
    font-size: 15px;
}

.options-error {
    display: block;
    min-height: 20px;
    margin-bottom: 6px;
}

.generate-button {
    width: 100%;
    margin-bottom: 30px;
    padding: 18px;
    border: 0;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--pink), var(--light-pink));
    color: var(--dark);
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition:
        box-shadow 0.25s,
        transform 0.25s;
}

.generate-button i {
    margin-right: 8px;
}

.generate-button:hover {
    box-shadow: 0 0 25px rgba(255, 92, 138, 0.5);
    transform: translateY(-3px);
}

.generate-button:active {
    transform: scale(0.98);
}

.history {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: var(--field-background);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
}

.history-header h2 {
    color: var(--white);
    font-size: 18px;
}

#selectionStatus {
    display: block;
    margin-top: 2px;
    color: var(--gray);
    font-size: 11px;
}

.delete-button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.history-empty {
    padding: 14px 6px 4px;
    color: var(--gray);
    font-size: 13px;
    text-align: center;
}

.history-empty[hidden] {
    display: none;
}

#historyList {
    list-style: none;
}

#historyList li {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    font-size: 15px;
    transition:
        border-color 0.25s,
        background 0.25s;
}

#historyList li:last-child {
    margin-bottom: 0;
}

#historyList li:hover {
    background: rgba(255, 255, 255, 0.12);
}

#historyList li.selected {
    border-color: rgba(255, 92, 138, 0.65);
    background: rgba(255, 92, 138, 0.12);
}

.history-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.history-option input {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border-radius: 7px;
}

.history-option input:checked::after {
    font-size: 14px;
}

.history-content {
    min-width: 0;
    flex: 1;
}

.history-name {
    display: block;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
    color: var(--pink);
    font-size: 13px;
}

.history-password {
    display: block;
    overflow-wrap: anywhere;
}

footer {
    color: var(--gray);
    font-size: 14px;
    text-align: center;
}

footer strong {
    color: var(--pink);
}

.version {
    display: block;
    margin-top: 3px;
    font-size: 11px;
}

.toast {
    position: fixed;
    top: 25px;
    left: 50%;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100% - 24px);
    padding: 14px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background: rgba(20, 22, 50, 0.82);
    color: var(--white);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50px);
    transition:
        opacity 0.3s,
        transform 0.3s;
    backdrop-filter: blur(18px);
}

.toast.active {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast i {
    color: var(--success);
    font-size: 19px;
}

.toast.error i {
    color: var(--danger);
}

.field-card,
.password-field,
.slider-section,
.strength-section {
    animation: fade-up 0.5s ease both;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 500px) {
    body {
        align-items: flex-start;
        padding: 10px;
    }

    .container {
        max-width: 360px;
        padding: 18px;
        border-radius: 22px;
    }

    .lock-area {
        margin-bottom: 10px;
    }

    .lock-icon {
        font-size: 42px;
    }

    h1 {
        margin-bottom: 5px;
        font-size: 22px;
    }

    .subtitle {
        margin-bottom: 18px;
        font-size: 14px;
    }

    .field-card {
        gap: 6px;
        margin-bottom: 14px;
        padding: 11px;
        border-radius: 16px;
    }

    .field-card label {
        font-size: 13px;
    }

    .field-card input {
        font-size: 14px;
    }

    .password-field {
        gap: 7px;
        margin-bottom: 18px;
        padding: 9px;
        border-radius: 16px;
    }

    .password-field input {
        font-size: 14px;
    }

    .icon-button {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .slider-section,
    .strength-section {
        margin-bottom: 18px;
    }

    .slider-info {
        margin-bottom: 10px;
    }

    .slider-info label,
    #strengthText {
        font-size: 13px;
    }

    .options {
        gap: 10px;
    }

    .options label {
        padding: 11px;
        border-radius: 14px;
    }

    .options input {
        width: 20px;
        height: 20px;
        border-radius: 6px;
    }

    .options span {
        font-size: 13px;
    }

    .generate-button {
        margin-bottom: 18px;
        padding: 14px;
        border-radius: 16px;
        font-size: 15px;
    }

    .history {
        margin-bottom: 18px;
        padding: 14px;
        border-radius: 16px;
    }

    .history-header {
        margin-bottom: 10px;
    }

    .history-header h2 {
        font-size: 16px;
    }

    .delete-button {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    footer {
        font-size: 12px;
    }
}

@media (max-width: 350px) {
    .password-field {
        flex-wrap: wrap;
    }

    .password-field input {
        flex-basis: 100%;
    }

    .icon-button {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
