/* =========================================
   Order Detail Modal — eBay CMS Dashboard
   ========================================= */

.order-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalOverlayIn 0.2s ease;
    padding: 20px;
}

@keyframes modalOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.order-modal {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.25s ease;
    border: 1px solid var(--border-color);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.order-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.order-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.order-modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.order-modal-body {
    padding: 20px 24px 24px;
}

.order-detail-section {
    margin-bottom: 20px;
}

.order-detail-section:last-child {
    margin-bottom: 0;
}

.order-detail-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.order-detail-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.order-detail-field.full-width {
    grid-column: 1 / -1;
}

.order-detail-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.order-detail-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
}

.order-detail-value.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.order-detail-value.price {
    color: var(--green);
    font-weight: 700;
    font-size: 1rem;
}

.order-detail-value.total-price {
    color: var(--green);
    font-weight: 800;
    font-size: 1.15rem;
}

.order-price-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.order-price-breakdown .price-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.order-price-breakdown .price-plus {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.order-price-breakdown .price-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green);
    margin-left: auto;
}

.order-detail-address {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--hover-bg);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.order-detail-note {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: #fef3c7;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #fde68a;
}

/* Dark mode note */
@media (prefers-color-scheme: dark) {
    .order-detail-note {
        background: rgba(245, 158, 11, 0.1);
        border-color: rgba(245, 158, 11, 0.2);
    }
}

/* Mobile */
@media (max-width: 640px) {
    .order-modal {
        max-height: 90vh;
        border-radius: 12px;
    }

    .order-detail-grid {
        grid-template-columns: 1fr;
    }

    .order-modal-header {
        padding: 16px 18px 12px;
    }

    .order-modal-body {
        padding: 16px 18px 20px;
    }
}

/* =========================================
   Generic Modal Overlay (Account History etc.)
   ========================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px 24px;
}

/* Event Timeline */
.event-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    transition: background 0.15s;
}

.event-timeline-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

.event-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.event-content {
    flex: 1;
    min-width: 0;
}

.event-summary {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.event-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.event-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 0;
    font-size: 0.9rem;
}

/* Accent Red KPI Card */
.kpi-card.accent-red .kpi-value {
    color: var(--red, #ef4444);
}

.kpi-card.accent-red {
    border-left: 3px solid var(--red, #ef4444);
}

/* Badge Danger */
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Activity dot for events */
.activity-dot.event {
    background: var(--purple, #a855f7);
}

/* Date Range Picker */
.top-bar-right {
    position: relative;
}

.date-range-picker {
    display: none;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--bg-card, #1a1d2e);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    animation: slideDown 0.2s ease;
}

.date-range-picker.show {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.date-range-picker input[type="date"] {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.15s;
}

.date-range-picker input[type="date"]:focus {
    border-color: var(--primary, #6366f1);
}

.date-range-picker .date-range-apply {
    background: var(--primary, #6366f1);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.date-range-picker .date-range-apply:hover {
    opacity: 0.9;
}