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

:root {
    --color-background: #0a0e17; 
    --color-surface-dark: rgba(16, 23, 41, 0.7); 
    --color-surface-light: rgba(255, 255, 255, 0.05); 
    --color-text-primary: #e2e8f0; 
    --color-text-secondary: #94a3b8; 
    --color-accent-primary: #00f0ff; 
    --color-accent-secondary: #8a2be2; 
    --color-success: #10b981; 
    --color-warning: #eab308;
    --color-danger: #f43f5e;
    
    --font-family-primary: 'Inter', sans-serif;
    --font-family-monospace: 'Space Mono', monospace;
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glow-neon: 0 0 10px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3);
    --glow-neon-strong: 0 0 15px rgba(0, 240, 255, 0.7), 0 0 30px rgba(0, 240, 255, 0.5);
    
    --border-glass: 1px solid rgba(255, 255, 255, 0.1);
    --border-glass-highlight: 1px solid rgba(0, 240, 255, 0.3);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

.background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

body.dark-theme {
    font-family: var(--font-family-primary);
    background-color: var(--color-background);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(138, 43, 226, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 240, 255, 0.15), transparent 25%);
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-wrapper {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.app-header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.main-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.highlight-text {
    color: var(--color-accent-primary);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.subtitle {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}


.glass-panel {
    background: var(--color-surface-dark);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-glass);
    animation: fadeIn 1s ease-out;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition-medium), border var(--transition-medium);
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.glass-panel:hover {
    box-shadow: var(--shadow-glass), 0 0 15px rgba(0, 240, 255, 0.1);
    border: var(--border-glass-highlight);
}

.display-section {
    position: relative;
    margin-bottom: 24px;
}

.glow-effect-container {
    transition: box-shadow 0.8s ease-out, border-color 0.8s ease-out;
}

.glow-effect-container.password-active {
    box-shadow: var(--glow-neon-strong);
    border-color: var(--color-accent-primary);
    animation: intenseGlowFlash 1s ease-out;
}

@keyframes intenseGlowFlash {
    0% { box-shadow: 0 0 0px rgba(0, 240, 255, 0); }
    30% { box-shadow: 0 0 30px rgba(0, 240, 255, 0.8), 0 0 45px rgba(0, 240, 255, 0.6); }
    100% { box-shadow: 0 0 10px rgba(0, 240, 255, 0.5); }
}

.password-display-container {
    display: flex;
    align-items: center;
    background: var(--color-surface-light);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

.password-display-container:focus-within {
    border-color: var(--color-accent-primary);
    box-shadow: var(--glow-neon);
}

.password-display {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--color-accent-primary);
    font-family: var(--font-family-monospace);
    font-size: 1.5rem;
    font-weight: 700;
    outline: none;
    width: 100%;
}

.password-display::placeholder {
    color: rgba(226, 232, 240, 0.2);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.icon-btn:hover {
    color: var(--color-accent-primary);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}

.visibility-btn {
    margin-right: 2px;
}

.hidden {
    display: none !important;
}

@keyframes successCopyPop {
    0% { transform: scale(1); color: var(--color-accent-primary); }
    40% { transform: scale(1.3); color: var(--color-success); }
    100% { transform: scale(1); color: var(--color-text-secondary); }
}

.copy-success-anim {
    animation: successCopyPop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    color: var(--color-success) !important;
}

.copy-feedback {
    position: absolute;
    top: -30px;
    right: 0;
    background: var(--color-success);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.copy-feedback.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    display: block !important; 
}

.strength-indicator-container {
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: var(--border-glass);
    transition: all var(--transition-medium);
}

.strength-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.strength-label {
    color: var(--color-text-secondary);
}

.strength-text {
    font-family: var(--font-family-monospace);
    transition: color 0.4s ease-in-out, text-shadow 0.4s ease-in-out;
}

.strength-weak { color: var(--color-danger); text-shadow: 0 0 10px rgba(244, 63, 94, 0.5); }
.strength-medium { color: var(--color-warning); text-shadow: 0 0 10px rgba(234, 179, 8, 0.5); }
.strength-strong { color: var(--color-success); text-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }

.strength-bar-background {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), 
                background-color 0.4s ease-in-out, 
                box-shadow 0.4s ease-in-out;
}

.strength-fill-weak {
    width: 25%;
    background-color: var(--color-danger);
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.8);
}

.strength-fill-medium {
    width: 50%;
    background-color: var(--color-warning);
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.8);
}

.strength-fill-strong {
    width: 100%;
    background-color: var(--color-success);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.9);
}

.length-control-group {
    margin-bottom: 30px;
}

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

.control-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.length-value {
    font-family: var(--font-family-monospace);
    font-size: 1.25rem;
    font-weight: 700;
}

.slider-container {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--color-surface-light);
}

.length-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: transparent;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    outline: none;
}

.length-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--color-text-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--color-accent-primary);
    transition: background 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), 
                transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.3s ease;
}

.length-slider::-webkit-slider-thumb:hover {
    background: var(--color-accent-primary);
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.length-slider::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--color-text-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--color-accent-primary);
    transition: background 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), 
                transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.3s ease;
}

.length-slider::-moz-range-thumb:hover {
    background: var(--color-accent-primary);
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--color-accent-primary);
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-left: 36px;
}

.checkbox-label-text {
    font-size: 1rem;
    color: var(--color-text-primary);
    transition: color 0.3s ease;
}

.checkbox-container:hover .checkbox-label-text {
    color: var(--color-accent-primary);
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.2);
}

.criteria-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background-color: var(--color-surface-light);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-container:hover .criteria-checkbox ~ .custom-checkbox {
    border-color: var(--color-accent-primary);
    box-shadow: inset 0 0 5px rgba(0, 240, 255, 0.2);
}

.checkbox-container .criteria-checkbox:checked ~ .custom-checkbox {
    background-color: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    box-shadow: var(--glow-neon), inset 0 0 8px rgba(0,0,0,0.2);
}

.custom-checkbox:after {
    content: "";
    position: absolute;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.checkbox-container .criteria-checkbox:checked ~ .custom-checkbox:after {
    display: block;
    opacity: 1;
}

.checkbox-container .custom-checkbox:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid var(--color-background);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}


.action-section {
    display: flex;
    justify-content: center;
}

@keyframes pulseBorderNeon {
    0% { box-shadow: 0 0 10px rgba(0, 240, 255, 0.2); border-color: rgba(0, 240, 255, 0.5); }
    50% { box-shadow: 0 0 25px rgba(0, 240, 255, 0.6), 0 0 40px rgba(0, 240, 255, 0.3); border-color: rgba(0, 240, 255, 1); }
    100% { box-shadow: 0 0 10px rgba(0, 240, 255, 0.2); border-color: rgba(0, 240, 255, 0.5); }
}

.primary-btn {
    width: 100%;
    padding: 18px;
    background: transparent;
    color: var(--color-text-primary);
    text-transform: uppercase;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    border: 2px solid var(--color-accent-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.primary-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    color: var(--color-accent-primary);
    transform: translateY(-3px);
    animation: pulseBorderNeon 1.5s infinite alternate;
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:active {
    transform: translateY(1px);
    box-shadow: var(--glow-neon);
    animation: none;
    background: rgba(0, 240, 255, 0.3);
}

.btn-icon {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.primary-btn:hover .btn-icon {
    transform: translateX(8px);
}

.history-section {
    margin-top: 24px;
    border-top: var(--border-glass);
    padding-top: 20px;
    transition: opacity var(--transition-medium), transform var(--transition-medium);
}

.history-section.hidden {
    display: none !important;
}

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

.history-title {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

.text-btn:hover {
    color: #ff1f4b;
    text-shadow: 0 0 5px rgba(244, 63, 94, 0.4);
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-track { background: var(--color-surface-light); border-radius: 3px; }
.history-list::-webkit-scrollbar-thumb { background: var(--color-text-secondary); border-radius: 3px; }
.history-list::-webkit-scrollbar-thumb:hover { background: var(--color-accent-primary); }

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface-light);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: border var(--transition-fast), background var(--transition-fast);
}

.history-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.history-password-text {
    font-family: var(--font-family-monospace);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    pointer-events: none; 
}

.app-footer {
    text-align: center;
    margin-top: 10px;
    animation: fadeInUp 0.8s ease-out;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .glass-panel { padding: 20px; }
    .password-display { font-size: 1.25rem; }
    .length-value { font-size: 1.1rem; }
    .primary-btn { padding: 15px; font-size: 1rem; }
}