/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --warning-color: #ef4444;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #1e293b;
    --bg-darker: #0f172a;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    
    /* Border Colors */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border-light: #334155;
        --border-medium: #475569;
        --border-dark: #64748b;
    }
}

/* Base Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Header */
.app-header {
    padding: var(--space-8) 0 var(--space-6);
    text-align: center;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
}

.main-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.title-icon {
    font-size: 1.2em;
    filter: drop-shadow(0 4px 8px rgb(0 0 0 / 0.1));
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
    font-weight: 500;
}

.aaacoder-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-tertiary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.aaacoder-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.aaacoder-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    padding-bottom: var(--space-16);
}

/* Sections */
.options-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    text-align: center;
}

/* Options Grid */
.options-grid {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.option-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    border: 1px solid var(--border-light);
    transition: all var(--transition-normal);
}

.option-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.option-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    gap: var(--space-4);
}

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

/* Toggle Switches */
.toggle-switch {
    position: relative;
    display: inline-block;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: relative;
    display: block;
    width: 3.5rem;
    height: 2rem;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle-label::after {
    content: '';
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle-input:checked + .toggle-label {
    background: var(--primary-color);
}

.toggle-input:checked + .toggle-label::after {
    transform: translateX(1.5rem);
}

.toggle-switch-large .toggle-label {
    width: 4rem;
    height: 2.25rem;
}

.toggle-switch-large .toggle-label::after {
    width: 1.75rem;
    height: 1.75rem;
}

.toggle-switch-large .toggle-input:checked + .toggle-label::after {
    transform: translateX(1.75rem);
}

/* Sliders */
.slider-container {
    margin-top: var(--space-6);
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    font-weight: 500;
    color: var(--text-primary);
}

.slider-value {
    background: var(--primary-color);
    color: white;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 2.5rem;
    text-align: center;
}

.range-slider {
    width: 100%;
    height: 0.5rem;
    border-radius: var(--radius-full);
    background: var(--border-light);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-slider::-moz-range-thumb {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

/* Select Groups */
.select-group {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.select-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

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

.select-input {
    padding: var(--space-3);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.custom-input {
    padding: var(--space-3);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.custom-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

/* Mode Section */
.mode-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.mode-toggle {
    display: flex;
    justify-content: center;
}

.mode-label {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    cursor: pointer;
}

.mode-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Password Section */
.password-section {
    background: var(--bg-primary, #ffffff);
    border-radius: var(--radius-xl, 1rem);
    padding: var(--space-8, 2rem);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    border: 1px solid var(--border-light, #e2e8f0);
    margin-bottom: 1rem;
}

.single-password-container {
    max-width: 500px;
    margin: 0 auto;
}

.password-display {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3, 0.75rem);
}

.password-input {
    flex: 1;
    padding: var(--space-4, 1rem);
    border: 2px solid var(--border-medium, #cbd5e1);
    border-radius: var(--radius-lg, 0.75rem);
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 1.125rem;
    text-align: center;
    transition: border-color var(--transition-fast, 150ms ease-in-out);
    min-height: 3rem;
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.copy-button {
    padding: var(--space-4, 1rem) var(--space-6, 1.5rem);
    background: var(--primary-color, #6366f1);
    color: white;
    border: none;
    border-radius: var(--radius-lg, 0.75rem);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms ease-in-out);
    white-space: nowrap;
    min-width: 80px;
}

.copy-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Password Section Title */
.password-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: var(--space-4, 1rem);
    text-align: center;
    margin-top: 0;
}



/* Settings Section */
.settings-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

/* Generate Section */
.generate-section {
    display: flex;
    justify-content: center;
}

.generate-button {
    position: relative;
    padding: var(--space-4) var(--space-8);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.generate-button:active {
    transform: translateY(0);
}

.generate-button.loading {
    pointer-events: none;
}

.button-text {
    transition: opacity var(--transition-fast);
}

.generate-button.loading .button-text {
    opacity: 0;
}

.button-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.generate-button.loading .button-loader {
    opacity: 1;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Security Section */
.security-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.security-info {
    text-align: center;
}

.info-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.5;
}

.info-success {
    background: rgb(16 185 129 / 0.1);
    border: 1px solid rgb(16 185 129 / 0.2);
    color: var(--text-primary);
}

.info-warning {
    background: rgb(245 158 11 / 0.1);
    border: 1px solid rgb(245 158 11 / 0.2);
    color: var(--text-primary);
}

.info-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.security-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.security-link:hover {
    text-decoration: underline;
}

/* Footer */
.app-footer {
    margin-top: auto;
    padding: var(--space-8) 0 var(--space-6);
    border-top: 1px solid var(--border-light);
}

.footer-content {
    text-align: center;
}

.footer-main {
    margin-bottom: var(--space-4);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-seo {
    max-width: 800px;
    margin: 0 auto;
}

.seo-keywords {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.6;
    word-spacing: 0.125rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0 var(--space-3);
    }
    
    .options-section,
    .mode-section,
    .password-section,
    .settings-section,
    .security-section {
        padding: var(--space-6);
    }
    
    .main-title {
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .option-label {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .mode-label {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .password-display {
        flex-direction: column;
        gap: var(--space-3);
    }
    

}

@media (max-width: 480px) {
    .app-header {
        padding: var(--space-6) 0 var(--space-4);
    }
    
    .main-content {
        gap: var(--space-6);
    }
    
    .options-section,
    .mode-section,
    .password-section,
    .settings-section,
    .security-section {
        padding: var(--space-4);
    }
    
    .generate-button {
        width: 100%;
        min-width: auto;
    }
}

/* Accessibility */
@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-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

/* Fallback styles for password display */
.password-input:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.multi-password-input:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Ensure password inputs are always visible */
.password-input {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure copy buttons are always visible */
.copy-button {
    display: inline-block !important;
    box-sizing: border-box !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000000;
        --border-medium: #000000;
        --text-secondary: #000000;
    }
}