/* ==========================================================================
   chapter-dialog.css — "New chapter" window (NavigationManager._chapterDialog)
   Lives inside #onenote-nav, so it uses the library drawer's --lib-* colours
   (dark by default, light under data-theme="light"). Loaded after theme-override.css.
   ========================================================================== */

html body #onenote-nav .chm-overlay,
html body > .chm-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(8, 12, 22, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.18s ease;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
}
html body > .chm-overlay { z-index: 100000; }
html body .chm-overlay.is-open,
html body #onenote-nav .chm-overlay.is-open { opacity: 1; }

html body .chm-overlay .chm-card {
    position: relative;
    width: min(440px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 22px 22px 18px;
    border-radius: 20px;
    background: var(--lib-surface, #151c2b);
    color: var(--lib-text, #e9eef6);
    border: 1px solid var(--lib-border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    transform: translateY(14px) scale(0.97);
    transition: transform 0.24s var(--lib-ease, ease);
}
html body .chm-overlay.is-open .chm-card { transform: none; }

html body .chm-overlay .chm-x {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--lib-muted, #8c98ad);
    cursor: pointer;
    font-size: 1rem;
}
html body .chm-overlay .chm-x:hover { background: var(--lib-hover, rgba(255, 255, 255, 0.05)); color: var(--lib-text, #e9eef6); }

/* Header */
html body .chm-overlay .chm-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-inline-end: 30px; }
html body .chm-overlay .chm-badge {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, #6d6afe, #a855f7);
    box-shadow: 0 8px 20px rgba(109, 106, 254, 0.35);
}
html body .chm-overlay .chm-head h3 {
    margin: 0 0 3px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--lib-text, #e9eef6) !important;
    -webkit-text-fill-color: currentColor !important;
    background: none !important;
}
html body .chm-overlay .chm-head p { margin: 0; font-size: 0.84rem; line-height: 1.4; color: var(--lib-muted, #8c98ad); }

/* Custom chapter — the main choice */
html body .chm-overlay .chm-custom {
    padding: 16px;
    border-radius: 16px;
    border: 2px solid var(--lib-accent, #6d6afe);
    background: var(--lib-accent-soft, rgba(109, 106, 254, 0.16));
}
html body .chm-overlay .chm-label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 750;
    color: var(--lib-text, #e9eef6);
}
html body .chm-overlay .chm-label i { color: var(--lib-accent, #6d6afe); }
html body .chm-overlay .chm-input {
    width: 100%;
    box-sizing: border-box;
    height: 50px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1.5px solid var(--lib-border, rgba(255, 255, 255, 0.12));
    background: var(--lib-bg, #0e1420);
    color: var(--lib-text, #e9eef6);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 650;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
html body .chm-overlay .chm-input:focus {
    border-color: var(--lib-accent, #6d6afe);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--lib-accent, #6d6afe) 25%, transparent);
}
html body .chm-overlay .chm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
html body .chm-overlay .chm-chip {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--lib-border, rgba(255, 255, 255, 0.12));
    background: var(--lib-surface, #151c2b);
    color: var(--lib-text, #e9eef6);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
html body .chm-overlay .chm-chip:hover { border-color: var(--lib-accent, #6d6afe); }
html body .chm-overlay .chm-chip.is-on { background: var(--lib-accent, #6d6afe); border-color: var(--lib-accent, #6d6afe); color: #fff; }
html body .chm-overlay .chm-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 12px 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--lib-muted, #8c98ad);
}
html body .chm-overlay .chm-note i { color: var(--lib-success, #10b981); margin-top: 2px; }

/* "or" divider + ready-made Assignments chapter */
html body .chm-overlay .chm-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; color: var(--lib-muted, #8c98ad); font-size: 0.74rem; font-weight: 650; }
html body .chm-overlay .chm-or::before,
html body .chm-overlay .chm-or::after { content: ''; flex: 1; height: 1px; background: var(--lib-border, rgba(255, 255, 255, 0.08)); }
html body .chm-overlay .chm-ready {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid var(--lib-border, rgba(255, 255, 255, 0.08));
    background: var(--lib-raised, #1c2537);
    color: var(--lib-text, #e9eef6);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
html body .chm-overlay .chm-ready:hover { border-color: #f59e0b; transform: translateY(-1px); }
html body .chm-overlay .chm-ready-ic {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
}
html body .chm-overlay .chm-ready-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
html body .chm-overlay .chm-ready-main b { font-size: 0.9rem; font-weight: 750; }
html body .chm-overlay .chm-ready-main small { font-size: 0.76rem; color: var(--lib-muted, #8c98ad); }
html body .chm-overlay .chm-ready-go { color: var(--lib-muted, #8c98ad); font-size: 0.8rem; }

/* Footer */
html body .chm-overlay .chm-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
html body .chm-overlay .chm-btn {
    height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    border: none;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 750;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
html body .chm-overlay .chm-btn--ghost { background: transparent; color: var(--lib-muted, #8c98ad); }
html body .chm-overlay .chm-btn--ghost:hover { background: var(--lib-hover, rgba(255, 255, 255, 0.05)); color: var(--lib-text, #e9eef6); }
html body .chm-overlay .chm-btn--primary { background: #5c59ee; color: #fff; box-shadow: 0 6px 16px rgba(92, 89, 238, 0.35); }
html body .chm-overlay .chm-btn--primary:hover { background: #4f4ce0; }
html body .chm-overlay .chm-btn--primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

@media (max-width: 480px) {
    html body .chm-overlay { align-items: flex-end; padding: 0; }
    html body .chm-overlay .chm-card { width: 100%; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
    html body .chm-overlay .chm-foot .chm-btn { flex: 1; justify-content: center; }
}
