/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

/* Container */
.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 500px;
    backdrop-filter: blur(10px);
}

/* Typography */
h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2d3748;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Form styling */
.generator-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
}

/* Length slider wrapper - positions length display to the left of the slider */
.length-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Password length number input - always visible */
.length-display {
    width: 60px;
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a5568;
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

.length-display:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.length-display:hover {
    border-color: #cbd5e0;
}

/* Slider styling */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.slider:hover {
    background: #cbd5e0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: grab;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    border: 2px solid white;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: grab;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.slider::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #e2e8f0;
    border-radius: 4px;
    border: none;
}

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.checkbox-label:hover {
    background-color: #f7fafc;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    cursor: pointer;
}

/* Password container */
.password-container {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

#password-output {
    width: 100%;
    min-width: 200px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    background-color: #f8fafc;
    color: #2d3748;
    transition: all 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    resize: horizontal;
    min-height: 50px;
}

#password-output:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Button styling */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.refresh-btn, .copy-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.refresh-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.6);
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.refresh-btn:active {
    transform: translateY(0);
}

.copy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.copy-btn:active {
    transform: translateY(0);
}

/* Success animation for copy button */
.copy-btn.copied {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

/* Loading state */
.loading {
    /* Removed opacity fade effect to prevent unnerving visual flashing */
    pointer-events: none;
}

/* Responsive design */
@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .password-container {
        flex-direction: column;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Error message styling */
.error-message {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 5px;
    padding: 10px;
    background-color: #fed7d7;
    border-radius: 6px;
    border-left: 4px solid #e53e3e;
}
