/* Order Details Styles - Shared */

.order-reference-display {
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.order-reference-display h1 {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    margin: 0.5rem 0;
    user-select: all;
}

.copy-button {
    font-size: 1.1rem;
}

/* Modern summary header (Buy order) */
.order-reference-display.order-summary {
    text-align: left;
    padding: 1.1rem 1.25rem;
}

.order-summary-grid {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

.order-summary-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(var(--bs-info-rgb), 0.12);
    color: rgba(var(--bs-info-rgb), 0.95);
    flex: 0 0 auto;
}

html[data-theme="darkly"] .order-summary-icon {
    background: rgba(var(--bs-info-rgb), 0.18);
}

.order-summary-label {
    font-size: 0.85rem;
    color: rgba(var(--bs-body-color-rgb), 0.65);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.order-summary-ref-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.order-summary-ref {
    font-family: 'Courier New', monospace;
    font-weight: 800;
    line-height: 1.05;
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    user-select: all;
    color: rgba(var(--bs-primary-rgb), 0.92);
}

.sell-order-detail .order-summary-icon {
    background: rgba(var(--bs-warning-rgb), 0.14);
    color: rgba(var(--bs-warning-rgb), 0.95);
}

html[data-theme="darkly"] .sell-order-detail .order-summary-icon {
    background: rgba(var(--bs-warning-rgb), 0.18);
}

.sell-order-detail .order-summary-ref {
    color: rgba(var(--bs-warning-rgb), 0.92);
}

.sell-order-detail .order-summary-chip-copy {
    color: rgba(var(--bs-warning-rgb), 0.9);
}

.sell-order-detail .order-summary-chip-copy:hover {
    color: rgba(var(--bs-warning-rgb), 1);
}

.order-summary-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.35rem;
}

.order-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(var(--bs-body-color-rgb), 0.85);
    font-size: 0.95rem;
}

.order-summary-chip-label {
    font-size: 0.85rem;
    color: rgba(var(--bs-body-color-rgb), 0.65);
}

.order-summary-chip-copy {
    color: rgba(var(--bs-info-rgb), 0.9);
    text-decoration: none;
}

.order-summary-chip-copy:hover {
    color: rgba(var(--bs-primary-rgb), 0.95);
}

.order-summary-sep {
    color: rgba(var(--bs-body-color-rgb), 0.35);
}

.order-summary-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

@media (max-width: 767.98px) {
    .order-reference-display.order-summary {
        padding: 1rem;
    }

    .order-summary-grid {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "icon main"
            "actions actions";
        align-items: start;
    }

    .order-summary-icon {
        grid-area: icon;
    }

    .order-summary-main {
        grid-area: main;
    }

    .order-summary-actions {
        grid-area: actions;
        justify-content: flex-start;
        padding-top: 0.25rem;
    }
}

/* Buy Order Details */
.buy-order-detail .order-reference-display {
    background: linear-gradient(135deg, #eef2ff, #e0f2fe);
    border: 1px solid #cbd5e1;
}

.buy-order-detail .order-reference-display h1 {
    color: #1d4ed8;
}

html[data-theme="darkly"] .buy-order-detail .order-reference-display {
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.12), rgba(var(--bs-info-rgb), 0.12));
    border-color: rgba(var(--bs-info-rgb), 0.35);
}

html[data-theme="darkly"] .buy-order-detail .order-reference-display h1 {
    color: rgba(var(--bs-primary-rgb), 0.92);
}

/* Sell Order Details */
.sell-order-detail .order-reference-display {
    background: linear-gradient(135deg, #fff7ed, #f0fdf4);
    border: 1px solid #fed7aa;
}

.sell-order-detail .order-reference-display h1 {
    color: #b45309;
}

html[data-theme="darkly"] .sell-order-detail .order-reference-display {
    background: linear-gradient(135deg, rgba(var(--bs-warning-rgb), 0.12), rgba(var(--bs-success-rgb), 0.12));
    border-color: rgba(var(--bs-warning-rgb), 0.35);
}

html[data-theme="darkly"] .sell-order-detail .order-reference-display h1 {
    color: rgba(var(--bs-warning-rgb), 0.9);
}

/* Status badges to mirror main ledger palette */
.order-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #ffffff;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.95rem;
}

.order-status-badge .status-icon {
    color: inherit;
}

.order-status-badge.status-awaiting_validation {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
}

.order-status-badge.status-validated {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #075985;
}

.order-status-badge.status-accepted {
    background: #e0f2fe;
    border-color: #60a5fa;
    color: #1d4ed8;
}

.order-status-badge.status-completed {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.order-status-badge.status-draft {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
}

.order-status-badge.status-rejected {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.order-status-badge.status-anomaly,
.order-status-badge.status-anomaly_rejected {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.order-status-badge.status-cancelled {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #475569;
}

/* Timeline styles for order details */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 0;
    bottom: -2rem;
    width: 2px;
    background: var(--bs-secondary);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-icon {
    position: absolute;
    left: -40px;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.timeline-icon.completed {
    background: var(--bs-success);
    color: white;
}

.timeline-icon.pending {
    background: var(--bs-secondary);
    color: white;
}

.info-box {
    border-left: 4px solid var(--bs-info);
    padding: 1.5rem;
    border-radius: 0.375rem;
}

html[data-theme="darkly"] .info-box {
    background: rgba(var(--bs-info-rgb), 0.08);
}

.sell-order-detail .me-how-this-works-attention {
    position: relative;
    overflow: hidden;
}

.sell-order-detail .me-how-this-works-attention::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -45%;
    width: 35%;
    pointer-events: none;
    background: linear-gradient(
        110deg,
        rgba(var(--bs-info-rgb), 0),
        rgba(var(--bs-info-rgb), 0.24),
        rgba(var(--bs-info-rgb), 0)
    );
    animation: meHowThisWorksShine 1s ease-in-out 2;
}

@keyframes meHowThisWorksShine {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(420%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sell-order-detail .me-how-this-works-attention {
        animation: none;
    }

    .sell-order-detail .me-how-this-works-attention::after {
        animation: none;
    }
}

.contract-instructions {
    border-left: 4px solid var(--bs-info);
    padding: 1.5rem;
    border-radius: 0.375rem;
}

.contract-instructions ol {
    margin-bottom: 0;
}

.contract-instructions li {
    margin-bottom: 0.75rem;
}

html[data-theme="darkly"] .contract-instructions {
    background: rgba(var(--bs-info-rgb), 0.08);
}

/* Bootstrap utility classes overrides */
html[data-theme="darkly"] .bg-body-tertiary,
html[data-theme="darkly"] .bg-body-secondary,
html[data-theme="darkly"] .bg-light,
html[data-theme="darkly"] .bg-white {
    background-color: #303030 !important;
}

html[data-theme="darkly"] [class*="subtle"] {
    background-color: #303030 !important;
}

.order-notes-card {
    border-left: 4px solid rgba(var(--bs-secondary-rgb), 0.9);
}

.order-notes-card .order-notes-header {
    border-bottom: 1px solid rgba(var(--bs-body-color-rgb), 0.08);
}

.order-notes-card.order-notes-alert {
    border-left-color: rgba(var(--bs-warning-rgb), 0.95);
    background: rgba(var(--bs-warning-rgb), 0.08);
}

.order-notes-card.order-notes-success {
    border-left-color: rgba(var(--bs-success-rgb), 0.95);
    background: rgba(var(--bs-success-rgb), 0.08);
}

.order-notes-card.order-notes-neutral {
    border-left-color: rgba(var(--bs-info-rgb), 0.9);
    background: rgba(var(--bs-info-rgb), 0.06);
}

.order-notes-card .order-notes-body {
    padding-top: 0.9rem;
}

.order-notes-card .order-notes-text {
    white-space: normal;
    color: rgba(var(--bs-body-color-rgb), 0.95);
    line-height: 1.45;
}

.sell-order-detail .order-notes-card.order-notes-attention {
    position: relative;
    overflow: hidden;
    animation: meOrderNotesPulse 1s ease-in-out 2;
}

.sell-order-detail .order-notes-card.order-notes-attention::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -45%;
    width: 35%;
    pointer-events: none;
    background: linear-gradient(
        110deg,
        rgba(var(--bs-warning-rgb), 0),
        rgba(var(--bs-warning-rgb), 0.28),
        rgba(var(--bs-warning-rgb), 0)
    );
    animation: meOrderNotesShine 0.95s ease-in-out 2;
}

@keyframes meOrderNotesPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--bs-warning-rgb), 0);
    }
    40% {
        box-shadow: 0 0 0 4px rgba(var(--bs-warning-rgb), 0.22);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--bs-warning-rgb), 0);
    }
}

@keyframes meOrderNotesShine {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(420%);
    }
}

html[data-theme="darkly"] .order-notes-card {
    border-left-color: rgba(var(--bs-secondary-rgb), 0.85);
}

html[data-theme="darkly"] .order-notes-card.order-notes-alert {
    background: rgba(var(--bs-warning-rgb), 0.12);
}

html[data-theme="darkly"] .order-notes-card.order-notes-success {
    background: rgba(var(--bs-success-rgb), 0.12);
}

html[data-theme="darkly"] .order-notes-card.order-notes-neutral {
    background: rgba(var(--bs-info-rgb), 0.1);
}

@media (prefers-reduced-motion: reduce) {
    .sell-order-detail .order-notes-card.order-notes-attention {
        animation: none;
    }

    .sell-order-detail .order-notes-card.order-notes-attention::after {
        animation: none;
    }
}
