/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #fff;
    color: #202124;
    line-height: 1.6;
}

/* 首页样式 */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.search-wrapper {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}

.logo-text {
    font-size: 72px;
    font-weight: 400;
    color: #4285f4;
    letter-spacing: -2px;
}

.search-form {
    width: 100%;
}

.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 584px;
    margin: 0 auto;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 5px 15px;
    transition: box-shadow 0.2s;
}

.search-box:hover,
.search-box:focus-within {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: rgba(223, 225, 229, 0);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 10px;
    background: transparent;
}

.search-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-button:hover {
    color: #202124;
}

/* 搜索结果页面样式 */
.search-page {
    min-height: 100vh;
    background: #fff;
}

.search-header {
    border-bottom: 1px solid #ebebeb;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo-small {
    font-size: 24px;
    font-weight: 400;
    color: #4285f4;
    text-decoration: none;
    white-space: nowrap;
}

.search-form-small {
    flex: 1;
    max-width: 600px;
}

.search-box-small {
    display: flex;
    align-items: center;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 5px 15px;
    transition: box-shadow 0.2s;
}

.search-box-small:hover,
.search-box-small:focus-within {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.search-input-small {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px 10px;
}

.search-button-small {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #5f6368;
    display: flex;
    align-items: center;
}

.search-results {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.results-info {
    color: #70757a;
    font-size: 14px;
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.result-item {
    cursor: pointer;
    transition: background 0.2s;
    padding: 10px;
    border-radius: 8px;
}

.result-item:hover {
    background: #f8f9fa;
}

.result-url {
    font-size: 14px;
    color: #202124;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-url-text {
    color: #5f6368;
}

.result-title {
    font-size: 20px;
    color: #1a0dab;
    margin-bottom: 4px;
    font-weight: 400;
    line-height: 1.3;
}

.result-title:hover {
    text-decoration: underline;
}

.result-description {
    font-size: 14px;
    color: #4d5156;
    line-height: 1.6;
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #d93025;
}

/* 页面生成页面样式 */
.page-container {
    min-height: 100vh;
    background: #fff;
}

.loading-state {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.loading-header {
    margin-bottom: 40px;
}

.loading-title {
    height: 40px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

.loading-url {
    height: 20px;
    width: 60%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-content {
    text-align: center;
    padding: 60px 20px;
}

.markdown-preview {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.preview-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.preview-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
    color: #202124;
}

.preview-url {
    font-size: 14px;
    color: #5f6368;
    margin-bottom: 10px;
}

.generation-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #5f6368;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4285f4;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.preview-content {
    font-size: 16px;
    line-height: 1.8;
    color: #202124;
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
    margin: 1.5em 0 0.5em;
    font-weight: 600;
}

.preview-content h1 { font-size: 2em; }
.preview-content h2 { font-size: 1.5em; }
.preview-content h3 { font-size: 1.25em; }

.preview-content p {
    margin: 1em 0;
}

.preview-content ul,
.preview-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.preview-content li {
    margin: 0.5em 0;
}

.preview-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Courier New", monospace;
    font-size: 0.9em;
}

.preview-content pre {
    background: #f5f5f5;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1em 0;
}

.preview-content pre code {
    background: none;
    padding: 0;
}

.completed-message {
    text-align: center;
    padding: 100px 20px;
}

.completed-message svg {
    margin: 0 auto 20px;
}

.completed-message h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #202124;
}

.completed-message p {
    color: #5f6368;
}

.error-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.error-content {
    text-align: center;
    padding: 40px;
}

.error-content svg {
    margin: 0 auto 20px;
}

.error-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #202124;
}

.error-content p {
    color: #5f6368;
    margin-bottom: 20px;
}

.retry-button {
    background: #4285f4;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-button:hover {
    background: #357ae8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .logo-text {
        font-size: 48px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .search-form-small {
        width: 100%;
        max-width: none;
    }

    .result-title {
        font-size: 18px;
    }

    .preview-header h1 {
        font-size: 24px;
    }
}
