/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1DA1F2;
    --secondary-color: #14171A;
    --success-color: #17BF63;
    --danger-color: #E0245E;
    --warning-color: #FFAD1F;
    --background: #F7F9FA;
    --surface: #FFFFFF;
    --border: #E1E8ED;
    --text-primary: #14171A;
    --text-secondary: #5B7083;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 8px 16px;
    background: var(--background);
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s infinite;
}

.status-badge.online .status-dot {
    background: var(--success-color);
}

.status-badge.offline .status-dot {
    background: var(--danger-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 主内容区 */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

/* 编辑器区域 */
.editor-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.editor-header h2 {
    font-size: 1.5rem;
}

.editor-body {
    margin-bottom: 20px;
}

.tweet-textarea {
    width: 100%;
    min-height: 150px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.tweet-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.char-counter {
    font-size: 1.1rem;
    font-weight: 600;
}

#char-count {
    color: var(--text-primary);
}

.char-counter.warning #char-count {
    color: var(--warning-color);
}

.char-counter.danger #char-count {
    color: var(--danger-color);
}

.char-limit {
    color: var(--text-secondary);
}

.editor-tools {
    display: flex;
    gap: 8px;
}

.tool-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.tool-btn:hover {
    background: var(--background);
    transform: scale(1.05);
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1A8CD8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 161, 242, 0.3);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #E8F5FE;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 发布选项 */
.publish-options {
    margin: 16px 0;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 发布按钮区域 */
.publish-actions {
    margin-top: 20px;
}

/* AI面板 */
.ai-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--surface);
    box-shadow: -4px 0 16px rgba(0,0,0,0.1);
    transition: right 0.3s;
    z-index: 1000;
    overflow-y: auto;
}

.ai-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 1.3rem;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--background);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.close-btn:hover {
    background: var(--border);
    transform: rotate(90deg);
}

.panel-body {
    padding: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-prompt-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.ai-prompt-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.style-select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.ai-result {
    margin-top: 20px;
    padding: 16px;
    background: var(--background);
    border-radius: 8px;
    min-height: 100px;
}

/* 推文历史 */
.history-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h2 {
    font-size: 1.5rem;
}

.tweet-history {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tweet-card {
    padding: 16px;
    background: var(--background);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.tweet-card .tweet-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tweet-card .tweet-content {
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.tweet-card .tweet-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.tweet-card .tweet-link:hover {
    text-decoration: underline;
}

/* Toast通知 */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--secondary-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

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

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* Emoji选择器 */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 24px;
    padding: 12px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 100;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.emoji-item:hover {
    background: var(--background);
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .ai-panel {
        width: 100%;
        right: -100%;
    }

    .emoji-picker {
        right: 12px;
    }

    .toast {
        right: 12px;
        left: 12px;
    }
}
