/* CSS Variables - Dark Theme */
:root {
    --background: #202020;
    --foreground: #f2f2f2;
    --card: #292929;
    --card-foreground: #f2f2f2;
    --popover: #292929;
    --popover-foreground: #f2f2f2;
    --primary: #303030;
    --primary-foreground: #f2f2f2;
    --secondary: #383838;
    --secondary-foreground: #f2f2f2;
    --muted: #333333;
    --muted-foreground: #a6a6a6;
    --accent: #ffb347;
    --accent-foreground: #1a1a1a;
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;
    --border: #404040;
    --input: #1a1a1a;
    --ring: #ffb347;
    --radius: 0.5rem;
}

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

body {
    font-family: 'PT Sans', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 1rem;
}

.title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--muted-foreground);
    font-size: 1rem;
}

/* Control Panel */
.control-panel {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.panel-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent);
    margin-right: 0.5rem;
    font-size: 1.5rem;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--card-foreground);
}

.panel-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .panel-content {
        flex-direction: row;
        align-items: center;
    }
}

/* Keyword Input */
.keyword-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background-color: var(--input);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.keyword-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.2);
}

.keyword-input::placeholder {
    color: var(--muted-foreground);
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

@media (min-width: 768px) {
    .toolbar {
        justify-content: flex-start;
    }
}

.tool-btn {
    width: 2.5rem;
    height: 2.5rem;
    background-color: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.tool-btn:hover:not(:disabled) {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

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

.btn-text {
    font-size: 1rem;
    font-weight: 600;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

@media (min-width: 768px) {
    .main-content {
        flex-direction: row;
    }
}

/* Input/Output Panels */
.input-panel,
.output-panel {
    flex: 1;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.header-left {
    display: flex;
    align-items: center;
}

.output-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    outline: none;
}

.copy-btn:hover {
    color: var(--accent);
    opacity: 0.8;
}

/* Text Areas */
.text-area {
    flex: 1;
    padding: 1rem;
    background-color: var(--input);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    height: 200px; /* 初始高度 */
}

.text-area:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.2);
}

.text-area::placeholder {
    color: var(--muted-foreground);
}

/* Markdown Output */
.markdown-output {
    flex: 1;
    padding: 1rem;
    background-color: var(--input);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    overflow-y: auto;
    min-height: 200px;
    max-height: 600px;
    line-height: 1.6;
}

.placeholder-text {
    color: var(--muted-foreground);
    font-style: italic;
    text-align: center;
    margin-top: 80px;
}

/* Markdown content styling */
.markdown-output h1,
.markdown-output h2,
.markdown-output h3,
.markdown-output h4,
.markdown-output h5,
.markdown-output h6 {
    color: var(--accent);
    margin: 1rem 0 0.5rem 0;
    font-weight: bold;
}

.markdown-output h1 { font-size: 2rem; }
.markdown-output h2 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 4px;
}
.markdown-output h3 { font-size: 1.25rem; }

.markdown-output p {
    margin: 0.5rem 0;
}

.markdown-output strong {
    color: var(--accent);
    font-weight: bold;
}

.markdown-output em {
    font-style: italic;
}

.markdown-output u {
    text-decoration: underline;
    color: var(--accent);
}

.markdown-output code {
    background-color: var(--muted);
    color: var(--accent);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.markdown-output pre {
    background-color: var(--muted);
    color: var(--foreground);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border);
}

.markdown-output pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.markdown-output blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--muted-foreground);
    font-style: italic;
}

.markdown-output ul,
.markdown-output ol {
    margin: 0.5rem 0;
    padding-left: 2rem;
}

.markdown-output li {
    margin: 0.25rem 0;
}

/* Animation for output text area */
.animate-pulse-briefly {
    animation: pulse-briefly 0.5s ease-out;
}

@keyframes pulse-briefly {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 179, 71, 0.7);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 179, 71, 0);
    }
}

/* Dialog Styles */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.dialog {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 525px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.dialog-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--card-foreground);
}

.dialog-close {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    outline: none;
}

.dialog-close:hover {
    color: var(--foreground);
}

.dialog-content {
    padding: 1.5rem;
}

.dialog-description {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--card-foreground);
    font-weight: 500;
}

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

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-text {
    font-weight: 600;
    color: var(--card-foreground);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    line-height: 1.4;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--input);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.2);
}

.form-group input::placeholder {
    color: var(--muted-foreground);
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-primary,
.btn-secondary {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background-color: var(--accent);
    opacity: 0.9;
}

.btn-secondary {
    background-color: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: var(--muted);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1001;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-content {
    display: flex;
    align-items: center;
}

/* Responsive Design */
@media (max-width: 767px) {
    .app-container {
        padding: 1rem;
    }

    .title {
        font-size: 2rem;
    }

    .input-panel,
    .output-panel {
        min-height: 250px;
    }

    .text-area,
    .markdown-output {
        min-height: 150px;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    opacity: 0.8;
}

