/* ============================================================
   Create Classification Page
   ============================================================ */

.create-page {
    overflow: auto;
    height: auto;
    margin: 0;
    align-items: stretch;
}

.cc-main {
    max-width: 720px;
    margin: 60px auto 40px;
    padding: 24px 20px;
    width: 100%;
    box-sizing: border-box;
}

.cc-header {
    margin-bottom: 24px;
    text-align: center;
}

.cc-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
}

.cc-header p {
    color: var(--muted-text, #6b6b6b);
    margin: 0;
    font-size: 14px;
}

/* ── Step indicator ── */
.cc-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
}

.cc-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted-text);
    transition: all 0.3s;
}

.cc-step.active {
    color: #8b1a1a;
}

.cc-step.current {
    background: rgba(139, 26, 26, 0.08);
}

.cc-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--border, #e6e8f0);
    color: var(--muted-text);
    transition: all 0.3s;
}

.cc-step.active .cc-step-num {
    background: #8b1a1a;
    color: #fff;
}

.cc-step-line {
    width: 40px;
    height: 2px;
    background: var(--border, #e6e8f0);
    transition: background 0.3s;
}

.cc-step-line.active {
    background: #8b1a1a;
}

/* ── Card ── */
.cc-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e6e8f0);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.cc-card.hidden {
    display: none;
}

.cc-card-header {
    padding: 24px 28px 0;
}

.cc-card-header h2 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
}

.cc-card-header p {
    margin: 0;
    font-size: 13px;
    color: var(--muted-text);
}

/* ── Form ── */
.cc-form {
    padding: 20px 28px 24px;
}

.cc-field-group {
    margin-bottom: 16px;
}

.cc-field-group.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.cc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.cc-field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.cc-required {
    color: #dc2626;
}

.cc-field input[type="text"] {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
    color: var(--text);
}

.cc-field input[type="text"]:focus {
    border-color: #a52a2a;
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.1);
}

.cc-hint {
    font-size: 11px;
    color: var(--muted-text);
    margin: 0;
    line-height: 1.4;
}

.cc-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
}

.cc-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #8b1a1a;
}

/* ── Alpha section (hidden by default) ── */
.cc-alpha-section {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    padding: 0 0;
}

.cc-alpha-section.visible {
    max-height: 300px;
    opacity: 1;
    padding: 8px 0 0;
}

.cc-divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* ── Actions ── */
.cc-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px 24px;
}

.cc-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.cc-btn.primary {
    background: linear-gradient(135deg, #8b1a1a, #a52a2a);
    color: #fff;
    box-shadow: 0 2px 8px rgba(139, 26, 26, 0.25);
}

.cc-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(139, 26, 26, 0.35);
    transform: translateY(-1px);
}

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

.cc-btn.secondary {
    background: transparent;
    color: var(--muted-text);
    border: 1px solid var(--border);
}

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

/* ── Hierarchy tree (Step 2) ── */
.cc-hierarchy {
    padding: 16px 28px;
}

.cc-tree-node {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    position: relative;
}

.cc-tree-line {
    width: 2px;
    height: 16px;
    background: var(--border);
    margin-left: 6px;
    margin-bottom: 2px;
    flex-shrink: 0;
}

.cc-tree-node.exists .cc-tree-line { background: #16a34a; }
.cc-tree-node.missing .cc-tree-line { background: #f59e0b; }
.cc-tree-node.target .cc-tree-line { background: #8b1a1a; }

.cc-tree-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    border: 3px solid var(--border);
    background: var(--surface);
}

.cc-tree-node.exists .cc-tree-dot {
    border-color: #16a34a;
    background: #dcfce7;
}

.cc-tree-node.missing .cc-tree-dot {
    border-color: #f59e0b;
    background: #fef9c3;
}

.cc-tree-node.target .cc-tree-dot {
    border-color: #8b1a1a;
    background: #fecaca;
    box-shadow: 0 0 8px rgba(139, 26, 26, 0.3);
}

.cc-tree-info {
    flex: 1;
    min-width: 0;
}

.cc-tree-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cc-tree-code {
    font-size: 13px;
    font-weight: 700;
    color: #8b1a1a;
    font-family: "SF Mono", "Fira Code", monospace;
}

.cc-tree-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--muted-surface);
    color: var(--muted-text);
}

.cc-tree-status {
    font-size: 11px;
    font-weight: 600;
}

.cc-tree-node.exists .cc-tree-status { color: #16a34a; }
.cc-tree-node.missing .cc-tree-status { color: #b45309; }
.cc-tree-node.target .cc-tree-status { color: #8b1a1a; }

.cc-tree-label {
    font-size: 13px;
    color: var(--muted-text);
    margin-top: 2px;
}

/* ── Missing ancestors form ── */
.cc-missing-form {
    padding: 0 28px;
}

.cc-missing-title {
    font-size: 15px;
    font-weight: 700;
    margin: 16px 0 4px;
}

.cc-missing-hint {
    font-size: 12px;
    color: var(--muted-text);
    margin: 0 0 12px;
}

.cc-missing-row {
    display: grid;
    grid-template-columns: 100px 1fr 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.cc-missing-code {
    font-size: 12px;
    font-weight: 700;
    color: #b45309;
    font-family: "SF Mono", "Fira Code", monospace;
}

.cc-missing-label,
.cc-missing-tag {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.cc-missing-label:focus,
.cc-missing-tag:focus {
    border-color: #a52a2a;
}

/* ── Warnings ── */
.cc-warn {
    color: #b45309;
    font-weight: 600;
}

/* ── Result (Step 3) ── */
.cc-result-success,
.cc-result-error {
    text-align: center;
    padding: 40px 28px;
}

.cc-result-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.cc-result-success h2 {
    color: #16a34a;
    margin: 0 0 8px;
}

.cc-result-error h2 {
    color: #dc2626;
    margin: 0 0 8px;
}

.cc-result-details {
    margin-top: 20px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.cc-result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.cc-result-row span:first-child {
    font-weight: 600;
    color: var(--muted-text);
}

.cc-result-row span:last-child {
    font-weight: 600;
    color: var(--text);
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    word-break: break-all;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .cc-main {
        padding: 16px 12px;
        margin-top: 56px;
    }

    .cc-form {
        padding: 16px 18px 20px;
    }

    .cc-field-group.two-col {
        grid-template-columns: 1fr;
    }

    .cc-missing-row {
        grid-template-columns: 1fr;
    }

    .cc-hierarchy {
        padding: 12px 18px;
    }

    .cc-actions {
        padding: 12px 18px 20px;
    }

    .cc-step-label {
        display: none;
    }
}

/* ── Dark mode ── */
.dark-mode .cc-card {
    background: #1a1a1a;
    border-color: #333;
}

.dark-mode .cc-field input[type="text"],
.dark-mode .cc-missing-label,
.dark-mode .cc-missing-tag {
    background: #222;
    border-color: #333;
    color: #eee;
}

.dark-mode .cc-tree-type {
    background: #333;
}

.dark-mode .cc-divider {
    background: #333;
}
