/* 全局样式 */
:root {
    --primary-color: #4a90e2;
    --primary-light: #6ba7e8;
    --primary-dark: #357abd;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --danger-color: #e74c3c;
    --light-gray: #f8f9fa;
    --dark-gray: #2c3e50;
    --border-radius: 10px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --gradient: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    --animation-duration: 0.3s;
    --animation-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    background-color: var(--light-gray);
    color: var(--dark-gray);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 辅助类 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 头部样式 */
.header {
    background-color: white;
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideDown var(--animation-duration) var(--animation-timing);
}

.header .container {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform var(--transition);
    cursor: pointer;
}

.logo:hover {
    transform: scale(1.05);
}

.logo .fa-key {
    font-size: 1.8rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 1.6rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* 主要内容样式 */
main {
    padding: 2rem 0;
}

main .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.generator-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
    animation: fadeIn var(--animation-duration) var(--animation-timing);
}

.generator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
}

/* 输入区域样式 */
.input-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--light-gray);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 1rem;
    letter-spacing: 0.3px;
}

.input-description {
    font-size: 0.9rem;
    color: var(--dark-gray);
    margin-top: 0.5rem;
    opacity: 0.8;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e1e1e1;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--light-gray);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
    background: white;
}

input[type="text"]:active,
input[type="password"]:active {
    transform: scale(0.99);
}

/* 设置区域样式 */
.settings-section {
    margin-bottom: 2rem;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.settings-header h3 {
    margin: 0;
    color: var(--secondary-color);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.toggle-settings-btn {
    background: var(--light-gray);
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0.6rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.toggle-settings-btn:hover {
    color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.1);
    transform: scale(1.05);
}

.toggle-settings-btn i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.toggle-settings-btn.collapsed i {
    transform: rotate(-90deg);
}

.settings-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.settings-content.collapsed {
    max-height: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.setting-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: fadeIn var(--animation-duration) var(--animation-timing);
    display: flex;
    flex-direction: column;
}

.setting-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
    border-color: transparent;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.card-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--secondary-color);
}

.card-icon .fa-hashtag,
.card-icon .fa-lock {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.badge {
    background: var(--gradient);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* 开关样式 */
.toggle-setting {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--secondary-color);
}

.toggle-description {
    font-size: 0.85rem;
    color: var(--dark-gray);
    opacity: 0.7;
    margin-top: 0.5rem;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
}

/* 滑块样式 */
.slider-container {
    margin-top: 1rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-weight: 500;
    font-size: 0.95rem;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e1e1e1;
    border-radius: 3px;
    -webkit-appearance: none;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    cursor: pointer;
}

input[type="range"]:hover {
    background: #d1d1d1;
}

input[type="range"]:active {
    background: #c1c1c1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.3);
    background: var(--primary-dark);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.3);
    background: var(--primary-dark);
}

/* 结果区域样式 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.result-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    animation: fadeIn var(--animation-duration) var(--animation-timing);
    display: flex;
    flex-direction: column;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.result-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--secondary-color);
}

.result-icon .fa-hashtag,
.result-icon .fa-lock {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.result-value {
    position: relative;
    display: flex;
    align-items: center;
}

.result-value input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e1e1e1;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    background: white;
    transition: var(--transition);
}

.copy-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
}

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

.toggle-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition);
    position: absolute;
    right: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.toggle-btn:hover {
    color: var(--primary-color);
}

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

.toggle-btn i {
    font-size: 1.2rem;
    transition: var(--transition);
}

.toggle-btn.show-password i {
    color: var(--primary-color);
}

.input-wrapper input,
.result-value input {
    padding-right: 40px;
}

/* 通知样式 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--box-shadow);
    z-index: 1000;
    max-width: 90%;
    word-wrap: break-word;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* 页脚样式 */
.footer {
    background: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    animation: slideUp var(--animation-duration) var(--animation-timing);
}

.footer .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* 响应式设计 */
/* 平板设备 */
@media (max-width: 1024px) {
    .container,
    main .container,
    .header .container,
    .footer .container {
        max-width: 100%;
        padding: 0 16px;
    }
    
    .settings-grid,
    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.2rem;
    }
    
    .generator-card {
        padding: 1.5rem;
    }
}

/* 手机设备 */
@media (max-width: 768px) {
    .header {
        padding: 0.8rem 0;
    }
    
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .logo {
        gap: 10px;
    }
    
    .logo .fa-key {
        font-size: 1.5rem;
    }
    
    .container,
    main .container,
    .header .container,
    .footer .container {
        padding: 0 12px;
    }
    
    main {
        padding: 1.2rem 0;
    }
    
    .generator-card {
        padding: 1.2rem;
        margin-bottom: 1.2rem;
    }
    
    .input-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .settings-grid,
    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .input-group {
        margin-bottom: 1.2rem;
    }
    
    .input-group label {
        font-size: 0.95rem;
    }
    
    input[type="text"],
    input[type="password"] {
        padding: 0.9rem 1rem;
        font-size: 16px;
    }
    
    .copy-btn {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }
    
    .toggle-btn {
        padding: 0.6rem;
    }
    
    .settings-header h3 {
        font-size: 1rem;
    }
    
    .toggle-settings-btn {
        width: 36px;
        height: 36px;
    }
    
    .setting-card,
    .result-card {
        padding: 1rem;
    }
    
    .card-header,
    .result-header {
        margin-bottom: 1rem;
        padding-bottom: 0.8rem;
    }
    
    .slider-header {
        font-size: 0.9rem;
    }
    
    .toggle-label {
        font-size: 0.9rem;
    }
    
    .toggle-description {
        font-size: 0.8rem;
    }
    
    .footer {
        padding: 1.5rem 0;
        margin-top: 2rem;
    }
    
    .footer p {
        font-size: 0.85rem;
    }
}

/* 小屏手机设备 */
@media (max-width: 480px) {
    .header {
        padding: 0.6rem 0;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    .logo {
        gap: 8px;
    }
    
    .logo .fa-key {
        font-size: 1.3rem;
    }
    
    .container,
    main .container,
    .header .container,
    .footer .container {
        padding: 0 10px;
    }
    
    main {
        padding: 1rem 0;
    }
    
    .generator-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .input-section {
        margin-bottom: 1.2rem;
        padding-bottom: 1.2rem;
    }
    
    .input-group {
        margin-bottom: 1rem;
    }
    
    .input-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    input[type="text"],
    input[type="password"] {
        padding: 0.8rem 0.9rem;
        font-size: 16px;
    }
    
    .copy-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .copy-btn i {
        font-size: 0.9rem;
    }
    
    .toggle-btn {
        padding: 0.5rem;
    }
    
    .toggle-btn i {
        font-size: 1rem;
    }
    
    .settings-header h3 {
        font-size: 0.95rem;
    }
    
    .toggle-settings-btn {
        width: 32px;
        height: 32px;
    }
    
    .setting-card,
    .result-card {
        padding: 0.9rem;
    }
    
    .card-header,
    .result-header {
        font-size: 0.9rem;
        margin-bottom: 0.9rem;
        padding-bottom: 0.7rem;
    }
    
    .card-icon,
    .result-icon {
        gap: 6px;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .slider-header {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .toggle-label {
        font-size: 0.85rem;
    }
    
    .toggle-description {
        font-size: 0.75rem;
    }
    
    .footer {
        padding: 1.2rem 0;
        margin-top: 1.5rem;
    }
    
    .footer p {
        font-size: 0.8rem;
    }
    
    .notification {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
}

/* 超小屏设备 */
@media (max-width: 360px) {
    .logo h1 {
        font-size: 1rem;
    }
    
    .generator-card {
        padding: 0.6rem;
    }
    
    input[type="text"],
    input[type="password"] {
        padding: 0.7rem 0.8rem;
    }
    
    .copy-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .setting-card,
    .result-card {
        padding: 0.8rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    input[type="range"] {
        height: 8px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .copy-btn,
    .toggle-btn,
    .toggle-settings-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .toggle-switch {
        width: 56px;
        height: 30px;
    }
    
    .toggle-slider:before {
        height: 24px;
        width: 24px;
        left: 3px;
        bottom: 3px;
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(26px);
    }
}

/* 横屏手机优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 0.4rem 0;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    main {
        padding: 0.6rem 0;
    }
    
    .generator-card {
        padding: 0.8rem;
    }
    
    .settings-grid,
    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* 动画关键帧 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 输入框淡入动画 */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --light-gray: #1a1a1a;
        --dark-gray: #f8f9fa;
    }
    
    body {
        background-color: #121212;
    }
    
    .header,
    .generator-card,
    .footer {
        background-color: #1a1a1a;
    }
    
    input[type="text"],
    input[type="password"],
    .setting-card,
    .result-card {
        background-color: #2a2a2a;
        border-color: #333;
        color: #f8f9fa;
    }
    
    input[type="text"]:focus,
    input[type="password"]:focus {
        background-color: #2a2a2a;
    }
    
    .input-description {
        color: #a0a0a0;
    }
}
    