/* 基础重置和字体设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #1d1d1f;
    line-height: 1.6;
}

/* 主容器布局 */
.main-container {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    width: 100%;
    align-items: flex-start;
}

/* 主功能区域 */
.container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.18);
    text-align: center;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 0;
}

/* 作者信息区域 */
.author-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.18);
    width: 280px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* 标题和LOGO */
.logo {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 16px;
    background: linear-gradient(135deg, #007AFF, #5856D6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #86868b;
    margin-bottom: 40px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 400;
    line-height: 1.4;
}

/* 按钮样式 */
.generate-btn {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
    border: none;
    padding: clamp(12px, 3vw, 16px) clamp(32px, 8vw, 48px);
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.3);
    font-family: inherit;
    letter-spacing: 0.01em;
    width: 100%;
    max-width: 300px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 邮箱显示区域 */
.email-display {
    background: rgba(248, 248, 248, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: clamp(16px, 4vw, 24px);
    margin: 24px 0;
    display: none;
}

.email-display.show {
    display: block;
    animation: slideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.email-label {
    color: #86868b;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.email-address {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: #007AFF;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    word-break: break-all;
    background: rgba(0, 122, 255, 0.05);
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 16px);
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.3;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.copy-btn, .clear-btn, .view-email-btn {
    border: none;
    padding: clamp(8px, 2vw, 10px) clamp(16px, 4vw, 20px);
    border-radius: 8px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    backdrop-filter: blur(10px);
    min-width: 100px;
    flex: 1;
}

.copy-btn {
    background: rgba(52, 199, 89, 0.9);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

.copy-btn:hover {
    background: rgba(52, 199, 89, 1);
    transform: translateY(-1px);
}

.view-email-btn {
    background: rgba(0, 122, 255, 0.9);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.view-email-btn:hover {
    background: rgba(0, 122, 255, 1);
    transform: translateY(-1px);
}

.clear-btn {
    background: rgba(255, 59, 48, 0.9);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

.clear-btn:hover {
    background: rgba(255, 59, 48, 1);
    transform: translateY(-1px);
}

.copy-btn:disabled, .view-email-btn:disabled, .clear-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 邮箱信息状态 */
.email-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(142, 142, 147, 0.1);
    border-radius: 8px;
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    color: #86868b;
    text-align: center;
    border: 1px solid rgba(142, 142, 147, 0.2);
    white-space: pre-line;
}

.email-info.valid {
    background: rgba(52, 199, 89, 0.1);
    border-color: rgba(52, 199, 89, 0.3);
    color: #30d158;
}

.email-info.expired {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

/* 状态消息 */
.status {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    display: none;
    font-weight: 500;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    white-space: pre-line;
}

.status.success {
    background: rgba(52, 199, 89, 0.1);
    color: #30d158;
    border: 1px solid rgba(52, 199, 89, 0.3);
}

.status.error {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* 动画定义 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 功能特性列表 */
.features {
    margin-top: 40px;
    text-align: left;
}

.feature-item {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: #515154;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.feature-icon {
    color: #007AFF;
    margin-right: 16px;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* 邮件内容区域 */
.email-content {
    background: rgba(248, 248, 248, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: clamp(16px, 4vw, 24px);
    margin: 24px 0;
    display: none;
    text-align: left;
}

.email-content.show {
    display: block;
    animation: slideIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.email-header {
    border-bottom: 1px solid rgba(142, 142, 147, 0.2);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.email-header h3 {
    color: #1d1d1f;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.email-field {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.email-field-label {
    font-weight: 600;
    color: #1d1d1f;
    display: inline-block;
    min-width: 80px;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    flex-shrink: 0;
}

.email-field-value {
    color: #515154;
    word-break: break-all;
    flex: 1;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.email-body {
    background: white;
    border: 1px solid rgba(142, 142, 147, 0.2);
    border-radius: 12px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 16px;
}

.email-body iframe {
    width: 100%;
    border: none;
    min-height: 300px;
}

.email-text {
    white-space: pre-wrap;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    line-height: 1.5;
    color: #1d1d1f;
}

.no-email-message {
    text-align: center;
    color: #86868b;
    font-style: italic;
    padding: 32px;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.refresh-btn {
    background: rgba(142, 142, 147, 0.9);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
}

.refresh-btn:hover {
    background: rgba(142, 142, 147, 1);
    transform: translateY(-1px);
}

/* 作者区域样式 */
.author-title {
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 20px;
}

.wechat-qr {
    width: clamp(150px, 25vw, 180px);
    height: clamp(150px, 25vw, 180px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: white;
}

.qr-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.qr-image:hover {
    transform: scale(1.05);
}

.author-info {
    text-align: center;
}

.author-info p {
    color: #515154;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    line-height: 1.5;
    margin-bottom: 8px;
}

.author-info .highlight {
    color: #007AFF;
    font-weight: 600;
}

/* 超大屏幕优化 (1440px+) */
@media (min-width: 1440px) {
    .main-container {
        max-width: 1600px;
    }

    .container {
        padding: 56px;
    }

    .author-section {
        width: 320px;
        padding: 40px;
    }
}

/* 大屏幕优化 (1200px - 1439px) */
@media (max-width: 1439px) and (min-width: 1200px) {
    .main-container {
        max-width: 1200px;
    }

    .author-section {
        width: 260px;
    }
}

/* 中大屏幕 (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .main-container {
        gap: 24px;
    }

    .container {
        padding: 40px;
    }

    .author-section {
        width: 240px;
        padding: 28px;
    }
}

/* 中等屏幕 (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .main-container {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }

    .container {
        max-width: 600px;
        padding: 36px;
    }

    .author-section {
        width: 100%;
        max-width: 400px;
        padding: 32px;
    }

    .button-group {
        justify-content: space-between;
        gap: 8px;
    }

    .copy-btn, .clear-btn, .view-email-btn {
        flex: 1;
        min-width: 0;
    }
}

/* 小屏幕 (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    body {
        padding: 16px;
    }

    .main-container {
        flex-direction: column;
        gap: 16px;
    }

    .container, .author-section {
        padding: 28px 20px;
        border-radius: 20px;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    .copy-btn, .clear-btn, .view-email-btn {
        width: 100%;
        padding: 12px 20px;
        flex: none;
    }

    .email-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .email-field-label {
        min-width: auto;
        width: 100%;
    }

    .email-header h3 {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* 超小屏幕 (< 576px) */
@media (max-width: 575px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .main-container {
        flex-direction: column;
        gap: 12px;
        margin-top: 0;
    }

    .container, .author-section {
        padding: 24px 16px;
        border-radius: 16px;
        width: 100%;
    }

    .generate-btn {
        max-width: none;
        width: 100%;
    }

    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    .copy-btn, .clear-btn, .view-email-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .features {
        margin-top: 32px;
    }

    .feature-item {
        margin: 12px 0;
    }

    .email-body {
        padding: 12px;
        max-height: 300px;
    }

    .wechat-qr {
        width: clamp(120px, 35vw, 150px);
        height: clamp(120px, 35vw, 150px);
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 20px;
    }

    .main-container {
        flex-direction: row;
        gap: 20px;
    }

    .container {
        padding: 20px;
    }

    .author-section {
        width: 220px;
        padding: 20px;
    }

    .wechat-qr {
        width: 120px;
        height: 120px;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .email-address, .email-text {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
        color: black;
    }

    .main-container {
        flex-direction: column;
        box-shadow: none;
    }

    .container, .author-section {
        background: white;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .generate-btn, .copy-btn, .clear-btn, .view-email-btn, .refresh-btn {
        display: none;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .container, .author-section {
        border: 2px solid #000;
    }

    .generate-btn, .copy-btn, .clear-btn, .view-email-btn {
        border: 2px solid #000;
    }
}
