/* ==================================================================
 * Dialog "Aggregation festlegen" (xplain.ux.attribute.AggregationWindow,
 * cls "aggregationWindow xdAggWindow")
 *
 * Layout nach Design-Handoff "Variante 1a – breit statt hoch":
 * 880px breit, Zeilen mit Beschriftung + Beschreibung links (300px),
 * Feldern rechts, 32px Spaltenabstand, Trennlinien zwischen den Zeilen.
 * Unter 720px Dialogbreite einspaltig (cls "xdAggNarrow").
 *
 * Karte, Header und Fusszeile kommen grundsaetzlich aus den geteilten
 * "aggregationWindow"-Regeln in Main.scss; hier nur die Abweichungen
 * dieses Dialogs (Radius, Innenabstaende) und seine Inhalte.
 * Farben: die App-Tokens des hellen Designs (Main.scss), wie im
 * Handoff vorgesehen ("App-eigene Tokens verwenden, Layout uebernehmen"):
 *   $xdSurface2 #f8f9fc   $xdBorder #e7e9f2   $xdText  #171a26
 *   $xdText2    #5b6172   $xdMuted  #9298ab   $xdAccent #417dbf
 *   $xdAccentSoft #eef0fe
 *
 * Wird VOR dem gebauten Theme-CSS geladen -> "body"-Praefix und
 * !important, wo eine Theme-Regel dagegen steht. Kein SASS-Build noetig.
 * Dunkles Design am Ende der Datei (Palette: resources/dark-theme.css).
 * ================================================================== */

/* ------------------------------------------------------------------
   Karte, Header, Fusszeile
   ------------------------------------------------------------------ */
body .xdAggWindow.x-window {
    border-radius: 16px !important;
}

body .xdAggWindow .x-window-header {
    border-radius: 16px 16px 0 0 !important;
    padding: 14px 24px !important;
}

body .xdAggWindow .x-window-header .x-title-text {
    font-size: 16px !important;
    font-weight: 600;
}

body .xdAggWindow .x-toolbar-footer {
    border-radius: 0 0 16px 16px !important;
    padding: 12px 24px !important;
}

/* ------------------------------------------------------------------
   Einleitung: dezente Info-Box ganz oben
   ------------------------------------------------------------------ */
body .xdAggWindow .xdAggIntro {
    position: relative;
    margin: 16px 24px 8px 24px;
    padding: 10px 14px 10px 38px;
    border-radius: 10px;
    background: #eef0fe;
    color: #5b6172;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
}

/* "i"-Symbol links in der Box */
body .xdAggWindow .xdAggIntro::before {
    content: "i";
    position: absolute;
    left: 13px;
    top: 12px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #417dbf;
    color: #fff;
    font: italic 700 11px/16px Georgia, 'Times New Roman', serif;
    text-align: center;
}

body .xdAggWindow .xdAggIntro b {
    color: #171a26;
    font-weight: 600;
}

/* ------------------------------------------------------------------
   Zeilen: links Beschriftung + Beschreibung, rechts die Felder
   ------------------------------------------------------------------ */
body .xdAggWindow .xdAggRow {
    margin: 0 24px;
    padding: 14px 0;
    background: transparent !important;
}

/* Trennlinie zwischen den Zeilen (als Linie oben, damit eine
   ausgeblendete letzte Zeile keine Linie hinterlaesst) */
body .xdAggWindow .xdAggRow + .xdAggRow {
    border-top: 1px solid #e7e9f2;
}

body .xdAggWindow .xdAggRowLabel {
    color: #171a26;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
}

body .xdAggWindow .xdAggRowDesc {
    margin-top: 3px;
    color: #9298ab;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 12px;
    line-height: 1.45;
    text-wrap: pretty;
}

body .xdAggWindow .xdAggRowDesc b {
    color: #5b6172;
    font-weight: 600;
}

/* Zeile "Berechnung": Label + Typ-Badge, darunter 6px zwischen den Texten */
body .xdAggWindow .xdAggCalcHead {
    display: flex;
    align-items: center;
    gap: 8px;
}

body .xdAggWindow .xdAggRowCalc .xdAggRowDesc {
    margin-top: 6px;
}

body .xdAggWindow .xdAggBadge {
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef0fe;
    color: #2f5f96;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* gewaehlte Objekte/Dimensionen im Erklaersatz */
body .xdAggWindow .xdAggToken {
    padding: 0 4px;
    border-radius: 4px;
    background: #eef0fe;
    color: #2f5f96;
    font-weight: 500;
    white-space: nowrap;
}

/* noch nicht gewaehlt: gestrichelter Platzhalter */
body .xdAggWindow .xdAggToken.xdAggTokenMissing {
    background: transparent;
    border: 1px dashed #c3c8d6;
    color: #9298ab;
    font-weight: 400;
}

/* Feld-Panel liegt direkt auf der Karte */
body .xdAggWindow .xaggregationpanel,
body .xdAggWindow .xaggregationpanel > .x-panel-body {
    background: transparent !important;
    border: 0 !important;
}

/* Inline-Labels der Felder rechts (Typ, Objekt, ...): normal, mittelgrau */
body .xdAggWindow .xaggregationpanel .x-form-item-label {
    color: #5b6172 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
}

/* Feldhoehe 36px wie im Handoff */
body .xdAggWindow .xdAggRowRight .x-form-text-wrap,
body .xdAggWindow .xdAggRowRight .x-form-trigger-wrap {
    min-height: 36px;
}

body .xdAggWindow .xdAggRowRight .x-form-text {
    min-height: 34px;
    font-size: 14px;
}

/* Zeile "Ersetzen": Checkbox-Text kraeftig wie ein Label */
body .xdAggWindow .xdAggReplaceFirst .x-form-cb-label {
    color: #171a26 !important;
    font-size: 13px !important;
    font-weight: 700;
}

/* Fokusrahmen der Felder: App-Akzent statt Violett aus theme-neutral */
body .xdAggWindow .x-form-trigger-wrap-focus,
body .xdAggWindow .x-form-text-wrap-focus {
    border-color: #417dbf !important;
}

/* Auswahllisten der Felder (schweben ausserhalb des Dialogs, cls
   "xdAggBoundList" per listConfig im Controller). theme-neutral faerbt
   den gewaehlten Eintrag violett (#7f527d / #997597 beim Hovern). */
body:not(.oe-theme-dark) .xdAggBoundList .x-boundlist-selected,
body:not(.oe-theme-dark) .xdAggBoundList .x-boundlist-selected.x-boundlist-item-over {
    background: #eef0fe !important;
    border-color: #eef0fe !important;
    color: #2f5f96 !important;
    font-weight: 600;
}

/* nicht benoetigte Felder (z. B. bei COUNT) halbtransparent statt
   der sehr blassen Ext-Darstellung */
body .xdAggWindow .xaggregationpanel .x-item-disabled {
    opacity: 0.5 !important;
}

/* ------------------------------------------------------------------
   Zeile "Selektion" ("Aggregation definieren", "Sequenz"): Checkbox
   bzw. Semantik links, Selektions-Button (140px) rechts
   ------------------------------------------------------------------ */
body .xdAggWindow .xdAggSelLine {
    background: transparent !important;
}

body .xdAggWindow .xdAggSelLine + .xdAggSelLine {
    margin-top: 8px;
}

body .xdAggWindow .xdAggSelLine .x-form-cb-label {
    color: #171a26 !important;
    font-size: 13px !important;
}

body .xdAggWindow .xdAggSelBtn a.x-btn {
    border-radius: 8px !important;
}

/* feste Selektion: neutraler Button (Farbe setzt der Controller sonst
   inline auf #ccd2db) */
body .xdAggDimWindow .xdAggSelBtn a.xselectionbutton {
    background-color: #f2f4f6 !important;
    border: 1px solid #d2d7dc !important;
}

body .xdAggDimWindow .xdAggSelBtn a.xselectionbutton.x-btn-over {
    background-color: #e7eaed !important;
}

body .xdAggDimWindow .xdAggSelBtn a.xselectionbutton .x-btn-inner,
body .xdAggDimWindow .xdAggSelBtn a.xselectionbutton .x-btn-icon-el {
    color: #5b6172 !important;
}

/* ------------------------------------------------------------------
   "Sequenz" (ExpertUI.view.dialog.generateSequence, einfache Variante,
   cls "xdSequenceWindow"): Inline-Labels der Felder wie im Feld-Panel
   ------------------------------------------------------------------ */
body .xdSequenceWindow .xdAggRowRight .x-form-item-label {
    color: #5b6172 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
}

body.oe-theme-dark .xdSequenceWindow .xdAggRowRight .x-form-item-label {
    color: var(--oe-text-mid) !important;
}

/* ------------------------------------------------------------------
   "Wildcard Selektionen" (xplain.ux.widget.selection.WildcardPanel,
   cls "xdWildcardWindow"): einspaltig, Optionen untereinander
   ------------------------------------------------------------------ */
body .xdWildcardWindow .xdAggIntro {
    margin-top: 18px;
}

/* letzte Zeile nicht an die Fusszeile kleben */
body .xdWildcardWindow .xdWildcardOptions {
    padding-bottom: 18px;
}

body .xdWildcardWindow .xdWildcardOptions .x-form-cb-label {
    color: #171a26 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px !important;
}

body.oe-theme-dark .xdWildcardWindow .xdWildcardOptions .x-form-cb-label {
    color: var(--oe-text) !important;
}

/* ------------------------------------------------------------------
   "Attribut Name" (xplain.ux.attribute.WindowController
   .onAttributeFromSelection, cls "xdAttrNameWindow"): eine Zeile
   ------------------------------------------------------------------ */
body .xdAttrNameWindow .xdAggRow {
    padding: 18px 0 20px 0;
}

/* gesperrter Akzent-Button (noch kein Name): halbtransparent statt
   vom grauen Ext-Overlay (.x-btn-tooltip, #eee) verdeckt */
body .aggregationWindow .x-toolbar-footer .x-btn.x-btn-disabled:last-child {
    opacity: 0.45;
}

body .aggregationWindow .x-toolbar-footer .x-btn-disabled .x-btn-tooltip {
    background: transparent !important;
}

/* ------------------------------------------------------------------
   Schmal (< 720px): Beschreibung ueber dem Feld
   ------------------------------------------------------------------ */
body .xdAggWindow.xdAggNarrow .xdAggRowRight {
    margin-top: 10px;
}

/* ------------------------------------------------------------------
   Dunkles Design (body.oe-theme-dark, Palette aus dark-theme.css)
   ------------------------------------------------------------------ */
body.oe-theme-dark .xdAggWindow .xdAggIntro {
    background: rgba(91, 140, 255, 0.12);
    color: var(--oe-text-mid);
}

body.oe-theme-dark .xdAggWindow .xdAggIntro::before {
    background: var(--oe-accent);
}

body.oe-theme-dark .xdAggWindow .xdAggIntro b,
body.oe-theme-dark .xdAggWindow .xdAggRowDesc b,
body.oe-theme-dark .xdAggWindow .xdAggRowLabel {
    color: var(--oe-text-strong);
}

body.oe-theme-dark .xdAggWindow .xdAggRowDesc {
    color: var(--oe-text-dim);
}

body.oe-theme-dark .xdAggWindow .xdAggRow + .xdAggRow {
    border-top-color: var(--oe-border);
}

body.oe-theme-dark .xdAggWindow .x-form-trigger-wrap-focus,
body.oe-theme-dark .xdAggWindow .x-form-text-wrap-focus {
    border-color: var(--oe-accent) !important;
}

body.oe-theme-dark .xdAggWindow .xaggregationpanel .x-form-item-label {
    color: var(--oe-text-mid) !important;
}

body.oe-theme-dark .xdAggDimWindow .xdAggSelBtn a.xselectionbutton {
    background-color: var(--oe-elevated) !important;
    border-color: var(--oe-input-border) !important;
}

body.oe-theme-dark .xdAggDimWindow .xdAggSelBtn a.xselectionbutton.x-btn-over {
    background-color: var(--oe-hover) !important;
}

body.oe-theme-dark .xdAggDimWindow .xdAggSelBtn a.xselectionbutton .x-btn-inner,
body.oe-theme-dark .xdAggDimWindow .xdAggSelBtn a.xselectionbutton .x-btn-icon-el {
    color: var(--oe-text-mid) !important;
}

body.oe-theme-dark .xdAggWindow .xdAggSelLine .x-form-cb-label,
body.oe-theme-dark .xdAggWindow .xdAggReplaceFirst .x-form-cb-label {
    color: var(--oe-text) !important;
}

body.oe-theme-dark .xdAggWindow .xdAggBadge,
body.oe-theme-dark .xdAggWindow .xdAggToken {
    background: rgba(91, 140, 255, 0.16);
    color: var(--oe-accent-light);
}

body.oe-theme-dark .xdAggWindow .xdAggToken.xdAggTokenMissing {
    background: transparent;
    border-color: var(--oe-input-border);
    color: var(--oe-text-dim);
}
