/* ==========================================
   QM-Handbuch Print Header Editor
   Follows Pflegecampus Design System (foundation.css + redesign.css)
   ========================================== */

/* Container */
.rd-qmh-header-editor {
    display: flex;
    flex-direction: column;
    gap: var(--rd-spacing-md);
    padding: var(--rd-spacing-x-big);
    background: var(--rd-card-fg);
    border-radius: var(--rd-borderradius-border-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    margin: 0 auto;
}

.rd-qmh-header-loading {
    text-align: center;
    padding: var(--rd-spacing-lg);
    font-size: var(--rd-fontsize-6);
    color: var(--rd-light-blue);
}

/* Toolbar */
.rd-qmh-header-toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--rd-spacing-md);
    padding: var(--rd-spacing-md);
    background: var(--rd-list-default-dark);
    border-radius: var(--rd-borderradius-border-md);
}

.rd-qmh-header-section {
    display: flex;
    align-items: center;
    gap: var(--rd-spacing-sm);
    flex-wrap: wrap;
}

.rd-qmh-header-section label {
    font-weight: var(--rd-fontweights-open-sans-1);
    color: var(--rd-font-dark);
    font-size: var(--rd-fontsize-4);
    min-width: 100px;
}

.rd-qmh-header-section select,
.rd-qmh-cell-input {
    padding: var(--rd-spacing-x-sm) var(--rd-spacing-sm);
    border: var(--rd-borderwidth-border-default) solid var(--rd-input-default);
    border-radius: var(--rd-borderradius-border-md);
    background: var(--rd-card-fg);
    font-size: var(--rd-fontsize-4);
    color: var(--rd-font-dark);
    transition: all 0.2s;
}

.rd-qmh-header-section select:focus,
.rd-qmh-cell-input:focus {
    outline: none;
    border-color: var(--rd-input-focused);
    border-width: var(--rd-borderwidth-border-focus);
}

.rd-qmh-cell-input {
    flex: 1;
    min-width: 200px;
}

/* Action Buttons */
.rd-qmh-header-section button {
    padding: var(--rd-spacing-x-sm) var(--rd-spacing-md);
    border: none;
    border-radius: var(--rd-borderradius-border-md);
    cursor: pointer;
    font-size: var(--rd-fontsize-4);
    font-weight: var(--rd-fontweights-open-sans-1);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--rd-spacing-xx-sm);
}

/* Primary actions (Save) - use rd-primary-btn styling */
.rd-qmh-btn-primary {
    background: var(--rd-primary-active);
    color: var(--rd-font-light);
}

.rd-qmh-btn-primary:hover {
    background: var(--rd-primary-hover);
}

.rd-qmh-btn-primary:active {
    background: var(--rd-primary-pressed);
}

/* Secondary actions (Preview, Merge, Split) - use rd-secondary-btn styling */
.rd-qmh-btn-secondary {
    background: var(--rd-secondary-active);
    color: var(--rd-font-light);
}

.rd-qmh-btn-secondary:hover {
    background: var(--rd-secondary-hover);
}

.rd-qmh-btn-secondary:active {
    background: var(--rd-secondary-pressed);
}

.rd-qmh-header-section button:disabled {
    opacity: var(--rd-opacity-inactive);
    cursor: not-allowed;
    background: var(--rd-input-disabled);
    color: var(--rd-light-blue);
}

/* Placeholder Buttons */
.rd-qmh-placeholder-btn {
    padding: var(--rd-spacing-x-sm) var(--rd-spacing-sm);
    border: var(--rd-borderwidth-border-default) solid var(--rd-success-default);
    background: var(--rd-success-inactive);
    color: var(--rd-success-pressed);
    border-radius: var(--rd-borderradius-border-md);
    cursor: pointer;
    font-size: var(--rd-fontsize-3);
    font-weight: var(--rd-fontweights-open-sans-1);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--rd-spacing-xx-sm);
}

.rd-qmh-placeholder-btn:hover {
    background: var(--rd-success-default);
    color: var(--rd-font-light);
}

.rd-qmh-placeholder-btn:active {
    background: var(--rd-success-pressed);
}

/* Action buttons row */
.rd-qmh-header-actions {
    justify-content: flex-end;
    padding-top: var(--rd-spacing-sm);
    border-top: var(--rd-borderwidth-border-default) solid var(--rd-input-default);
}

/* Grid Preview */
.rd-qmh-header-preview {
    background: var(--rd-card-fg);
    padding: var(--rd-spacing-x-big);
    border-radius: var(--rd-borderradius-border-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.rd-qmh-header-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.rd-qmh-header-cell {
    border: var(--rd-borderwidth-border-default) solid var(--rd-input-default);
    padding: var(--rd-spacing-md);
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
    background: var(--rd-card-fg);
    color: var(--rd-font-dark);
    position: relative;
}

.rd-qmh-header-cell:hover {
    background: var(--rd-list-hover);
    border-color: var(--rd-input-hover);
}

.rd-qmh-header-cell.selected {
    background: var(--rd-success-inactive);
    border-color: var(--rd-success-default);
    border-width: var(--rd-borderwidth-border-focus);
    box-shadow: inset 0 0 0 2px var(--rd-success-default);
}

.rd-qmh-header-cell.placeholder {
    background: var(--rd-success-inactive);
    font-weight: var(--rd-fontweights-open-sans-1);
    color: var(--rd-success-default);
}

.rd-qmh-header-cell-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.rd-qmh-header-cell-preview img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

/* Notice Messages */
.rd-qmh-preview-notice,
.rd-qmh-edit-notice {
    padding: var(--rd-spacing-sm) var(--rd-spacing-md);
    border-radius: var(--rd-borderradius-border-md);
    font-size: var(--rd-fontsize-4);
    display: flex;
    align-items: center;
    gap: var(--rd-spacing-x-sm);
}

.rd-qmh-preview-notice {
    background: var(--rd-secondary-inactive);
    color: var(--rd-secondary-pressed);
    border: var(--rd-borderwidth-border-default) solid var(--rd-secondary-active);
}

.rd-qmh-edit-notice {
    background: var(--rd-warning-inactive);
    color: var(--rd-warning-pressed);
    border: var(--rd-borderwidth-border-default) solid var(--rd-warning-default);
}

/* Responsive */
@media (max-width: 768px) {
    .rd-qmh-header-editor {
        padding: var(--rd-spacing-md);
    }
    
    .rd-qmh-header-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rd-qmh-header-section label {
        min-width: auto;
    }
    
    .rd-qmh-placeholder-btn {
        width: 100%;
        justify-content: center;
    }
    
    .rd-qmh-header-cell {
        padding: var(--rd-spacing-sm);
        font-size: var(--rd-fontsize-3);
    }
}
