/* ───────────────────────────────────────────────────────────
   CV editor: shared building blocks for every section card.
   Global (not scoped) on purpose: one definition for all
   sections instead of a copy in each *.razor.css, and it also
   reaches MudBlazor internals and popovers without ::deep.
   Scoped section files keep only what is unique to a section
   (field grids, rows). Values come from design tokens only.
─────────────────────────────────────────────────────────── */

/* ── Section card ───────────────────────────────────────── */
.cv-page .text-field {
    max-width: 100%;
    flex-basis: 100%;
    margin-bottom: 20px;
    scroll-margin-top: 72px;
}

.cv-page .text-field > .mud-card {
    /* Never wider than the column: on a phone 280px ran under the preview rail. */
    min-width: min(280px, 100%);
    border: 1px solid var(--c-border);
    container-type: inline-size; /* rows inside reflow by the card's own width */
}

.cv-page .text-field > .mud-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.cv-page .mud-card-header {
    padding: 20px 24px 12px;
}

.cv-page .mud-card-content {
    padding: 0 24px 24px;
}

@media (max-width: 480px) {
    .cv-page .mud-card-header {
        padding: 16px 16px 10px;
    }

    .cv-page .mud-card-content {
        padding: 0 16px 16px;
    }
}

/* ── Section title row: title + header actions ──────────── */
.cv-page .title-wrap {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 16px;
}

    /*color: var(--c-action);*/
.cv-page .title-text {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--c-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

/* ── Row action icon (delete, link, …): borderless, circle on hover ── */
.cv-page .action-icon.mud-icon-button {
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--c-text-disabled);
    width: 32px;
    height: 32px;
    padding: 0;
    transition: background var(--t-fast), color var(--t-fast);
}

.cv-page .action-icon.mud-icon-button:hover {
    background: rgba(var(--c-primary-rgb), 0.08);
    color: var(--c-primary);
}

.cv-page .action-icon--active.mud-icon-button {
    color: var(--c-primary);
}

/* ── Text buttons ("+ Add …") ───────────────────────────── */
.cv-page .mud-button-text {
    padding: 0 4px;
    font-size: var(--fs-sm);
    font-weight: 600;
}

.cv-page .mud-button-text:hover {
    color: var(--c-action);
    background-color: transparent;
}

.cv-page .mud-button-text:hover::before {
    background-color: transparent;
    opacity: 0;
}

/* "+ Add …" under a list: aligned with the left edge of the fields. */
.cv-page .mud-button-text.section-add-under {
    margin-top: 12px;
    margin-left: -6px;
    padding: 4px 6px;
    color: var(--c-primary);
    font-size: var(--fs-xs);
    text-transform: none;
}

.cv-page .mud-button-text.section-add-under:hover {
    color: var(--c-action);
}

.cv-page .mud-button-text.section-add-under:disabled,
.cv-page .mud-button-text.section-add-under.mud-button-disabled {
    color: var(--c-text-disabled);
}

/* ── Hidden section ("not in PDF"): dimmed, read-only look ──
   !important here overrides MudBlazor's own focus/hover states. */
.cv-page .content-hidden {
    opacity: 0.45;
    pointer-events: none;
}

.cv-page .faded-btn {
    opacity: 0.45;
}

.cv-page .content-hidden input,
.cv-page .content-hidden textarea {
    color: var(--c-text-disabled) !important;
    -webkit-text-fill-color: var(--c-text-disabled) !important;
}

.cv-page .content-hidden .mud-input,
.cv-page .content-hidden .mud-input-control,
.cv-page .content-hidden .mud-input-slot,
.cv-page .content-hidden .action-icon.mud-icon-button {
    color: var(--c-text-disabled) !important;
}

.cv-page .content-hidden .mud-input-label,
.cv-page .content-hidden .mud-input-helper,
.cv-page .content-hidden .mud-input-helper-container {
    color: var(--c-text-secondary) !important;
}

.cv-page .content-hidden .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--c-border) !important;
    box-shadow: none !important;
}

/* ── Container queries: reflow by card width, not window width ── */
.cv-page .title-wrap:has(.pe-header-actions) {
    container-type: inline-size;
}

@container (max-width: 600px) {
    .cv-page .title-wrap .pe-header-actions {
        flex: 1 0 100%;
        margin-left: 0;
        justify-content: space-between;
    }
}

@container (max-width: 420px) {
    .cv-page .language-rows .language-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }
}

/* ───────────────────────────────────────────────────────────
   Shared popover surface: "Add more section" menu + month picker.
   Both render in MudPopoverProvider (outside the component), so
   these rules have to live here, not in scoped .razor.css.
─────────────────────────────────────────────────────────── */
.additional-section-selector-popover.mud-popover,
.mud-picker-popover .mud-picker-popover-paper {
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-popover);
    overflow: hidden;
}

/* ── Add more section menu ── */
.additional-section-selector-popover .additional-section-selector-list {
    min-width: 300px;
    padding: 6px;
}

.additional-section-selector-list .cv-menu-group {
    padding: 8px 10px 4px;
    font-size: var(--fs-xs);
    line-height: 1rem;
    font-weight: 500;
    color: var(--c-text-secondary);
}

.additional-section-selector-list .cv-menu-divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--c-border);
}

.additional-section-selector-list .mud-menu-item.cv-menu-item {
    min-height: 0;
    padding: 8px 10px;
    border-radius: var(--r-md);
}

.additional-section-selector-list .mud-menu-item.cv-menu-item:hover,
.additional-section-selector-list .mud-menu-item.cv-menu-item:focus-visible {
    background: var(--c-nav-hover-bg);
}

.additional-section-selector-list .cv-menu-item .mud-menu-item-text {
    margin: 0;
}

.cv-menu-item__row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cv-menu-item__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    background: var(--c-bg-subtle);
    color: var(--c-primary-light);
}

.cv-menu-item__icon .mud-svg-icon {
    font-size: var(--fs-lg);
}

.cv-menu-item__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cv-menu-item__title {
    font-size: var(--fs-sm);
    line-height: 1.25rem;
    color: var(--c-text);
}

.cv-menu-item__desc {
    font-size: var(--fs-xs);
    line-height: 1rem;
    color: var(--c-text-secondary);
}

/* ── Professional experience "…" menu ── */
.pe-options.mud-popover {
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-popover);
    overflow: hidden;
}

.pe-options .pe-options__list {
    min-width: 300px;
    max-width: 360px;
    padding: 6px;
}

.pe-options__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--r-md);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.pe-options__item:hover,
.pe-options__item:focus-visible {
    background: var(--c-nav-hover-bg);
    outline: none;
}

.pe-options__item .cv-menu-item__body {
    flex: 1;
    gap: 2px;
}

.pe-options__item .pe-options__icon--on {
    background: rgba(var(--c-action-rgb), 0.12);
    color: var(--c-action);
}

.pe-options__switch {
    flex: 0 0 auto;
    pointer-events: none;
}

.pe-options__switch .mud-input-control,
.pe-options__switch .mud-switch {
    margin: 0;
}

/* ── Month picker (OpenTo.Month, toolbar hidden) ── */
.mud-picker-popover .mud-picker-content {
    min-width: 0;
    min-height: 0;
}

.mud-picker-popover .mud-picker-calendar-container {
    width: 280px;
    padding: 4px 6px 8px;
}

.mud-picker-popover .mud-picker-calendar-header-switch {
    margin: 0;
    padding: 2px 0;
}

.mud-picker-popover .mud-picker-calendar-header-switch > .mud-icon-button {
    margin: 0;
    padding: 6px;
}

.mud-picker-popover .mud-picker-month-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: 100%;
}

.mud-picker-popover .mud-picker-month {
    height: 36px;
    border-radius: var(--r-md);
}

.mud-picker-popover .mud-picker-month .mud-typography {
    font-size: var(--fs-sm);
}

/* Selected (or, with no value yet, the current) month: filled chip. */
.mud-picker-popover .mud-picker-month:has(.mud-picker-month-selected) {
    background: var(--c-primary);
}

.mud-picker-popover .mud-picker-month .mud-picker-month-selected {
    color: var(--c-on-primary) !important;
    font-weight: 500;
}

.mud-picker-popover .mud-picker-year-container {
    height: 240px;
}
