/* ???????????????????????????????????????????????????????????????????????
   Dokumente – Shared CSS
   Unified naming: dok-{block}-{element}--{modifier}
   ??????????????????????????????????????????????????????????????????????? */

/* ??? Sub-tabs (used by TabKunde, TabStammdaten, TabTexte, Authoring) ?? */

.dok-subtabs {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 0.5rem;
}

.dok-subtab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 0 22%;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border: none;
    border-bottom: 2.5px solid var(--ef-border-light);
    border-radius: 0;
    background: transparent;
    color: var(--ef-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.2s ease,
                border-color 0.2s ease,
                background-color 0.2s ease;
}

    .dok-subtab i:first-child {
        font-size: 0.875rem;
        color: inherit;
        transition: color 0.2s ease;
        flex-shrink: 0;
    }

    .dok-subtab span {
        min-width: 0;
    }

    .dok-subtab i.ms-auto {
        display: none;
    }

    .dok-subtab:hover {
        color: var(--ef-text-primary);
        background-color: var(--ef-bg-secondary);
        border-bottom-color: var(--ef-primary);
    }

    .dok-subtab.active {
        color: white;
        background-color: var(--ef-bg-dark);
        border-bottom-color: var(--ef-bg-dark);
        font-weight: 600;
    }

    .dok-subtab:focus-visible {
        outline: 0.125rem solid var(--ef-primary);
        outline-offset: -0.125rem;
    }

/* ??? Sub-tabs divider ????????????????????????????????????????????????? */

.dok-subtabs-divider {
    border: none;
    margin: 0;
    height: 0;
}

/* ??? Section edit panel ??????????????????????????????????????????????? */

.dok-panel {
    padding: 0.75rem 0 0.25rem;
    animation: dokPanelFadeIn 0.2s ease-out;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* All tab content panels: white background, no border */
.dok-panel .ef-card,
.dok-panel ::deep .ef-card {
    background-color: var(--ef-bg-primary) !important;
    border: none !important;
    box-shadow: none !important;
}

.dok-panel .ef-card__body,
.dok-panel ::deep .ef-card__body {
    background-color: var(--ef-bg-primary) !important;
}

@keyframes dokPanelFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ??? Search section (used by TabKunde, TabProdukt) ???????????????????? */

.dok-search {
    margin-top: 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.1875rem;
    margin-bottom: 0;
    flex: 1;
    min-height: 0;
}

.dok-search-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.dok-search-bar {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--ef-border-light);
    border-radius: var(--ef-radius-lg);
    background-color: var(--ef-bg-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

    .dok-search-bar:focus-within {
        border-color: var(--ef-primary);
        box-shadow: 0 0 0 2px rgba(var(--ef-primary), 0.12);
    }

.dok-search-icon {
    padding-left: 0.85rem;
    color: var(--ef-text-tertiary);
    font-size: 0.95rem;
    flex-shrink: 0;
    line-height: 1;
}

.dok-search-btn.ef-icon-button {
    flex-shrink: 0;
    border-radius: var(--ef-radius-md);
    background-color: var(--ef-primary);
    color: var(--ef-text-light);
    border: none;
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 2.125rem;
    height: 2.125rem;
}

    .dok-search-btn.ef-icon-button i,
    .dok-search-btn.ef-icon-button > *:not(img) {
        font-size: 1rem;
        line-height: 1rem;
    }

    .dok-search-btn.ef-icon-button:hover {
        background-color: var(--ef-primary-dark);
    }

.dok-search-input,
.dok-search-input .dxbl-text-edit,
.dok-search-input input {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

.dok-search-input {
    flex: 1;
    min-width: 0;
}

    .dok-search-input input {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem;
        color: var(--ef-text-primary);
    }

        .dok-search-input input::placeholder {
            color: var(--ef-text-tertiary);
            font-weight: 400;
        }

.dok-search-clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    margin-right: 0.35rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ef-text-tertiary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .dok-search-clear:hover {
        background-color: rgba(0, 0, 0, 0.08);
        color: var(--ef-text-primary);
    }

/* ??? List with side-action buttons ???????????????????????????????????? */

.dok-list {
    margin-top: 0.3125rem;
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.dok-list-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.dok-list-frame {
    border: 1.5px solid var(--ef-border-light);
    border-radius: var(--ef-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.dok-list-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-start;
    padding-top: 0.25rem;
    flex-shrink: 0;
}

    .dok-list-actions .ef-icon-button {
        width: 2.125rem;
        height: 2.125rem;
    }

        .dok-list-actions .ef-icon-button i,
        .dok-list-actions .ef-icon-button > *:not(img) {
            font-size: 1rem;
            line-height: 1rem;
        }

        .dok-list-actions .ef-icon-button img,
        .dok-list-actions .ef-icon-button-icon {
            width: 1rem;
            height: 1rem;
        }

    /* Trash button: red variant */
    .dok-list-actions .ef-icon-button--danger {
        background-color: var(--ef-danger);
        border-color: var(--ef-danger);
    }

        .dok-list-actions .ef-icon-button--danger:hover:not(:disabled) {
            background-color: var(--ef-error);
            border-color: var(--ef-error);
            color: var(--ef-text-light);
        }

/* ??? RichText editor panels ??????????????????????????????????????????? */

.dok-richtext {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
}

    .dok-richtext > :first-child {
        flex-shrink: 0;
    }

    .dok-richtext > :last-child {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

/* ??? Responsive: sub-tabs on narrow screens ??????????????????????????? */

@media (max-width: 767px) {
    .dok-subtab {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* ── Stammdaten / Kundendaten shared patterns ──────────────────────── */

/* Shared design tokens */
.dok-stamm,
.dok-stamm-kunde {
    --dok-accent: var(--ef-dok-accent);
    --dok-accent-rgb: var(--ef-dok-accent-rgb);
    --dok-border: var(--ef-bg-tertiary);
    --dok-border-soft: var(--ef-bg-secondary);
    --dok-text-primary: var(--ef-primary-darker);
    --dok-text-secondary: var(--ef-primary-dark);
    --dok-text-body: var(--ef-text-primary);
    --dok-text-muted: var(--ef-text-secondary);
}

/* Header row (collapsible) */
.dok-stamm-header,
.dok-stamm-kunde-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.15rem;
    cursor: pointer;
    user-select: none;
}

/* Collapse chevron */
.dok-stamm-chevron {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--dok-text-muted);
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.dok-stamm-header:hover .dok-stamm-chevron,
.dok-stamm-kunde-header:hover .dok-stamm-chevron {
    color: var(--dok-text-secondary);
}

/* Document / customer number badge */
.dok-stamm-nr {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ef-primary-dark);
    background-color: var(--ef-primary-light);
    padding: 0.05rem 0.4rem;
    border-radius: 0.25rem;
    line-height: 1.4;
}

/* Primary name */
.dok-stamm-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--dok-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Section wrapper */
.dok-stamm-section {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

/* Section title */
.dok-stamm-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--dok-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.1rem;
}

.dok-stamm-title i {
    font-size: 0.72rem;
}

/* Wide 6-col grid (label value x 3) */
.dok-stamm-grid--wide {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto 1fr;
    column-gap: 0.5rem;
    row-gap: 0.12rem;
    align-items: baseline;
}

/* Field label */
.dok-stamm-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dok-text-muted);
    white-space: nowrap;
}

/* Field value */
.dok-stamm-value {
    font-size: 0.72rem;
    color: var(--dok-text-body);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.dok-stamm-value--empty {
    color: var(--dok-text-muted);
    font-style: italic;
    opacity: 0.6;
}

.dok-stamm-value--multi {
    white-space: pre-line;
    overflow: visible;
    line-height: 1.4;
}
