/* ═══════════════════════════════════════════════════════════════════════════
   AudioGarden OS — Admin Detail v9.3.44
   Sticky header, 6-step stepper, primary action bar, unified buttons,
   accordion component, admin self-assigned exception UI.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ══════ 1. STICKY HEADER BAR ══════ */
.agos-sticky-header {
    position: sticky;
    top: 32px; /* WP admin bar height */
    z-index: 900;
    background: #fff;
    border-bottom: 1px solid var(--ag-border-subtle, #f0f1f4);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    padding: 16px 24px;
    margin: -20px -24px 24px -24px;
    border-radius: 0 0 12px 12px;
}
@media (max-width: 782px) {
    .agos-sticky-header { top: 46px; padding: 12px 14px; margin: -12px -12px 16px; }
}

/* Header: top row = title left, actions right */
.agos-sh-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.agos-sh-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}
.agos-sh-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--ag-text, #1e293b);
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.agos-sh-uid {
    font-size: 12px;
    font-weight: 600;
    color: var(--ag-text-tertiary, #94a3b8);
    background: var(--ag-bg, #f7f8fa);
    padding: 2px 8px;
    border-radius: 6px;
}
.agos-sh-deadline {
    font-size: 12px;
    color: var(--ag-text-secondary, #6b7280);
    display: flex;
    align-items: center;
    gap: 4px;
}
.agos-sh-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ══════ 2. STATUS PROGRESS STEPPER (admin) ══════ */
.agos-sh-stepper {
    padding: 14px 0 0;
}
.agos-sh-stepper-track {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}
.agos-sh-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
    z-index: 2;
}
/* Connecting line between circles */
.agos-sh-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: calc(50% + 14px);
    right: calc(-50% + 14px);
    height: 3px;
    background: var(--ag-border, #E5E7EB);
    z-index: 1;
    border-radius: 2px;
}
.agos-sh-step--done:not(:last-child)::after {
    background: var(--ag-success, #22C55E);
}
.agos-sh-step--active:not(:last-child)::after {
    background: linear-gradient(90deg, var(--ag-accent, #2563EB) 0%, var(--ag-border, #E5E7EB) 100%);
}

/* Circle */
.agos-sh-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    position: relative;
    z-index: 3;
    flex-shrink: 0;
}
.agos-sh-step--done .agos-sh-circle {
    background: var(--ag-success, #22C55E);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(34,197,94,.12);
}
.agos-sh-step--done .agos-sh-circle svg {
    animation: agosAdmCheck .35s cubic-bezier(.34,1.56,.64,1) both;
}
.agos-sh-step--active .agos-sh-circle {
    background: var(--ag-accent, #2563EB);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15), 0 2px 6px rgba(37,99,235,.12);
    animation: agosAdmPop .4s cubic-bezier(.34,1.56,.64,1) both;
}
.agos-sh-step--upcoming .agos-sh-circle {
    background: #fff;
    border: 2px solid var(--ag-border, #D1D5DB);
    color: #9CA3AF;
}

/* Label */
.agos-sh-label {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    line-height: 1.2;
}
.agos-sh-step--done .agos-sh-label { color: var(--ag-text-secondary, #6B7280); }
.agos-sh-step--active .agos-sh-label { color: var(--ag-text, #1E293B); font-weight: 700; }
.agos-sh-step--upcoming .agos-sh-label { color: #9CA3AF; }

/* Stepper animations */
@keyframes agosAdmCheck {
    from { opacity: 0; transform: scale(.5); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes agosAdmPop {
    0%   { transform: scale(.9); }
    60%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Mobile stepper — compact */
.agos-sh-stepper-mobile {
    display: none;
}
@media (max-width: 640px) {
    .agos-sh-stepper-track { display: none; }
    .agos-sh-stepper-mobile {
        display: flex;
        align-items: center;
        gap: 10px;
        padding-top: 10px;
    }
    .agos-sh-stepper-mobile-step {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--ag-text-tertiary, #94A3B8);
        white-space: nowrap;
    }
    .agos-sh-stepper-mobile-label {
        font-size: 13px;
        font-weight: 700;
        color: var(--ag-text, #1E293B);
    }
    .agos-sh-stepper-mobile-bar {
        flex: 1;
        height: 6px;
        background: var(--ag-border, #E5E7EB);
        border-radius: 3px;
        overflow: hidden;
    }
    .agos-sh-stepper-mobile-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--ag-success, #22C55E), var(--ag-accent, #2563EB));
        border-radius: 3px;
        transition: width .5s ease;
    }
}

/* ══════ 3. PRIMARY ACTION BUTTONS BAR ══════ */
.agos-sh-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
/* Large action button for the header */
.agos-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: var(--ag-font, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all .15s ease;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    letter-spacing: -.006em;
}
.agos-action-btn:disabled {
    opacity: .45;
    pointer-events: none;
}
.agos-action-btn:active {
    transform: translateY(1px);
}

/* Variants */
.agos-action-btn--success {
    background: var(--ag-success, #22C55E);
    color: #fff;
    box-shadow: 0 1px 3px rgba(22,163,74,.25);
}
.agos-action-btn--success:hover {
    background: #15803D;
    box-shadow: 0 3px 8px rgba(22,163,74,.25);
    transform: translateY(-1px);
}
.agos-action-btn--danger {
    background: var(--ag-danger, #DC2626);
    color: #fff;
    box-shadow: 0 1px 3px rgba(220,38,38,.25);
}
.agos-action-btn--danger:hover {
    background: #B91C1C;
    box-shadow: 0 3px 8px rgba(220,38,38,.25);
    transform: translateY(-1px);
}
.agos-action-btn--primary {
    background: var(--ag-accent, #2563EB);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37,99,235,.25);
}
.agos-action-btn--primary:hover {
    background: var(--ag-accent-hover, #1D4ED8);
    box-shadow: 0 3px 8px rgba(37,99,235,.25);
    transform: translateY(-1px);
}
.agos-action-btn--secondary {
    background: #F1F5F9;
    color: var(--ag-text, #1E293B);
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.agos-action-btn--secondary:hover {
    background: #E2E8F0;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
.agos-action-btn--warning {
    background: var(--ag-warning, #F59E0B);
    color: #fff;
    box-shadow: 0 1px 3px rgba(245,158,11,.25);
}
.agos-action-btn--warning:hover {
    background: #D97706;
    box-shadow: 0 3px 8px rgba(245,158,11,.25);
    transform: translateY(-1px);
}

/* ══════ 4. UNIFIED BUTTON OVERRIDES ══════
   Make ALL button systems visually identical:
   rounded (10px), filled, consistent sizing.
   Targets: .agos-btn, .agos-dbtn, .ag-c-btn
   ══════════════════════════════════════════ */

/* Unify border-radius across all button systems */
.agos-detail .agos-btn,
.agos-detail .agos-dbtn,
.agos-detail .ag-c-btn,
.agos-detail .agos-pd-state-opt,
.agos-detail button[class*="agos-btn"],
.agos-detail button[class*="agos-dbtn"] {
    border-radius: 10px;
    font-family: var(--ag-font, system-ui, sans-serif);
    letter-spacing: -.006em;
    transition: all .15s ease;
}

/* Focus ring for accessibility */
.agos-detail .agos-btn:focus-visible,
.agos-detail .agos-dbtn:focus-visible,
.agos-detail .ag-c-btn:focus-visible,
.agos-detail .agos-action-btn:focus-visible {
    outline: 2px solid var(--ag-accent, #2563EB);
    outline-offset: 2px;
}

/* ══════ 5. ACCORDION COMPONENT ══════ */
.agos-accordion {
    background: #fff;
    border: 1px solid var(--ag-border-subtle, #f0f1f4);
    border-radius: var(--ag-radius, 10px);
    overflow: hidden;
    margin-bottom: 12px;
}
.agos-accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: var(--ag-text, #1e293b);
    text-align: left;
    font-family: var(--ag-font, system-ui, sans-serif);
    transition: background .15s;
}
.agos-accordion-trigger:hover {
    background: var(--ag-bg, #f7f8fa);
}
.agos-accordion-chevron {
    width: 18px;
    height: 18px;
    color: var(--ag-text-tertiary, #94a3b8);
    transition: transform .2s ease;
    flex-shrink: 0;
}
.agos-accordion.open .agos-accordion-chevron {
    transform: rotate(180deg);
}
.agos-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}
.agos-accordion.open .agos-accordion-body {
    max-height: 2000px; /* large enough for any content */
}
.agos-accordion-inner {
    padding: 0 18px 16px;
}

/* ══════ 6. ENHANCED ADMIN BADGES ══════ */
.agos-sh-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: .01em;
}
.agos-sh-badge--neutral { background: #F1F5F9; color: #475569; }
.agos-sh-badge--active  { background: #EDE9FE; color: #5B21B6; }
.agos-sh-badge--review  { background: #DCFCE7; color: #166534; }
.agos-sh-badge--warning { background: #FEF3C7; color: #92400E; }
.agos-sh-badge--danger  { background: #FEE2E2; color: #991B1B; }
.agos-sh-badge--done    { background: #DCFCE7; color: #166534; }
.agos-sh-badge--express { background: #FFFBEB; color: #B45309; }
.agos-sh-badge--vip     { background: #FDF2F8; color: #9D174D; }

/* ══════ 7. ASSIGNMENT CALLOUT ══════ */
.agos-assign-callout {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border: 2px solid var(--ag-accent, #2563EB);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}
.agos-assign-callout h4 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
    color: var(--ag-accent, #2563EB);
}
.agos-assign-callout p {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--ag-text-secondary, #6b7280);
}
.agos-assign-callout .agos-select {
    margin-bottom: 10px;
    width: 100%;
    max-width: 300px;
}

/* ══════ 8. DANGER ZONE — accordion style ══════ */
.agos-danger-accordion {
    border-color: #FEE2E2;
}
.agos-danger-accordion .agos-accordion-trigger {
    color: var(--ag-danger, #DC2626);
}
.agos-danger-accordion .agos-accordion-trigger:hover {
    background: #FEF2F2;
}

/* ══════ 9. RESPONSIVE ══════ */
@media (max-width: 782px) {
    .agos-sh-top { flex-direction: column; align-items: flex-start; }
    .agos-sh-right { width: 100%; }
    .agos-sh-actions { width: 100%; }
    .agos-action-btn { flex: 1; min-width: 0; justify-content: center; font-size: 12px; padding: 8px 14px; min-height: 38px; }
    .agos-sh-title { max-width: 200px; font-size: 15px; }
}

@media (max-width: 480px) {
    .agos-sh-actions { flex-direction: column; }
    .agos-action-btn { width: 100%; }
}

/* ══════ 10. ADMIN SELF-ASSIGNED INDICATOR ══════ */
.agos-self-assigned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    background: #EDE9FE;
    color: #5B21B6;
    white-space: nowrap;
}

/* ══════ 11. OLD HERO BAR HIDE ══════
   When sticky header is present, hide the old hero bar to avoid duplication */
.agos-detail.agos-v2-layout .agos-pd-hero {
    display: none;
}
/* Also hide the old pills bar — info is in sticky header + stepper */
.agos-detail.agos-v2-layout > .agos-pd-pills {
    display: none;
}

/* ══════ 12. UNIFIED ADMIN ACCORDION (v9.3.46) ══════
   Extends portal.css ag-d-details to admin context.
   Pattern: <details class="ag-d-details agos-card"> */

/* Body wrapper — generic content padding */
.ag-d-details-body {
    padding: 20px 28px 24px;
    animation: agosDetailOpen .2s ease-out;
}

@keyframes agosDetailOpen {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Badge (count) — inline with summary text */
.ag-d-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--ag-accent-subtle, #EFF6FF);
    color: var(--ag-accent, #2563EB);
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    line-height: 1;
}

/* Value badge (e.g. Finance amount) */
.ag-d-badge-val {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--ag-success, #16A34A);
}

/* Summary: flex layout for badge alignment */
.ag-d-details-summary {
    display: flex;
    align-items: center;
    min-height: 44px; /* touch target */
}

/* Danger zone variant */
.ag-d-details--danger > .ag-d-details-summary {
    color: var(--ag-danger, #DC2626);
}
.ag-d-details--danger[open] > .ag-d-details-summary {
    border-bottom-color: rgba(220,38,38,.15);
}

/* Hide old admin card styles when using ag-d-details */
.ag-d-details.agos-card .agos-pd-card-head,
.ag-d-details.agos-card .agos-pd-card-body {
    /* Reset old card inner styling */
}

/* Sidebar: tighter spacing */
.agos-pd-aside .ag-d-details {
    margin-bottom: 12px;
}
.agos-pd-aside .ag-d-details-summary {
    padding: 14px 20px;
    font-size: 12px;
}
.agos-pd-aside .ag-d-details-body {
    padding: 16px 20px 20px;
}

/* Collapse/Expand all toggle */
.ag-d-toggle-all {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}
.ag-d-toggle-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: none;
    color: var(--ag-text-tertiary, #9CA3AF);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all .15s;
}
.ag-d-toggle-all-btn:hover {
    color: var(--ag-text-secondary, #6B7280);
    background: var(--ag-bg, #F8FAFC);
}
.ag-d-toggle-all-btn svg {
    transition: transform .15s;
}

/* Chat section inside details — keep tabs functional */
.ag-d-details .agos-chat-tabs {
    margin: -20px -28px 16px;
    padding: 0 28px;
    border-bottom: 1px solid var(--ag-border-subtle, #E5E7EB);
}

/* Override old accordion styles (backward compat) */
.agos-detail .agos-accordion-trigger,
.agos-detail .agos-accordion-chevron,
.agos-detail .agos-accordion-body,
.agos-detail .agos-accordion-inner {
    /* Neutralize if any old markup remains */
    all: unset;
    display: contents;
}

/* ── Admin accordion responsive ── */
@media (max-width: 782px) {
    .ag-d-details-body {
        padding: 16px 20px 20px;
    }
    .ag-d-details-summary {
        padding: 14px 20px;
    }
    .ag-d-details .agos-chat-tabs {
        margin: -16px -20px 12px;
        padding: 0 20px;
    }
}

@media (max-width: 480px) {
    .ag-d-details-body {
        padding: 14px 16px 16px;
    }
    .ag-d-details-summary {
        padding: 12px 16px;
        font-size: 12px;
    }
}
