/* === Reset === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e2e2e2;
    --border-focus: #3b82f6;
    --text: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: #eff6ff;
    --error: #ef4444;
    --error-light: #fef2f2;
    --success: #10b981;
    --success-light: #ecfdf5;
    --radius: 6px;
    --radius-lg: 10px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Menlo', 'Consolas', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

html { font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === Layout === */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main { flex: 1; padding: 24px 0 40px; }

/* === Header === */
.header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.logo:hover { color: var(--accent); }

.logo-icon { flex-shrink: 0; }

/* === Footer === */
.footer {
    padding: 16px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* === Editor === */
.editor {
    width: 100%;
    min-height: 380px;
    padding: 16px 18px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    outline: none;
    font-family: var(--font-mono);
    font-size: 0.87rem;
    line-height: 1.65;
    resize: vertical;
    tab-size: 4;
    -moz-tab-size: 4;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.editor:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.editor::placeholder { color: var(--text-tertiary); }

/* === Options === */
.options-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.options-left, .options-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* === Inputs === */
.input {
    font-family: var(--font);
    font-size: 0.85rem;
    padding: 7px 11px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.input::placeholder { color: var(--text-tertiary); }

.input-title { width: 140px; }
.input-pw { width: 120px; }

.select-wrap { position: relative; }

.select-wrap select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 28px;
    cursor: pointer;
    background: var(--surface);
}

.select-wrap::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-tertiary);
    pointer-events: none;
}

/* === Custom URL row === */
.custom-url-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.toggle-label input { display: none; }

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 20px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(16px);
}

.custom-slug-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    min-width: 0;
}

.custom-slug-prefix {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    padding: 7px 0 7px 11px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    white-space: nowrap;
    line-height: 1.4;
}

.input-slug {
    border-radius: 0 var(--radius) var(--radius) 0;
    flex: 1;
    min-width: 80px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* === Checkbox === */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] { display: none; }

.check-box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.checkbox-label input:checked + .check-box {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label input:checked + .check-box::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

/* === Buttons === */
.btn-create {
    font-family: var(--font);
    font-size: 0.87rem;
    font-weight: 500;
    padding: 9px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.btn-create:hover { background: var(--accent-hover); }
.btn-create:active { transform: scale(0.98); }
.btn-create:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 12px;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.15s;
}

.btn-sm:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--text-tertiary);
}

.btn-copy {
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 14px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-copy:hover { background: #059669; }

/* === Actions bar === */
.actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.hint {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* === Result bar === */
.result-bar {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--success-light);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.result-url-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.result-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-all;
}

.result-link:hover { text-decoration: underline; }

/* === View page === */
.paste-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.paste-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.paste-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-tertiary);
    display: inline-block;
}

.badge-burn {
    background: var(--error-light);
    color: var(--error);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
}

.paste-head-right {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* === Code block === */
.code-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.code-bar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.code-lang {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.code-wrap pre {
    margin: 0;
    overflow-x: auto;
}

.code-wrap pre code {
    display: block;
    padding: 16px 18px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.65;
    background: var(--surface) !important;
    color: var(--text);
}

.code-wrap pre code.hljs {
    background: var(--surface) !important;
    padding: 16px 18px;
}

/* === State pages (loading, error, password) === */
.state-msg {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.state-card {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.state-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.state-icon-error {
    background: var(--error-light);
    color: var(--error);
}

.state-icon-lock {
    background: var(--accent-light);
    color: var(--accent);
}

.state-card h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.state-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.pw-row {
    display: inline-flex;
    gap: 8px;
    justify-content: center;
}

.pw-row .input { width: 220px; }

.pw-error {
    color: var(--error);
    font-size: 0.82rem;
    margin-top: 10px;
}

/* === Utility === */
.hidden { display: none !important; }

/* === Responsive === */
@media (max-width: 640px) {
    .container { padding: 0 16px; }

    .editor {
        min-height: 250px;
        font-size: 0.82rem;
    }

    .options-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .options-left, .options-right {
        flex-wrap: wrap;
    }

    .input-title, .input-pw { width: 100%; }

    .btn-create { width: 100%; text-align: center; }
    .hint { display: none; }

    .custom-url-row { flex-direction: column; align-items: stretch; }
    .custom-slug-wrap { width: 100%; }

    .result-bar { flex-direction: column; align-items: stretch; }
    .result-url-wrap { flex-direction: column; }

    .paste-head {
        flex-direction: column;
        gap: 10px;
    }

    .paste-head-right { align-self: flex-start; }

    .pw-row { flex-direction: column; width: 100%; }
    .pw-row .input { width: 100%; }

    .code-wrap pre code { font-size: 0.78rem; padding: 12px 14px; }
}
