/* Name Translator Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* Main Layout */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

.container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Page Header */
h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.page-subtitle {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 25px;
}

/* AI Mode Switcher */
.ai-mode-switcher {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.ai-mode-btn {
    padding: 10px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: normal;
    text-align: center;
    flex: 0 1 auto;
    max-width: 100%;
    line-height: 1.4;
}

.ai-mode-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.ai-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Gender Selector */
.gender-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
}

.gender-btn {
    padding: 10px 30px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gender-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.gender-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* AI Content */
.ai-content {
    display: none;
}

.ai-content.active {
    display: block;
}

/* Input Section */
.input-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.input-field {
    resize: vertical;
    min-height: 100px;
}

/* Preferences Grid */
.preferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.pref-tag {
    padding: 8px 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pref-tag:hover {
    border-color: #667eea;
    color: #667eea;
}

.pref-tag.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Attributes Grid */
.attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.attributes-grid.hidden {
    display: none;
}

.attr-tag {
    padding: 8px 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.attr-tag:hover {
    border-color: #667eea;
    color: #667eea;
}

.attr-tag.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Expand Attributes Button */
.expand-attributes-btn {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expand-attributes-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.expand-attributes-btn.expanded {
    background: #f8f9fa;
}

/* Generate Button */
.ai-generate-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.ai-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-generate-btn:active {
    transform: translateY(0);
}

/* Hint Section Wrapper */
.hint-section-wrapper {
    max-width: 1400px;
    margin: 20px auto 40px;
    padding: 0 20px;
    display: flex;
    justify-content: flex-start;
}

.hint-section-wrapper .hint-section {
    max-width: calc(100% - 380px); /* 减去侧边栏宽度 + gap */
}

/* Hint Section */
.hint-section {
    padding: 40px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border-radius: 12px;
    border: 1px solid #ffd4d4;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.08);
}

.hint-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 30px;
    text-align: center;
}

.hint-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.hint-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.hint-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.hint-text-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.hint-text-content p {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

/* AI Results */
.ai-results {
    margin-top: 25px;
}

.name-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.name-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.name-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.name-chars-box {
    flex: 1;
}

.box-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.name-chars-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.name-chars {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.name-pinyin-display {
    font-size: 0.9rem;
    color: #64748b;
}

.speaker-icon {
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.speaker-icon:hover {
    transform: scale(1.2);
}

.similarity-box {
    text-align: right;
}

.similarity-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.name-meaning-box,
.name-evaluation-box {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.name-meaning,
.name-evaluation {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.6;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
    background: white;
    border-radius: 10px;
}

.loading-icon {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-dots::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Sidebar */
.sidebar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 20px;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.sidebar-articles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.no-articles {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

.sidebar-item {
    display: block;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-item:hover {
    background: #f0f4ff;
    transform: translateX(5px);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
}

.sidebar-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    /* Hint Section 移动端铺满 */
    .hint-section-wrapper {
        justify-content: center;
    }

    .hint-section-wrapper .hint-section {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .ai-mode-switcher {
        flex-direction: column;
    }

    .ai-mode-btn {
        width: 100%;
    }

    .gender-selector {
        flex-direction: column;
    }

    .gender-btn {
        width: 100%;
    }

    .preferences-grid,
    .attributes-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .name-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .similarity-box {
        text-align: left;
    }

    /* Hint Section Mobile */
    .hint-section {
        padding: 25px 20px;
    }

    .hint-title {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }

    .hint-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .hint-item {
        flex-direction: column;
        gap: 15px;
    }

    .hint-icon {
        width: 48px;
        height: 48px;
        font-size: 1.8rem;
    }

    .hint-text-content h4 {
        font-size: 1rem;
    }

    .hint-text-content p {
        font-size: 0.9rem;
    }
}
