/* Campaign workspace shared styles */

.workspace-shell {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    min-height: 0;
    background: #f4f5f7;
    overflow: hidden;
}

.workspace-mobile-tabs {
    display: none;
}

.workspace-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.workspace-header-title {
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
}

.workspace-header-counter {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
}

.workspace-header-spacer {
    flex: 1 1 auto;
}

.workspace-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.workspace-body {
    display: grid;
    grid-template-columns: 280px 1fr 480px;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 1100px) {
    .workspace-body {
        grid-template-columns: 240px 1fr 420px;
    }
}

@media (max-width: 900px) {
    .workspace-shell {
        grid-template-rows: auto auto 1fr;
    }

    .workspace-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        position: relative;
    }

    .workspace-pane.is-hidden-mobile {
        display: none;
    }

    .workspace-mobile-tabs {
        display: flex;
        background: #fff;
        border-bottom: 1px solid #e5e7eb;
        flex-shrink: 0;
    }

    .workspace-mobile-tab {
        flex: 1 1 0;
        padding: 12px 8px;
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        font-size: 0.9rem;
        font-weight: 500;
        color: #6b7280;
        cursor: pointer;
        font-family: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

        .workspace-mobile-tab.is-active {
            color: #1f2937;
            border-bottom-color: #3b82f6;
            background: #f9fafb;
        }

    .workspace-mobile-tab-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 999px;
        background: #ef4444;
        color: #fff;
        font-size: 0.7rem;
        font-weight: 700;
    }

    .workspace-header {
        gap: 8px;
        padding: 8px 12px;
        flex-wrap: nowrap;
    }

    .workspace-header-title-text {
        max-width: 40vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex-shrink: 1;
        min-width: 0;
    }

    .invite-btn-desktop {
        display: none !important;
    }

    .presence-chips .presence-chip:nth-of-type(n+4):not(.is-overflow) {
        display: none;
    }
}

@media (min-width: 901px) {
    .invite-btn-mobile {
        display: none !important;
    }
}

.workspace-pane {
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.workspace-pane:last-child {
    border-right: 0;
}

.workspace-pane-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.workspace-pane-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

.workspace-pane-footer {
    border-top: 1px solid #f3f4f6;
    padding: 12px;
    flex-shrink: 0;
    background: #fafbfc;
}

/* Banner cards (left rail) */
.banner-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0;
    background: #fff;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}

.banner-card:hover {
    border-color: #93c5fd;
}

.banner-card.is-selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #dbeafe;
}

/* The wrapper hosts a .cp-banner-thumb whose size is set by inline style (per banner
   format). Centering it horizontally gives portrait/landscape banners a tidy look in
   the rail; background fills any gutter when the banner is narrower than the wrapper. */
.banner-card-thumb-wrapper {
    position: relative;
    width: 100%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    min-height: 96px;
    box-sizing: border-box;
}

.banner-card-click-shield {
    position: absolute;
    inset: 0;
    background: transparent;
    cursor: pointer;
    z-index: 2;
}

.banner-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    padding: 6px 8px 8px;
}

.banner-card-unread {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 2px 7px;
    z-index: 3;
}

/* Status pills */
.status-pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pill-pushed {
    background: #d1fae5;
    color: #065f46;
}

.status-pill-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-pill-resolved {
    background: #ddd6fe;
    color: #5b21b6;
}

/* Banner viewer (center) — scaled stage */
.banner-viewer-stage {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#f5f5f5 0% 25%, #ffffff 0% 50%) 0/24px 24px;
    overflow: auto;
    position: relative;
    min-height: 0;
}

/* Audio variant — drop the checkered "transparency" backdrop (no visual to overlay) and let
   the audio + summary scroll from the top of the stage instead of being centred. */
.banner-viewer-stage-audio {
    background: var(--mud-palette-background, #fafafa);
    align-items: flex-start;
    overflow-y: auto;
    padding: 16px;
}

.banner-viewer-audio-wrap {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.banner-viewer-scale-wrapper {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.banner-viewer-size-box {
    position: relative;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.banner-viewer-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.banner-viewer-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.banner-viewer-iframe-pdf {
    background: #525659;
}

.banner-viewer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #9ca3af;
    gap: 12px;
}

.banner-viewer-toolbar {
    padding: 8px 16px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.toolbar-divider {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: #e5e7eb;
    margin: 0 6px;
}

.draft-ribbon {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fef3c7;
    color: #92400e;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 5;
}

.banner-mode-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 41, 55, 0.92);
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.banner-busy-overlay {
    position: absolute;
    inset: 0;
    background: rgba(31, 41, 55, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: busy-fade-in 0.15s ease;
}

@keyframes busy-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.banner-busy-card {
    background: #fff;
    padding: 24px 32px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    max-width: 360px;
    color: #1f2937;
}

.banner-busy-card .icon {
    color: #3b82f6;
}

/* Pin overlay (always visible, never blocks pointer) */
.banner-pin-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.pin-marker {
    position: absolute;
    color: #ef4444;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    /* The Material "Place" icon's tip sits ~4px above its layout-box bottom
     * (combined effect of the SVG's bottom padding and the line-height around
     * the inline icon). Without the +4px nudge the visible tip lands above
     * the click coordinate. Keep this constant in sync with the hover/flash
     * transforms below. */
    transform: translate(-50%, calc(-100% + 4px));
    font-size: 26px;
    line-height: 1;
    pointer-events: auto;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.pin-marker:hover,
.pin-marker.is-hovered {
    transform: translate(-50%, calc(-100% + 4px)) scale(1.25);
    filter: drop-shadow(0 2px 6px rgba(239, 68, 68, 0.6));
    z-index: 6;
}

.pin-marker.is-flashed {
    animation: pin-flash 0.4s ease 0s 4 alternate;
    z-index: 6;
}

@keyframes pin-flash {
    from { transform: translate(-50%, calc(-100% + 4px)) scale(1); }
    to   { transform: translate(-50%, calc(-100% + 4px)) scale(1.4); filter: drop-shadow(0 0 12px #ef4444); }
}

.pin-marker-number {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translate(-50%, 0);
    background: #fff;
    color: #ef4444;
    border: 2px solid #ef4444;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: 700;
    line-height: 12px;
    text-align: center;
    text-shadow: none;
    pointer-events: none;
}

.pin-marker-pending {
    color: #f59e0b;
    pointer-events: none;
}

.pin-marker-pending .pin-marker-number {
    color: #f59e0b;
    border-color: #f59e0b;
}

/* Addressed pins — shown only via the "Vis behandlede" toggle. Muted grey with a check badge. */
.pin-marker-resolved {
    color: #9ca3af;
    pointer-events: none;
    opacity: 0.85;
}

.pin-marker-resolved .pin-marker-number {
    color: #6b7280;
    border-color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Interaction overlay (mode-driven) */
.banner-interaction-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
}

.banner-interaction-overlay.is-view {
    pointer-events: none;
}

.banner-interaction-overlay.is-pin {
    pointer-events: auto;
    cursor: crosshair;
    background: rgba(59, 130, 246, 0.04);
}

.banner-interaction-overlay.is-draw {
    pointer-events: auto;
}

.banner-draw-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Draw toolbar */
.draw-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    padding: 4px 8px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.draw-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #d1d5db;
    cursor: pointer;
    padding: 0;
}

.draw-color-swatch.is-active {
    box-shadow: 0 0 0 2px #1f2937;
}

/* Thread / messages (right rail) */
.thread-empty {
    text-align: center;
    color: #9ca3af;
    padding: 32px 16px;
}

.message-bubble {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.message-bubble.is-self {
    background: #dbeafe;
    border-color: #bfdbfe;
}

.message-bubble.is-system {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #6b7280;
    font-style: italic;
    font-size: 0.85rem;
}

.message-bubble.is-hovered {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px #fee2e2;
}

.message-bubble.is-flashed {
    animation: bubble-flash 0.4s ease 0s 4 alternate;
}

@keyframes bubble-flash {
    from { box-shadow: 0 0 0 2px #fee2e2; }
    to   { box-shadow: 0 0 0 4px #fca5a5, 0 0 16px rgba(239, 68, 68, 0.4); border-color: #ef4444; }
}

.message-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 600;
    color: #111827;
}

.message-time {
    color: #9ca3af;
}

.message-attachments {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.message-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.78rem;
    color: #374151;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    font-family: inherit;
}

.message-attachment-chip:hover {
    background: #e5e7eb;
}

.message-attachment-thumb {
    margin-top: 6px;
    margin-right: 6px;
    max-width: 220px;
    max-height: 160px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: zoom-in;
    background: #fff;
    display: inline-block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.message-attachment-thumb:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.message-attachment-image {
    /* inherits .message-attachment-thumb sizing */
}

.message-attachment-video-thumb {
    position: relative;
    width: 220px;
    height: 140px;
    overflow: hidden;
    background: #111;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-top: 6px;
    margin-right: 6px;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.message-attachment-video-thumb:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.message-attachment-video-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.message-attachment-video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

.message-pin-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 8px 2px 4px;
    border-radius: 999px;
    font-size: 0.72rem;
    margin-top: 4px;
    border: 1px solid #fca5a5;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}

.message-pin-chip:hover {
    background: #fecaca;
}

.message-pin-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    font-weight: 700;
}

.message-annotation-thumb {
    margin-top: 6px;
    width: 80px;
    height: 60px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
}

/* Composer */
.composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.composer-textarea {
    width: 100%;
    min-height: 60px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-actions-spacer {
    flex: 1 1 auto;
}

.composer {
    position: relative;
    transition: background 0.15s, box-shadow 0.15s;
}

.composer.drop-zone-active {
    background: #dbeafe;
    box-shadow: inset 0 0 0 2px #3b82f6;
}

.composer-drop-hint {
    position: absolute;
    inset: 0;
    background: rgba(219, 234, 254, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #1d4ed8;
    font-weight: 600;
    pointer-events: none;
    z-index: 5;
    border-radius: 6px;
    gap: 6px;
}

.composer-hint {
    margin-left: 4px;
}

.composer-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.composer-annotation-mini {
    width: 28px;
    height: 20px;
    object-fit: contain;
    margin-left: 6px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
}

/* Pending pin/annotation chip — sits ABOVE the textarea so the placed pin
 * stays in the user's sight-line while they type. Colors follow the on-stage
 * pin marker: amber (.pin-marker-pending = #f59e0b) for pins, neutral for
 * annotations. */
.composer-pending-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.composer-pending-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
}

.composer-pending-chip-pin {
    background: #fef3c7; /* amber-100 */
    color: #92400e;      /* amber-800 */
    border: 1px solid #fde68a; /* amber-200 */
}

    .composer-pending-chip-pin .mud-icon-root {
        color: #f59e0b !important; /* amber-500 — same as .pin-marker-pending */
    }

.composer-pending-chip-annotation {
    background: #eff6ff; /* blue-50 */
    color: #1e40af;      /* blue-800 */
    border: 1px solid #dbeafe; /* blue-100 */
    padding-left: 10px;  /* no number badge → restore symmetric padding */
}

    .composer-pending-chip-annotation .mud-icon-root {
        color: #3b82f6 !important; /* blue-500 */
    }

.composer-pending-pin-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b; /* amber-500 — matches the on-stage pending pin marker */
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Presence chips */
.presence-chips {
    display: flex;
    align-items: center;
    gap: 4px;
}

.presence-chip {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    position: relative;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e5e7eb;
}

/* Workspace identity colors — applied to BOTH presence chips and message avatars
   so each person has one consistent color everywhere they appear:
     blue   = CMSUser (L-Mediehus staff)
     orange = customer (company admin or member) */
.presence-chip.is-admin,
.ws-avatar-cms {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

.presence-chip.is-participant,
.ws-avatar-customer {
    background-color: #f97316 !important;
    color: #fff !important;
}

.presence-chip {
    position: relative;
}

.presence-chip::after {
    content: "";
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
}

.presence-chip.is-offline {
    opacity: 0.85;
}

.presence-chip.is-offline::after {
    background: #9ca3af;
}

.presence-chip.is-overflow {
    background: #6b7280;
}

.typing-indicator {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 6px;
    min-height: 18px;
}
