/**
 * SoftIP · Module 2 Content Studio (v1.70.0)
 * 客运服务文案创作中心 — Apple Notes / iCloud drawer + white-glass canvas.
 * All surfaces consume Phase 1 tokens (tokens.css).
 */

.view-writing-cupertino.active {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    background: var(--bg) !important;
}

.writing-module-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.writing-module-bar .module-bar-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.module-bar-title-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.module-bar-title-main {
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.2;
}

.module-bar-title-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wc-capsule-btn {
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    font-family: inherit;
    transition:
        transform var(--transition),
        opacity var(--transition),
        background var(--transition),
        border-color var(--transition),
        color var(--transition);
    flex-shrink: 0;
}

.wc-capsule-blue {
    background: var(--primary);
    color: #fff;
}

.wc-capsule-blue:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.wc-capsule-blue:active {
    transform: scale(0.98);
}

/* Secondary CTA — do not dominate first-run attention */
.wc-capsule-ghost {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.wc-capsule-ghost:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.wc-capsule-ghost:active {
    transform: scale(0.98);
}

.wc-capsule-ghost.is-ready {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.wc-capsule-ghost.is-ready:hover {
    background: var(--primary-hover);
}

/* ——— Workspace: iCloud drawer | white-glass canvas ——— */
.wc-workspace {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
    gap: 0;
    background: var(--bg);
}

/* Left drawer — frosted iCloud list */
.wc-drawer {
    width: 272px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: var(--hairline);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.4);
    min-height: 0;
}

.wc-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 10px;
}

.wc-drawer-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
}

.wc-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-pill);
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.wc-icon-btn:hover {
    background: var(--primary-light);
    transform: scale(1.04);
}

.wc-icon-btn:active {
    transform: scale(0.96);
}

.wc-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 12px 8px;
    padding: 7px 11px;
    border-radius: var(--radius-xs);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    border: var(--hairline);
}

.wc-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    letter-spacing: -0.01em;
    color: var(--text);
    font-family: inherit;
}

.wc-search input::placeholder {
    color: var(--text-secondary);
}

.wc-filter-capsules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 12px 12px;
}

.wc-filter {
    border: none;
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.wc-filter.active,
.wc-filter:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.wc-docs-list {
    flex: 1;
    overflow-y: auto;
    padding: 2px 10px 18px;
    min-height: 0;
}

.wc-doc-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 4px;
    border: var(--hairline);
    border-color: transparent;
    background: transparent;
    transition:
        box-shadow var(--transition),
        transform var(--transition),
        background var(--transition),
        border-color var(--transition);
}

.wc-doc-card:hover {
    background: var(--glass-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: var(--border);
}

.wc-doc-card.active {
    background: var(--primary-light);
    border-color: rgba(0, 122, 255, 0.16);
    box-shadow: none;
}

.wc-doc-card-body {
    flex: 1;
    min-width: 0;
}

.wc-doc-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wc-doc-meta {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-secondary);
}

.wc-doc-tag {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

.wc-doc-del {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity var(--transition), color var(--transition), background var(--transition);
}

.wc-doc-card:hover .wc-doc-del {
    opacity: 1;
}

.wc-doc-del:hover {
    color: var(--danger);
    background: rgba(255, 59, 48, 0.08);
}

.wc-drawer-hint {
    margin: 0 16px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.wc-docs-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
}

.wc-docs-empty p {
    margin: 0 0 6px;
}

.wc-docs-empty p:last-child {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* Right canvas */
.wc-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 18px 22px 22px;
    gap: 12px;
    background: var(--bg);
}

.wc-start-guide {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--surface) 55%, var(--accent-light) 100%);
    border: var(--hairline);
    box-shadow: var(--shadow);
    flex-shrink: 0;
    transition:
        opacity var(--transition),
        transform var(--transition);
}

.wc-start-guide[hidden] {
    display: none !important;
}

.wc-start-guide-copy {
    min-width: 0;
    flex: 1;
}

.wc-start-guide-copy h2 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.wc-start-guide-copy p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}

.wc-start-guide-copy strong {
    color: var(--primary);
    font-weight: 700;
}

.wc-start-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    min-width: 210px;
}

.wc-start-steps li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.wc-step-n {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.wc-step-t {
    letter-spacing: -0.01em;
}

.wc-template-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.wc-template-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.wc-template-label-kicker {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.wc-templates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.wc-tpl-loading {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 2px;
}

.wc-tpl-error {
    color: var(--danger, #d92c20);
}

/* First-run: gently pulse primary template chips */
.view-writing-cupertino.is-empty .wc-tpl-chip {
    box-shadow: var(--shadow-md);
    animation: wc-tpl-pulse 2.4s ease-in-out infinite;
}

.view-writing-cupertino.is-empty .wc-tpl-chip:nth-child(2) {
    animation-delay: 0.15s;
}

.view-writing-cupertino.is-empty .wc-tpl-chip:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes wc-tpl-pulse {
    0%,
    100% {
        transform: translateY(0);
        box-shadow: var(--shadow);
    }
    50% {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }
}

@media (prefers-reduced-motion: reduce) {
    .view-writing-cupertino.is-empty .wc-tpl-chip {
        animation: none;
    }
}

.wc-tpl-chip {
    border: none;
    border-radius: var(--radius-pill);
    padding: 7px 13px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow);
    border: var(--hairline);
    font-family: inherit;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        background var(--transition),
        color var(--transition),
        border-color var(--transition);
}

.wc-tpl-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.wc-tpl-chip:active {
    transform: scale(0.98);
}

/* White-glass editor canvas */
.wc-editor-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: var(--radius);
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--hairline);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    position: relative;
}

/* Floating capsule toolbar — micro type / tight layout */
.wc-float-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 16px 0;
    padding: 6px 8px 6px 14px;
    min-height: 40px;
    border-radius: var(--radius-pill);
    background: var(--glass-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--hairline);
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.wc-title-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.3;
    color: var(--text);
    font-family: inherit;
    min-width: 0;
    padding: 4px 0;
}

.wc-title-input::placeholder {
    color: var(--text-secondary);
    font-weight: 500;
}

.wc-doc-badge {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0 2px;
    flex-shrink: 0;
}

.wc-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.wc-tool-btn {
    border: none;
    border-radius: var(--radius-pill);
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition), transform var(--transition);
}

.wc-tool-btn:hover {
    background: rgba(0, 122, 255, 0.14);
    transform: translateY(-0.5px);
}

.wc-tool-btn:active {
    transform: scale(0.97);
}

.wc-editor {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 18px 24px 52px;
    font-size: 15px;
    line-height: 1.85;
    letter-spacing: -0.01em;
    color: var(--text);
    background: transparent;
    font-family: inherit;
    min-height: 0;
}

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

/* Bottom-right char count / save tip */
.wc-editor-status {
    position: absolute;
    right: 20px;
    bottom: 14px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--text-secondary); /* #86868B */
    display: flex;
    align-items: center;
    gap: 0;
    pointer-events: none;
    user-select: none;
}

.wc-editor-status > span {
    color: var(--text-secondary);
}

.wc-editor-status #wcCharStatus,
.wc-editor-status #saveStatus {
    padding: 0 2px;
}

.wc-status-sep {
    display: inline-block;
    margin: 0 8px;
    opacity: 0.35;
    font-weight: 400;
    color: var(--text-tertiary);
}

/* Param sheet */
.wc-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 4200;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 24px;
    animation: wcFade 0.22s ease;
}

.wc-sheet-overlay[hidden] {
    display: none !important;
}

.wc-sheet {
    width: min(440px, 100%);
    border-radius: 20px;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--hairline);
    box-shadow: var(--shadow-lg);
    padding: 12px 20px 20px;
    animation: wcSheetIn 0.32s cubic-bezier(0.2, 0.8, 0.3, 1.05);
}

.wc-sheet-handle {
    width: 36px;
    height: 5px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.1);
    margin: 4px auto 14px;
}

.wc-sheet h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-align: center;
}

.wc-sheet-sub {
    margin: 6px 0 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.wc-sheet-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(46vh, 360px);
    overflow-y: auto;
}

.wc-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.wc-field input {
    width: 100%;
    box-sizing: border-box;
    border: var(--hairline);
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 14px;
    background: var(--surface-2);
    color: var(--text);
    outline: none;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.wc-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.14);
}

.wc-sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.wc-sheet-cancel,
.wc-sheet-generate {
    flex: 1;
    border: none;
    border-radius: var(--radius-pill);
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.wc-sheet-cancel {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.wc-sheet-generate {
    background: var(--primary);
    color: #fff;
}

.wc-sheet-generate:disabled {
    opacity: 0.55;
    cursor: wait;
}

@keyframes wcFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wcSheetIn {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1180px) {
    .wc-workspace { flex-direction: column; }
    .wc-drawer {
        width: 100%;
        max-height: 28%;
        border-right: none;
        border-bottom: var(--hairline);
        box-shadow: none;
    }
    .wc-main {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 12px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    }
    .wc-start-guide {
        flex: 0 0 auto;
        flex-direction: column;
        gap: 8px;
        padding: 12px 14px;
    }
    .wc-start-steps {
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px 12px;
    }
    .wc-template-block {
        flex: 0 0 auto;
    }
    .wc-templates {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .wc-editor-card {
        flex: 1 1 auto;
        min-height: 160px;
        display: flex;
        flex-direction: column;
        /* 去掉滤镜，避免 sticky 被玻璃层困在卡片里 */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .wc-editor {
        flex: 1 1 auto;
        min-height: 120px;
        order: 1;
    }
    .wc-editor-status {
        order: 2;
    }
    .wc-float-toolbar {
        position: sticky;
        bottom: 0;
        left: auto;
        right: auto;
        z-index: 5;
        order: 3;
        margin: 0;
        flex-wrap: wrap;
        border-radius: 0 0 var(--radius) var(--radius);
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        background: var(--glass-strong);
    }
    .wc-toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }
    .wc-tool-btn {
        display: inline-flex;
        align-items: center;
        flex: 1;
        min-height: 44px;
        justify-content: center;
    }
    .writing-module-bar { flex-wrap: wrap; }
    .module-bar-title-sub { white-space: normal; }
}
