* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-hover: #5568d3;
    --bg-primary: #0f0f1e;
    --bg-secondary: #1a1a2e;
    --bg-card: #1e1e3f;
    --border-color: #2d2d4f;
    --text-primary: #e8e8f0;
    --text-secondary: #b8b8c8;
    --success: #4caf50;
    --error: #f44336;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-bg: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #16213e 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gradient-bg);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 15px;
    color: var(--text-primary);
    line-height: 1.4;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

header {
    text-align: center;
    padding: 10px 0;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.settings-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.setting-item input[type="number"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 70px;
}

.setting-item input[type="number"]:hover {
    border-color: var(--primary-color);
}

.setting-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.setting-item.setting-checkbox {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.checkbox-label:hover {
    background: rgba(102, 126, 234, 0.05);
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-text {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: auto;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-secondary.btn-generating {
    animation: pulse 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.btn-secondary.btn-generating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.2);
    transform: translate(-50%, -50%);
    animation: ripple 0.3s ease-out;
}

.btn-primary.btn-generating {
    animation: pulse 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.btn-primary.btn-generating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    animation: ripple 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0.1), 0 0 0 20px rgba(102, 126, 234, 0.05);
    }
}

@keyframes ripple {
    to {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

.passwords-list {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    transition: all 0.3s ease-out;
}

.passwords-list::-webkit-scrollbar {
    width: 6px;
}

.passwords-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.passwords-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.passwords-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.password-item {
    background: var(--bg-secondary);
    padding: 10px 14px;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    margin-bottom: 6px;
    user-select: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.password-item {
    will-change: transform, opacity, filter;
}

.password-item:last-child {
    margin-bottom: 0;
}

.password-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.password-item:active {
    transform: translateX(2px);
}

.password-number {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 10px;
    flex-shrink: 0;
    min-width: 24px;
}

.password-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.password-content .password-text {
    word-break: break-all;
    letter-spacing: 0.3px;
}

.password-text {
    flex: 1;
    word-break: break-all;
    letter-spacing: 0.3px;
}

.password-phrase {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0.7;
    white-space: nowrap;
}

.password-item .copy-icon {
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--primary-color);
    font-size: 0.85rem;
    margin-left: 10px;
    flex-shrink: 0;
}

.password-item:hover .copy-icon {
    opacity: 1;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    display: none;
    z-index: 1000;
    animation: slideInNotification 0.3s ease;
}

@keyframes slideInNotification {
    from {
        transform: translateX(calc(100% + 20px));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: var(--success);
    color: white;
}

.notification.error {
    background: var(--error);
    color: white;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        height: 100vh;
        gap: 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .settings-row {
        gap: 8px;
    }
    
    .setting-item {
        flex: 1;
        min-width: 100px;
    }
    
    .setting-item input[type="number"] {
        width: 60px;
    }
    
    .btn-primary {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .password-item {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    .settings-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .setting-item {
        width: 100%;
    }
    
    .setting-item input[type="number"] {
        width: 100%;
    }
}
