﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root,
[data-theme="dark"] {
    --bg: #1e1e2e;
    --bg-surface: #313244;
    --bg-output: #1e1e2e;
    --text: #cdd6f4;
    --text-muted: #a6adc8;
    --text-faint: #6c7086;
    --accent: #cba6f7;
    --border: #585b70;
    --btn-hover-bg: #45475a;
    --link: #89b4fa;
    --toast-bg: #313244;
}

[data-theme="light"] {
    --bg: #eff1f5;
    --bg-surface: #ffffff;
    --bg-output: #e6e9ef;
    --text: #4c4f69;
    --text-muted: #6c6f85;
    --text-faint: #9ca0b0;
    --accent: #8839ef;
    --border: #ccd0da;
    --btn-hover-bg: #dce0e8;
    --link: #1e66f5;
    --toast-bg: #ffffff;
}

body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    background-color: var(--bg);
    color: var(--text);
}

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

.nav-brand {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
}

.nav-brand a {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    color: var(--text);
    background-color: var(--btn-hover-bg);
}

[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: inline; }

.translator {
    display: flex;
    max-width: 960px;
    margin: 30px auto 0;
    padding: 0 20px;
    gap: 10px;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
}

.panel-output {
    border-left: none;
}

.panel-header {
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 57px;
}

.panel-body {
    position: relative;
    flex: 1;
    display: flex;
}

textarea {
    flex: 1;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 24px;
    line-height: 1.5;
    background-color: var(--bg-surface);
    color: var(--text);
    border: none;
    resize: none;
    outline: none;
    min-height: 200px;
}

textarea::placeholder {
    color: var(--text-faint);
}

.action-bar {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    color: var(--text);
    background-color: var(--btn-hover-bg);
}

.clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 50%;
}

.clear-btn:hover {
    color: var(--text);
    background-color: var(--btn-hover-bg);
}

.history-section {
    max-width: 960px;
    margin: 30px auto 0;
    padding: 0 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 0;
    user-select: none;
}

.history-header h2 {
    color: var(--accent);
    font-size: 1.1rem;
    margin: 0;
}

.history-arrow {
    color: var(--text-faint);
    font-size: 0.8rem;
}

.history-body {
    display: block;
}

.history-empty {
    color: var(--text-faint);
    font-size: 0.85rem;
    padding: 10px 0;
}

#historyList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-item:hover {
    background-color: var(--btn-hover-bg);
}

.history-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-dir {
    font-size: 0.7rem;
    color: var(--text-faint);
    white-space: nowrap;
}

.history-delete {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    line-height: 1;
}

.history-delete:hover {
    color: var(--text);
    background-color: var(--btn-hover-bg);
}

.history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.history-note {
    font-size: 0.75rem;
    color: var(--text-faint);
}

.history-clear {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
}

.history-clear:hover {
    color: var(--text);
}

.info-section {
    max-width: 960px;
    margin: 40px auto 0;
    padding: 0 20px 60px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    text-align: justify;
}

.info-section h2 {
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 10px;
    margin-top: 30px;
}

.info-section h2:first-child {
    margin-top: 0;
}

.info-section p {
    margin-bottom: 10px;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 10px;
}

.info-section li {
    padding: 4px 0;
}

.info-section em {
    color: var(--accent);
    font-style: normal;
}

.info-section a {
    color: var(--text-muted);
    text-decoration: underline;
}

.info-section a:hover {
    color: var(--text);
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    font-size: 0.8rem;
    color: var(--text-faint);
    background-color: var(--bg);
}

footer a {
    color: var(--link);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--toast-bg);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    border: 1px solid var(--border);
}

.toast.show {
    opacity: 1;
}

@media (max-width: 600px) {
    .translator {
        flex-direction: column;
        padding: 0 12px;
    }

    .panel {
        border-radius: 8px;
    }

    .panel-output {
        border-radius: 8px;
        border-top: none;
        margin-top: 15px;
    }
}
