:root {
    --bg-dark: #000000;
    --card-bg: rgba(17, 25, 40, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    /* Blue 500 */
    --primary-hover: #2563eb;
    /* Blue 600 */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

[data-theme="light"] {
    --bg-dark: #faf9f4;
    --card-bg: rgba(255, 255, 255, 0.7);
    --border-color: rgba(15, 23, 42, 0.1);
    --text-main: #0f172a;
    --text-muted: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    animation: fadeIn 0.8s ease-out;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin: 0 auto;
    padding-left: 44px;
    /* Balance the toggle button */
}

.theme-toggle {
    margin-left: 0;
}

.moon-icon {
    display: none;
}

[data-theme="light"] .moon-icon {
    display: block;
}

[data-theme="light"] .sun-icon {
    display: none;
}

header h1 span {
    color: var(--primary);
}

header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.password-display-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.password-display-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#passwordOutput {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    width: 0;
    flex-grow: 1;
    outline: none;
    letter-spacing: 1px;
}

#passwordOutput:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: 4px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 10px;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
}

.icon-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 20px;
    min-height: 20px;
    text-align: center;
    font-weight: 500;
}

.strength-meter-container {
    margin-bottom: 30px;
}

.strength-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

#strengthText {
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 0;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
    background-color: var(--danger);
}

.progress-fill.weak {
    background-color: var(--danger);
    width: 25%;
}

.progress-fill.fair {
    background-color: var(--warning);
    width: 40%;
}

.progress-fill.strong {
    background-color: #a3e635;
    width: 60%;
}

.progress-fill.excellent {
    background-color: var(--success);
    width: 80%;
}

.progress-fill.paranoid {
    background-color: var(--primary);
    width: 100%;
}

.entropy-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.control-group {
    margin-bottom: 25px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.label-row label {
    font-size: 0.9rem;
    font-weight: 600;
}

#lengthValue {
    color: var(--primary);
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-item label:last-child {
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.option-item:hover label:last-child {
    color: var(--text-main);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.custom-words-group input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 10px;
    color: var(--text-main);
    outline: none;
    margin-top: 5px;
    transition: border-color 0.3s;
}

.custom-words-group input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.custom-words-group input:focus {
    border-color: var(--primary);
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.primary-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    margin-top: 10px;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

footer {
    text-align: center;
    margin-top: 30px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 20px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.8rem;
    }
}