/* CIO-AI-Driven: Extracted from custom/Agency/templates/admin/ticket/edit.html.twig
   Purpose: Keep EasyAdmin/Ticket edit template free of inline styles.
*/

body.agency-ticket-edit-page .ticket-status-badge {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
    color: #ffffff;
}

body.agency-ticket-edit-page .ticket-status-badge--open { background: #6c757d; }
body.agency-ticket-edit-page .ticket-status-badge--question { background: #0d6efd; }
body.agency-ticket-edit-page .ticket-status-badge--review { background: #f0ad4e; } /* legacy-like orange */
body.agency-ticket-edit-page .ticket-status-badge--approved { background: #198754; }
body.agency-ticket-edit-page .ticket-status-badge--nextupdate { background: #6c757d; }
body.agency-ticket-edit-page .ticket-status-badge--online { background: #28a745; }
body.agency-ticket-edit-page .ticket-status-badge--closed { background: #343a40; }
body.agency-ticket-edit-page .ticket-status-badge--pause { background: #6c757d; }
body.agency-ticket-edit-page .ticket-status-badge--default { background: #6c757d; }

body.agency-ticket-edit-page .ticket-stoerer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

body.agency-ticket-edit-page .ticket-stoerer-actions .btn {
    border-radius: 0.25rem;
}

body.agency-ticket-edit-page .ticket-stoerer-actions .btn-ticket-action {
    background: #f8f9fa;
    border: 1px solid #dcdfe3;
    color: #212529;
}

body.agency-ticket-edit-page .ticket-stoerer-actions .btn-ticket-action:hover {
    background: #eef0f2;
    border-color: #cfd4da;
    color: #212529;
}

body.agency-ticket-edit-page .ticket-stoerer-actions .btn-hotfix {
    margin-left: auto;
}

body.agency-ticket-edit-page .ticket-callout {
    border-radius: 0.25rem;
    padding: 1.5rem 1.75rem;
    margin-top: 0.75rem;
    color: #ffffff;
}

body.agency-ticket-edit-page .ticket-callout h5 {
    margin: 0 0 0.75rem 0;
    font-weight: 700;
    color: #ffffff;
}

body.agency-ticket-edit-page .ticket-callout ul {
    margin: 0;
    padding-left: 1.25rem;
}

body.agency-ticket-edit-page .ticket-callout--info { background: #00bcd4; }
body.agency-ticket-edit-page .ticket-callout--warning { background: #f0ad4e; }
body.agency-ticket-edit-page .ticket-callout--danger { background: #dc3545; }
body.agency-ticket-edit-page .ticket-callout--success { background: #198754; }

body.agency-ticket-edit-page .ticket-estimate-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

body.agency-ticket-edit-page .ticket-estimate-grid .btn {
    background: #f8f9fa;
    border: 1px solid #dcdfe3;
    color: #212529;
    min-width: 4.25rem;
}

/* CIO-AI-Driven: Make ticket edit page more lightweight/compact (legacy-like) */
body.agency-ticket-edit-page {
    font-size: 0.95rem;
}

body.agency-ticket-edit-page .form-label,
body.agency-ticket-edit-page legend.form-label {
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

body.agency-ticket-edit-page .form-control,
body.agency-ticket-edit-page .form-select {
    font-size: 0.9rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

/* Smaller section headings */
body.agency-ticket-edit-page h5 {
    font-size: 1rem;
}

/* Offer/Order block (legacy-like "Angebot") */
body.agency-ticket-edit-page .agency-ticket-offerorder .content-header .title {
    font-size: 1rem;
    font-weight: 700;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card {
    border: 1px solid #e6e8ec;
    background: #ffffff;
    border-radius: 0.25rem;
    padding: 0.75rem 0.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card + .agency-ticket-offerorder-card {
    margin-top: 0.75rem;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card__label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6c757d;
    margin-bottom: 0.2rem;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card__value {
    font-size: 0.9rem;
    color: #212529;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card__description {
    white-space: pre-wrap;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card__price-toggle {
    font-weight: 600;
    text-decoration: underline;
}

body.agency-ticket-edit-page .agency-ticket-offerorder-card__price {
    font-weight: 700;
    margin-left: 0.35rem;
}

/* CIO-AI-Driven: Originally injected inline in the template */
body.agency-ticket-edit-page .content-wrapper {
    display: block;
}

/* CIO-AI-Driven: Embed-mode (used in Kanban iframe) -> hide EasyAdmin chrome and remove page framing
 * Goal: In Kanban we provide our own overlay header actions ("Close", "Save & close"),
 * so we hide the EasyAdmin content header/actions entirely.
 */
body.agency-embed .main-header,
body.agency-embed .sidebar,
body.agency-embed .content-top,
body.agency-embed #sfToolbarMainContent,
body.agency-embed .sf-toolbar {
    display: none !important;
}

/* CIO-AI-Driven: In embed-mode we MUST keep the content header visible (ticket number + title),
 * but we still hide action buttons via the selectors below (page-actions / form-actions / action-save*).
 */

/*
 * CIO-AI-Driven: Kanban Overlay nutzt nur "Schließen" im Overlay-Header.
 * - "Zurück zur Liste" (Index) soll im Embed nicht sichtbar sein, damit man nicht aus dem Overlay navigiert.
 * - Save/Save&Continue/Save&Return bleiben sichtbar; das Overlay schließt nach Save über die Embed-Bridge.
 * - Delete/Edit verstecken wir weiterhin.
 */
body.agency-embed a.action-index,
body.agency-embed a[data-action-name="backToList"],
body.agency-embed a.action-edit,
body.agency-embed a.action-delete,
body.agency-embed button.action-delete {
    display: none !important;
}

/*
 * CIO-AI-Driven: EasyAdmin layout uses a CSS grid `.wrapper` with a fixed sidebar column.
 * Even if `.sidebar` is hidden, the grid column can still reserve ~230px (seen in DevTools).
 * For embed we force a single-column flow so the content fills the iframe.
 */
body.agency-embed .wrapper {
    display: block !important;
    padding: 0 !important;
}

/* Remove any leftover framing/padding */
body.agency-embed .content-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
}

/* In embed we want the content to start flush (no mysterious 1px offset) */
body.agency-embed article.content {
    margin-top: 0 !important;
    border-top: 0 !important;
}

/* CIO-AI-Driven: Prevent tiny horizontal scroll in iframe (Bootstrap .row has negative margins) */
html.agency-embed,
html.agency-embed body,
body.agency-embed {
    overflow-x: hidden;
}

body.agency-embed .content-body {
    overflow-x: hidden;
}

body.agency-embed .responsive-header {
    display: none !important;
}

/* Match gutter to padding: gutter-x = 2 * padding => row margins become -15px (no overflow) */
body.agency-embed .content-body .row {
    --bs-gutter-x: 30px;
}

/* CIO-AI-Driven: EasyAdmin sidebar menu badges right-aligned in one vertical line */
#main-menu .menu-item-contents {
    display: flex;
    width: 100% !important; /* ensure full clickable width inside li */
    align-items: center !important; /* override EasyAdmin defaults */
    gap: 0.5rem;
    box-sizing: border-box;
}

#main-menu .menu-item-contents .menu-item-label {
    flex: 1 1 auto;
    min-width: 0;
}

#main-menu .menu-item-contents .menu-item-badge {
    margin-left: auto !important;
    min-width: 2.25rem;
    flex: 0 0 auto;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* CIO-AI-Driven: Presentation mode toggle (top right) + ensure it's aligned in one row with the profile menu */
.navbar-custom-menu {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem; /* bootstrap-ish */
}

.navbar-custom-menu > .user-menu-wrapper {
    display: flex;
    align-items: center;
}

/* Avoid hardcoded inline spacing; keep a small gutter between toggle and profile menu */
.navbar-custom-menu > .agency-presentation-mode-toggle-wrapper {
    padding-right: 0.5rem !important;
}

.agency-presentation-mode-toggle-wrapper form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.agency-presentation-mode-toggle {
    appearance: none;
    -webkit-appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    padding: 0;

    border-radius: 0.375rem; /* Bootstrap radius */
    border: 1px solid transparent;

    background: transparent;
    color: rgba(255, 255, 255, 0.92);

    box-shadow: none; /* requested: no shadow */

    cursor: pointer;
    user-select: none;

    transition: background-color 120ms ease, border-color 120ms ease;
}

.agency-presentation-mode-toggle__icon {
    font-size: 18px;
    line-height: 1;
}

/* Hover/active like Bootstrap */
.agency-presentation-mode-toggle:hover {
    background-color: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
}

.agency-presentation-mode-toggle:active {
    background-color: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
}

.agency-presentation-mode-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.45);
}

/* Enabled state: subtle green hint (still clean) */
.agency-presentation-mode-toggle[aria-pressed="true"] {
    border-color: rgba(25, 135, 84, 0.45);
}

.agency-presentation-mode-toggle[aria-pressed="true"]:hover {
    background-color: rgba(25, 135, 84, 0.14);
    border-color: rgba(25, 135, 84, 0.55);
}

@media (prefers-reduced-motion: reduce) {
    .agency-presentation-mode-toggle {
        transition: none;
    }
}

#edit-Ticket-form label {
    margin-top: calc(.375rem + var(--bs-border-width));
    margin-bottom: calc(.375rem + var(--bs-border-width));
}

/* CIO-AI-Driven: AI spellcheck button + flamingo loader (Ticket description + Notes new-note textarea). */
body.agency-ticket-edit-page .agency-ai-spellcheck__button {
    text-decoration: none;
    font-weight: 400;
}

body.agency-ticket-edit-page .agency-ai-spellcheck__button:hover {
    text-decoration: underline;
}

body.agency-ticket-edit-page .agency-ai-spellcheck__loader {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #6c757d; /* Bootstrap text-muted */
    font-size: 0.85rem;
}

body.agency-ticket-edit-page .agency-ai-spellcheck__loader .flamingo {
    display: inline-flex;
    width: 18px;
    height: 18px;
}

body.agency-ticket-edit-page .agency-ai-spellcheck__loader .flamingo svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Subtle wing flap to indicate activity */
body.agency-ticket-edit-page .agency-ai-spellcheck__loader .flamingo .wing {
    transform-origin: 16px 15px;
    animation: agencyFlamingoWing 800ms ease-in-out infinite;
}

@keyframes agencyFlamingoWing {
    0% { transform: scaleX(1) rotate(0deg); opacity: 1; }
    50% { transform: scaleX(0.92) rotate(-6deg); opacity: 0.92; }
    100% { transform: scaleX(1) rotate(0deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    body.agency-ticket-edit-page .agency-ai-spellcheck__loader .flamingo .wing {
        animation: none;
    }
}