/* =========================================================
   BRAVO CRM — ORDERS LIST, ORDER DETAIL & SHARED STATUSES
   ========================================================= */

/* -------------------------------------------------------
   SHARED: ORDER STATUS BADGES
-------------------------------------------------------- */

.order-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: rgba(100,116,139,.08);
    color: #475569;
    border: 1px solid rgba(100,116,139,.18);
    white-space: nowrap;
}

.order-status--lg {
    font-size: 13px;
    padding: 7px 16px;
}

.order-status--completed {
    background: rgba(34,197,94,.09);
    color: #15803d;
    border-color: rgba(34,197,94,.22);
}

.order-status--processing {
    background: rgba(37,99,235,.09);
    color: #1d4ed8;
    border-color: rgba(37,99,235,.22);
}

.order-status--awaiting {
    background: rgba(245,158,11,.09);
    color: #b45309;
    border-color: rgba(245,158,11,.22);
}

.order-status--pending {
    background: rgba(99,102,241,.09);
    color: #4f46e5;
    border-color: rgba(99,102,241,.22);
}

.order-status--failed {
    background: rgba(239,68,68,.09);
    color: #b91c1c;
    border-color: rgba(239,68,68,.22);
}

.order-status--cancelled {
    background: rgba(100,116,139,.08);
    color: #64748b;
    border-color: rgba(100,116,139,.18);
}


/* -------------------------------------------------------
   ORDERS LIST PAGE
-------------------------------------------------------- */

.orders-page {
    max-width: 1150px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.orders-page__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.orders-page__kicker {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
}

.orders-page__title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 4px;
    letter-spacing: -.01em;
}

.orders-page__subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}


/* -------------------------------------------------------
   FILTER BAR
-------------------------------------------------------- */

.orders-filter {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid rgba(15,23,42,.10);
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 2px 10px rgba(15,23,42,.05);
}

.orders-filter__input,
.orders-filter__select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15,23,42,.10);
    font-size: 13px;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.orders-filter__input {
    flex: 1;
    min-width: 200px;
}

.orders-filter__input:focus,
.orders-filter__select:focus {
    border-color: rgba(242,135,57,.45);
    box-shadow: 0 0 0 3px rgba(242,135,57,.12);
    background: var(--surface);
}


/* -------------------------------------------------------
   ORDERS LIST CONTAINER
-------------------------------------------------------- */

.orders-list {
    background: var(--surface);
    border: 1px solid rgba(15,23,42,.10);
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(15,23,42,.06), 0 1px 4px rgba(15,23,42,.04);
    overflow: hidden;
}


/* -------------------------------------------------------
   ORDER ROW (grid)
-------------------------------------------------------- */

.order-row {
    display: grid;
    grid-template-columns: 160px 130px 1fr 1fr 150px 90px;
    align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(15,23,42,.06);
    gap: 12px;
    transition: background .15s ease;
}

.order-row:last-child { border-bottom: none; }

.order-row:not(.order-row--head):hover {
    background: #f8fafc;
}

.order-row--head {
    background: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(15,23,42,.08);
}

/* Type cell */
.order-row__type {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-row__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f1f5f9;
}

.order-row__icon svg { stroke: #64748b; }

.order-row__icon--buy    { background: rgba(34,197,94,.10); }
.order-row__icon--buy svg { stroke: #16a34a; }

.order-row__icon--sell   { background: rgba(239,68,68,.10); }
.order-row__icon--sell svg { stroke: #dc2626; }

.order-row__icon--convert { background: rgba(99,102,241,.10); }
.order-row__icon--convert svg { stroke: #6366f1; }

.order-row__icon--send   { background: rgba(245,158,11,.10); }
.order-row__icon--send svg { stroke: #d97706; }

.order-row__icon--receive { background: rgba(14,165,233,.10); }
.order-row__icon--receive svg { stroke: #0284c7; }

.order-row__type-label {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.order-row__date {
    font-size: 13px;
    color: #64748b;
}

.order-row__amount {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.order-row__value {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    font-family: ui-monospace, monospace;
}

.order-row__currency {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

.order-row__detail {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    white-space: nowrap;
}

.order-row__detail:hover { text-decoration: underline; }


/* -------------------------------------------------------
   ORDERS EMPTY STATE
-------------------------------------------------------- */

.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 64px 20px;
}

.orders-empty__text {
    font-size: 15px;
    color: #64748b;
}


/* -------------------------------------------------------
   RESPONSIVE — ORDERS LIST
-------------------------------------------------------- */

@media (max-width: 900px) {
    .order-row {
        grid-template-columns: 120px 100px 1fr 1fr 110px 80px;
        padding: 12px 16px;
    }
}

@media (max-width: 640px) {
    .order-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 8px;
        padding: 14px 16px;
    }

    .order-row--head { display: none; }

    .order-row__type { grid-column: 1 / 2; }
    .order-row__date { grid-column: 2 / 3; justify-self: flex-end; font-size: 12px; }
    .order-row__amount { grid-column: 1 / 2; }
    .order-row > div:nth-child(4) { grid-column: 2 / 3; justify-self: flex-end; }
    .order-row > div:nth-child(5) { grid-column: 1 / 2; }
    .order-row > div:nth-child(6) { grid-column: 2 / 3; justify-self: flex-end; }
}


/* -------------------------------------------------------
   ORDER DETAIL PAGE
-------------------------------------------------------- */

.order-detail {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.order-detail__back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    transition: color .15s ease;
}

.order-detail__back-link:hover { color: #0f172a; }

/* Header card */
.order-detail__head-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid rgba(15,23,42,.11);
    border-radius: 18px;
    padding: 24px 28px;
    box-shadow: 0 4px 20px rgba(15,23,42,.07), 0 1px 4px rgba(15,23,42,.04);
}

.order-detail__head-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Big type icon */
.order-detail__icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f1f5f9;
}

.order-detail__icon svg { stroke: #64748b; }

.order-detail__icon--buy    { background: rgba(34,197,94,.12); }
.order-detail__icon--buy svg { stroke: #16a34a; }

.order-detail__icon--sell   { background: rgba(239,68,68,.12); }
.order-detail__icon--sell svg { stroke: #dc2626; }

.order-detail__icon--convert { background: rgba(99,102,241,.12); }
.order-detail__icon--convert svg { stroke: #6366f1; }

.order-detail__icon--send   { background: rgba(245,158,11,.12); }
.order-detail__icon--send svg { stroke: #d97706; }

.order-detail__icon--receive { background: rgba(14,165,233,.12); }
.order-detail__icon--receive svg { stroke: #0284c7; }

.order-detail__head-label {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -.01em;
}

.order-detail__head-id {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Two-column grid */
.order-detail__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 720px) {
    .order-detail__grid { grid-template-columns: 1fr; }
}

/* Info card */
.order-detail__card {
    background: var(--surface);
    border: 1px solid rgba(15,23,42,.11);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(15,23,42,.07), 0 1px 4px rgba(15,23,42,.04);
}

.order-detail__card--full {
    grid-column: 1 / -1;
}

.order-detail__card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(15,23,42,.07);
}

.order-detail__card-title svg { color: #64748b; }

/* Data table */
.order-detail__table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-detail__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
}

.order-detail__row-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 120px;
}

.order-detail__row-label--strong { color: #0f172a; font-weight: 700; }
.order-detail__row-label--red    { color: #b91c1c; }

.order-detail__row-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
    text-align: right;
}

.order-detail__row-value--big    { font-size: 16px; font-weight: 700; }
.order-detail__row-value--strong { font-weight: 700; font-size: 15px; }
.order-detail__row-value--green  { color: #15803d; }
.order-detail__row-value--red    { color: #b91c1c; font-size: 12px; }
.order-detail__row-value--mono   { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; text-align: right; }

.order-detail__currency {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
}

.order-detail__divider {
    height: 1px;
    background: rgba(15,23,42,.07);
    margin: 8px 0;
}

.order-detail__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(15,23,42,.05);
    color: #334155;
    border: 1px solid rgba(15,23,42,.08);
}

.order-detail__badge--muted {
    color: #94a3b8;
    background: transparent;
    border-color: transparent;
}

.order-detail__note {
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
    margin: 0;
}

.order-detail__action {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(15,23,42,.07);
}


/* -------------------------------------------------------
   ORDER TIMELINE
-------------------------------------------------------- */

.order-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 8px;
}

.order-timeline__item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
    padding-bottom: 24px;
}

.order-timeline__item:last-child { padding-bottom: 0; }

.order-timeline__item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: 0;
    width: 2px;
    background: rgba(15,23,42,.08);
}

.order-timeline__dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #e2e8f0;
    border: 2px solid #cbd5e1;
    position: relative;
    z-index: 1;
}

.order-timeline__dot--done {
    background: #22c55e;
    border-color: #16a34a;
}

.order-timeline__dot--active {
    background: #3b82f6;
    border-color: #2563eb;
    animation: timeline-pulse 1.8s ease-in-out infinite;
}

.order-timeline__dot--fail {
    background: #ef4444;
    border-color: #dc2626;
}

@keyframes timeline-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,.4); }
    50%       { box-shadow: 0 0 0 6px rgba(59,130,246,0); }
}

.order-timeline__body { padding-top: 4px; }

.order-timeline__label {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.order-timeline__time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}


/* -------------------------------------------------------
   DARK THEME — ORDERS
-------------------------------------------------------- */

:root.theme-dark .orders-page__kicker   { color: var(--muted-2); }
:root.theme-dark .orders-page__title    { color: var(--text); }
:root.theme-dark .orders-page__subtitle { color: var(--muted); }

:root.theme-dark .orders-filter {
    background: var(--surface);
    border-color: var(--border);
}
:root.theme-dark .orders-filter__input,
:root.theme-dark .orders-filter__select {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
:root.theme-dark .orders-filter__input:focus,
:root.theme-dark .orders-filter__select:focus { background: var(--surface); }

:root.theme-dark .orders-list {
    background: var(--surface);
    border-color: var(--border);
}

:root.theme-dark .order-row { border-bottom-color: var(--border-soft); }
:root.theme-dark .order-row:not(.order-row--head):hover { background: var(--surface-2); }
:root.theme-dark .order-row--head {
    background: var(--surface-2);
    color: var(--muted-2);
    border-bottom-color: var(--border);
}
:root.theme-dark .order-row__icon     { background: var(--surface-3); }
:root.theme-dark .order-row__icon svg { stroke: var(--muted); }
:root.theme-dark .order-row__type-label { color: var(--text); }
:root.theme-dark .order-row__date     { color: var(--muted); }
:root.theme-dark .order-row__value    { color: var(--text); }
:root.theme-dark .order-row__currency { color: var(--muted); }
:root.theme-dark .order-row__detail   { color: var(--link); }
:root.theme-dark .orders-empty__text  { color: var(--muted); }

:root.theme-dark .order-detail__back-link       { color: var(--muted); }
:root.theme-dark .order-detail__back-link:hover { color: var(--text); }
:root.theme-dark .order-detail__head-card { background: var(--surface); border-color: var(--border); }
:root.theme-dark .order-detail__card      { background: var(--surface); border-color: var(--border); }
:root.theme-dark .order-detail__icon      { background: var(--surface-3); }
:root.theme-dark .order-detail__head-label { color: var(--text); }
:root.theme-dark .order-detail__head-id   { color: var(--muted-2); }
:root.theme-dark .order-detail__card-title { color: var(--text); border-bottom-color: var(--border-soft); }
:root.theme-dark .order-detail__card-title svg { color: var(--muted); }
:root.theme-dark .order-detail__row-label         { color: var(--muted-2); }
:root.theme-dark .order-detail__row-label--strong { color: var(--text); }
:root.theme-dark .order-detail__row-value         { color: var(--text); }
:root.theme-dark .order-detail__currency          { color: var(--muted-2); }
:root.theme-dark .order-detail__divider           { background: var(--border-soft); }
:root.theme-dark .order-detail__note              { color: var(--text-2); }
:root.theme-dark .order-detail__badge {
    background: var(--surface-3);
    color: var(--text-2);
    border-color: var(--border-soft);
}

:root.theme-dark .order-timeline__item:not(:last-child)::after { background: var(--border); }
:root.theme-dark .order-timeline__dot { background: var(--surface-3); border-color: var(--border); }
:root.theme-dark .order-timeline__dot--done {
    background: #0ecb81;
    border-color: #07a567;
}
:root.theme-dark .order-timeline__dot--active {
    background: #f0b90b;
    border-color: #d4a009;
    animation: timeline-pulse-gold 1.8s ease-in-out infinite;
}
@keyframes timeline-pulse-gold {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240,185,11,.5); }
    50%       { box-shadow: 0 0 0 8px rgba(240,185,11,0); }
}
:root.theme-dark .order-timeline__label { color: var(--text); }
:root.theme-dark .order-timeline__time  { color: var(--muted-2); }

