/* ============================================
   Order Display Styles
   Shared styles for order confirmation and details pages
   ============================================ */

/* ============================================
   Order Card Component
   ============================================ */

.order-card {
    background: #fff;
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.order-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--site-secondary, #597d35);
    color: #fff;
}

.order-card-header h4,
.order-card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
}

.order-card-header .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.order-card-header .order-number {
    margin-left: auto;
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Simple Header Variant - Larger, Left Aligned */
.order-card-header.order-card-header-simple {
    justify-content: flex-start;
    padding: 1.5rem;
}

.order-card-header.order-card-header-simple h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

/* Order Details Grid */
.order-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.order-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-detail-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.order-detail-value {
    font-size: 0.95rem;
    color: #212529;
}

@media (max-width: 576px) {
    .order-details-grid {
        grid-template-columns: 1fr;
    }

    .order-card-header.order-card-header-simple h2 {
        font-size: 1.25rem;
    }
}

.order-card-body {
    padding: 0;
}

.order-card-body.padded {
    padding: 1.5rem;
}

.order-card-footer {
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* ============================================
   Order Item Row
   ============================================ */

.order-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}

.order-item:last-child {
    border-bottom: none;
}

/* Item Image */
.item-image {
    width: 60px;
    height: 60px;
    border-radius: 0.375rem;
    object-fit: cover;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    flex-shrink: 0;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.375rem;
}

/* Item Details */
.item-details {
    flex: 1;
}

.item-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.item-meta {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Download Link (matches delivery email style) */
.download-link {
    color: var(--site-primary, #355dff);
    font-size: 0.875rem;
    text-decoration: none;
}

.download-link:hover {
    text-decoration: underline;
}

/* Product download button — primary call-to-action op confirmation page */
.download-product-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Item Price */
.item-price {
    text-align: right;
    flex-shrink: 0;
}

.item-price .total {
    font-weight: 600;
}

.item-price .unit {
    color: #6c757d;
    font-size: 0.875rem;
}

/* ============================================
   Totals Section
   ============================================ */

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.totals-row.grand-total {
    font-size: 1.1rem;
    font-weight: 600;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid #dee2e6;
}

.totals-row.grand-total .value {
    color: var(--site-primary, #355dff);
}

/* ============================================
   Info Grid & Cards
   ============================================ */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Form inputs in cards */
.order-card .form-control,
.info-card .form-control {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}

.order-card .form-control:focus,
.info-card .form-control:focus {
    background-color: #fff;
    border-color: var(--site-primary, #355dff);
}

.order-card .input-group-text,
.info-card .input-group-text {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.info-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 1rem;
}

.info-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.info-value {
    color: #333;
    margin-bottom: 1rem;
}

.info-value:last-child {
    margin-bottom: 0;
}

/* ============================================
   Status Badges
   ============================================ */

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.processing {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   Site-Themed Buttons
   ============================================ */

/* Primary button - uses primary color (blue) */
.btn-site-primary {
    background: var(--site-primary, #355dff);
    border-color: var(--site-primary, #355dff);
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-site-primary:hover,
.btn-site-primary:focus {
    background: #2a4acc;
    border-color: #2a4acc;
    color: #fff;
}

/* Secondary button - uses secondary color (green) */
.btn-site-secondary {
    background: var(--site-secondary, #597d35);
    border-color: var(--site-secondary, #597d35);
    color: #fff;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-site-secondary:hover,
.btn-site-secondary:focus {
    background: var(--site-secondary-active, #3a5311);
    border-color: var(--site-secondary-active, #3a5311);
    color: #fff;
}

/* Outline button - uses primary color */
.btn-site-outline {
    background: transparent;
    border: 1px solid var(--site-primary, #355dff);
    color: var(--site-primary, #355dff);
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-site-outline:hover {
    background: var(--site-primary, #355dff);
    color: #fff;
}

/* Outline secondary button - uses secondary color (for cancel/back) */
.btn-site-outline-secondary {
    background: transparent;
    border: 1px solid var(--site-secondary, #597d35);
    color: var(--site-secondary, #597d35);
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-site-outline-secondary:hover {
    background: var(--site-secondary, #597d35);
    color: #fff;
}

/* ============================================
   Orders Table - Index Page
   Clean, scannable table layout for order history
   ============================================ */

.orders-table-container {
    background: #fff;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.orders-table {
    margin-bottom: 0;
    width: 100%;
}

.orders-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.orders-table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 1rem 1.25rem;
    white-space: nowrap;
    border: none;
}

.orders-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
}

.orders-table tbody tr:last-child {
    border-bottom: none;
}

.orders-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Clickable Row Styling */
.orders-table tbody tr.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    border-left: 3px solid transparent;
}

.orders-table tbody tr.clickable-row:hover {
    background-color: #e9f5ff;
    border-left-color: var(--site-primary, #355dff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

.orders-table tbody tr.clickable-row:focus {
    outline: 2px solid var(--site-primary, #355dff);
    outline-offset: -2px;
    background-color: #e9f5ff;
    border-left-color: var(--site-primary, #355dff);
}

.orders-table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border: none;
}

/* Order Identifier Cell */
.order-identifier {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-identifier .order-number {
    font-weight: 600;
    color: #212529;
    font-size: 0.95rem;
}

.order-identifier .order-reference {
    font-size: 0.8rem;
    color: #495057;
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
}

.order-identifier .order-date-mobile {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Status Badges - Table Design */
.order-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.order-status-badge.status-pending {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

.order-status-badge.status-awaiting-payment {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffda6a;
}

.order-status-badge.status-processing {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #9eeaf9;
}

.order-status-badge.status-completed {
    background-color: #d1e7dd;
    color: #0a3622;
    border: 1px solid #a3cfbb;
}

.order-status-badge.status-cancelled {
    background-color: #f8d7da;
    color: #58151c;
    border: 1px solid #f1aeb5;
}

/* Item Count */
.item-count {
    color: #495057;
    font-size: 0.9rem;
}

/* Order Total */
.order-total {
    font-weight: 600;
    color: #212529;
    font-size: 1.05rem;
}

.payment-type {
    margin-top: 0.125rem;
}

/* Orders Table Mobile Responsive */
@media (max-width: 767.98px) {
    .orders-table thead {
        display: none;
    }

    .orders-table tbody tr {
        display: block;
        padding: 1rem;
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        background: #fff;
    }

    .orders-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .orders-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .orders-table tbody td:last-child {
        border-bottom: none;
        padding-top: 1rem;
        justify-content: flex-end;
    }

    .orders-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 0.75rem;
        text-transform: uppercase;
    }

    .orders-table tbody td:first-child::before {
        display: none;
    }

    .orders-table tbody td:first-child {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid #e9ecef;
    }

    .order-identifier {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .order-identifier .order-number {
        font-size: 1.1rem;
    }

    .orders-table-container {
        background: transparent;
        box-shadow: none;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .orders-table thead th,
    .orders-table tbody td {
        padding: 0.875rem 1rem;
    }
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 576px) {
    .order-item {
        padding: 0.75rem 1rem;
    }

    .item-image {
        width: 50px;
        height: 50px;
    }

    .item-name {
        font-size: 0.9rem;
    }

    .totals-row.grand-total {
        font-size: 1rem;
    }
}

/* ============================================
   Orders Page Layout - Enhanced Header
   ============================================ */

/* Page Header */
.orders-page-header {
    margin-bottom: 1.5rem;
}

.orders-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.orders-title-row h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
    display: flex;
    align-items: center;
}

.user-welcome {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 2rem;
    font-size: 0.9rem;
    color: #495057;
    border: 1px solid #e9ecef;
}

/* Orders Summary */
.orders-summary {
    color: #6c757d;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.order-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    background: var(--site-primary, #355dff);
    color: #fff;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 0.25rem;
}

/* Login Prompt Card */
.orders-login-prompt {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

/* Mobile Responsive Adjustments for New Header */
@media (max-width: 767.98px) {
    .orders-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .orders-title-row h2 {
        font-size: 1.25rem;
    }

    .user-welcome {
        font-size: 0.85rem;
        padding: 0.375rem 0.75rem;
    }

    .orders-login-prompt {
        padding: 1.5rem;
    }
}
