/* 码上见 (lineH) — 品牌视觉样式表 */

/* ===== CSS Variables ===== */
:root {
    --color-primary: #2563EB;
    --color-primary-hover: #1d4ed8;
    --color-success: #10B981;
    --color-success-hover: #059669;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-bg: #F8FAFC;
    --color-card: #FFFFFF;
    --color-text: #1E293B;
    --color-text-secondary: #64748B;
    --color-text-muted: #94A3B8;
    --color-border: #E2E8F0;
    --color-border-hover: #CBD5E1;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
    --font-mono: 'Monaco', 'Consolas', 'Courier New', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
    --max-width: 800px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Brand Header ===== */
.brand {
    text-align: center;
    padding: 64px 0 40px;
}

.brand-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.brand-title .accent {
    background: linear-gradient(135deg, var(--color-primary), var(--color-success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 18px;
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* ===== Card ===== */
.card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 32px;
}

/* ===== Editor Area ===== */
.editor-card {
    margin-bottom: 32px;
}

.editor-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.editor-textarea {
    width: 100%;
    min-height: 320px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    color: #E2E8F0;
    background: #1E293B;
    border: 2px solid #334155;
    border-radius: var(--radius-sm);
    resize: vertical;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    tab-size: 4;
    caret-color: #60A5FA;
}

.editor-textarea::placeholder {
    color: #64748B;
}

.editor-textarea:focus {
    border-color: var(--color-primary);
    background: #1E293B;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.char-count {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 12px;
    color: #64748B;
    font-family: var(--font-mono);
    pointer-events: none;
    background: rgba(30, 41, 59, 0.85);
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 1;
}

.char-count.warning { color: var(--color-warning); background: rgba(245, 158, 11, 0.12); }
.char-count.error { color: var(--color-error); background: rgba(239, 68, 68, 0.12); }

/* ===== Options Row ===== */
.options-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Title toggle */
.title-toggle {
    font-size: 14px;
    color: var(--color-primary);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.title-toggle:hover { opacity: 0.8; }

.title-toggle .arrow {
    display: inline-block;
    transition: transform var(--transition);
    font-size: 12px;
}

.title-toggle .arrow.open {
    transform: rotate(90deg);
}

.title-input-wrapper {
    display: none;
    width: 100%;
    margin-bottom: 16px;
}

.title-input-wrapper.visible {
    display: block;
}

.title-input {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xs);
    outline: none;
    transition: border-color var(--transition);
    color: var(--color-text);
    background: var(--color-card);
}

.title-input:focus {
    border-color: var(--color-primary);
    background: #FAFBFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

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

/* Access mode switch */
.access-switch {
    display: flex;
    align-items: center;
    gap: 8px;
}

.access-switch label {
    font-size: 14px;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--color-border);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition);
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.switch input:checked + .switch-slider {
    background: var(--color-primary);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

/* Access code digit inputs */
.access-code-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    height: 48px;
    overflow: hidden;
}

.access-code-inputs.visible {
    opacity: 1;
    visibility: visible;
}

.code-digit {
    width: 48px;
    height: 48px;
    text-align: center;
    font-size: 20px;
    font-family: var(--font-mono);
    font-weight: 600;
    color: #E2E8F0;
    background: #1E293B;
    border: 2px solid #334155;
    border-radius: var(--radius-xs);
    outline: none;
    transition: border-color var(--transition);
    caret-color: #60A5FA;
}

.code-digit:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ===== Publish Button ===== */
.action-buttons {
    display: flex;
    gap: 12px;
}

.preview-btn {
    flex: 1;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--color-primary);
    background: transparent;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
}

.preview-btn:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.06);
    transform: translateY(-1px);
}

.preview-btn:active:not(:disabled) {
    background: rgba(37, 99, 235, 0.12);
    transform: translateY(0);
}

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

.publish-btn {
    flex: 1.5;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: white;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
}

.publish-btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.publish-btn:active:not(:disabled) {
    background: #1849c7;
    transform: translateY(0);
}

.publish-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Success Area ===== */
.success-area {
    display: none;
    animation: fadeIn 0.4s ease;
}

.success-area.visible { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.success-icon {
    width: 40px;
    height: 40px;
    background: #ECFDF5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.success-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.success-subtitle {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Link copy row */
.link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    background: #F1F5F9;
    border-radius: var(--radius-sm);
    padding: 4px 4px 4px 16px;
}

.link-url {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
}

.copy-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: white;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

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

.copy-btn.copied {
    background: var(--color-success);
}

/* Access code display row */
.access-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #F8FAFC;
    border-radius: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 0;
}

.access-code-row.visible {
    max-height: 80px;
    opacity: 1;
    margin-bottom: 16px;
}

.access-code-label {
    font-size: 14px;
    color: #64748B;
    font-weight: 500;
}

.access-code-value {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

/* QR code */
.qr-section {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: #F8FAFC;
    border-radius: var(--radius-sm);
}

.qr-code {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    background: white;
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.qr-code img {
    width: 100%;
    height: 100%;
}

.qr-info {
    flex: 1;
}

.qr-info p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.qr-info .share-hint {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-primary);
}

/* Expires hint */
.expires-hint {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0 0 24px;
}

/* Continue button */
.continue-btn {
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--color-primary);
    background: transparent;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

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

/* ===== Toast System ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
}

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

.toast.fadeout {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ===== Footer ===== */
.footer {
    margin-top: auto;
    padding: 32px 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.footer-text {
    font-size: 13px;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .brand {
        padding: 40px 0 28px;
    }

    .brand-title {
        font-size: 32px;
    }

    .brand-subtitle {
        font-size: 16px;
    }

    .card {
        padding: 20px;
        border-radius: 8px;
    }

    .editor-textarea {
        min-height: 240px;
        font-size: 13px;
        padding: 16px;
    }

    .options-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .access-switch {
        margin-left: 0;
    }

    .link-row {
        flex-direction: column;
        padding: 12px;
        gap: 8px;
    }

    .link-url {
        width: 100%;
        font-size: 13px;
    }

    .copy-btn {
        width: 100%;
        text-align: center;
    }

    .qr-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .publish-btn {
        font-size: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .container {
        padding: 0 16px;
    }

    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 28px;
    }

    .brand-subtitle {
        font-size: 14px;
    }

    .editor-textarea {
        min-height: 200px;
        padding: 14px;
        font-size: 12px;
    }
}
