/* ========================================
   Order Status List Component Styles
   Component: Order Status List Display
   ======================================== */

/* Plugin Wrapper - Isolation Layer */
.rwp-plugin-wrapper {
    box-sizing: border-box;
}

.rwp-plugin-wrapper *,
.rwp-plugin-wrapper *::before,
.rwp-plugin-wrapper *::after {
    box-sizing: inherit;
}

.rwp-order-status-list-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* CSS Variables for Theming */
.rwp-order-status-list {
    /* Colors */
    --rwp-osl-color-primary: #1f2a44;
    --rwp-osl-color-secondary: #4f5b76;
    --rwp-osl-color-success: #3aa76d;
    --rwp-osl-color-warning: #d1a24c;
    --rwp-osl-color-pending: #a0aec0;
    --rwp-osl-color-served: #4f5b76;
    --rwp-osl-color-text: #1f2a44;
    --rwp-osl-color-text-light: #4f5b76;
    --rwp-osl-color-text-muted: #6b7280;
    --rwp-osl-color-bg: #f8f9fb;
    --rwp-osl-color-bg-white: #ffffff;
    --rwp-osl-color-bg-light: #f4f6fb;
    --rwp-osl-color-border: #e2e8f0;
    --rwp-osl-color-border-light: #edf2f7;
    --rwp-osl-color-error: #8a1f1f;
    --rwp-osl-color-error-bg: #fde8e9;
    
    /* Spacing */
    --rwp-osl-spacing-xs: 4px;
    --rwp-osl-spacing-sm: 8px;
    --rwp-osl-spacing-md: 12px;
    --rwp-osl-spacing-lg: 16px;
    --rwp-osl-spacing-xl: 20px;
    --rwp-osl-spacing-xxl: 24px;
    
    /* Typography */
    --rwp-osl-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --rwp-osl-font-size-xs: 0.75rem;
    --rwp-osl-font-size-sm: 0.875rem;
    --rwp-osl-font-size-md: 0.9rem;
    --rwp-osl-font-size-lg: 1rem;
    --rwp-osl-font-size-xl: 1.1rem;
    --rwp-osl-font-size-xxl: 1.5rem;
    
    /* Borders */
    --rwp-osl-border-radius-sm: 4px;
    --rwp-osl-border-radius-md: 8px;
    --rwp-osl-border-radius-lg: 12px;
    --rwp-osl-border-radius-full: 999px;
    
    /* Shadows */
    --rwp-osl-shadow-sm: 0 1px 4px rgba(31, 42, 68, 0.08);
    --rwp-osl-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.05);
    --rwp-osl-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Order Status List Container */
.rwp-order-status-list {
    max-width: 1400px;
    margin: var(--rwp-osl-spacing-xl) auto;
    padding: var(--rwp-osl-spacing-xxl);
    font-family: var(--rwp-osl-font-family);
    background: var(--rwp-osl-color-bg);
    border-radius: var(--rwp-osl-border-radius-lg);
    box-shadow: var(--rwp-osl-shadow-md);
    box-sizing: border-box;
}

/* Order Status List Header */
.rwp-osl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--rwp-osl-spacing-md);
    flex-wrap: wrap;
    margin-bottom: var(--rwp-osl-spacing-xl);
    box-sizing: border-box;
}

.rwp-osl-title {
    flex: 1;
    min-width: 0;
}

.rwp-osl-title-text {
    margin: 0;
    font-size: var(--rwp-osl-font-size-xxl);
    font-weight: 600;
    color: var(--rwp-osl-color-text);
    line-height: 1.2;
}

.rwp-osl-last-updated {
    display: block;
    font-size: var(--rwp-osl-font-size-sm);
    color: var(--rwp-osl-color-text-light);
    margin-top: var(--rwp-osl-spacing-xs);
}

.rwp-osl-actions {
    flex-shrink: 0;
}

.rwp-osl-refresh-button {
    display: inline-flex;
    align-items: center;
    gap: var(--rwp-osl-spacing-sm);
    padding: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-lg);
    font-weight: 500;
    font-size: var(--rwp-osl-font-size-sm);
    border: 1px solid var(--rwp-osl-color-border);
    border-radius: var(--rwp-osl-border-radius-sm);
    background: var(--rwp-osl-color-bg-white);
    color: var(--rwp-osl-color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: var(--rwp-osl-font-family);
}

.rwp-osl-refresh-button:hover {
    background: var(--rwp-osl-color-bg-light);
    border-color: var(--rwp-osl-color-secondary);
}

.rwp-osl-refresh-button:active {
    transform: translateY(1px);
}

/* Status Message */
.rwp-osl-status-message {
    margin-bottom: var(--rwp-osl-spacing-lg);
    padding: var(--rwp-osl-spacing-md) var(--rwp-osl-spacing-lg);
    border-radius: var(--rwp-osl-border-radius-md);
    background: var(--rwp-osl-color-error-bg);
    color: var(--rwp-osl-color-error);
    font-size: var(--rwp-osl-font-size-sm);
    box-sizing: border-box;
}

.rwp-osl-status-message--error {
    background: var(--rwp-osl-color-error-bg);
    color: var(--rwp-osl-color-error);
}

/* Legend */
.rwp-osl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rwp-osl-spacing-md);
    margin-bottom: var(--rwp-osl-spacing-xl);
    font-size: var(--rwp-osl-font-size-sm);
    color: var(--rwp-osl-color-text-light);
    box-sizing: border-box;
}

.rwp-osl-legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--rwp-osl-spacing-sm);
}

.rwp-osl-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background: var(--rwp-osl-color-border);
    flex-shrink: 0;
}

.rwp-osl-legend-ready .rwp-osl-legend-dot {
    background: var(--rwp-osl-color-success);
}

.rwp-osl-legend-preparing .rwp-osl-legend-dot {
    background: var(--rwp-osl-color-warning);
}

.rwp-osl-legend-pending .rwp-osl-legend-dot {
    background: var(--rwp-osl-color-pending);
}

.rwp-osl-legend-served .rwp-osl-legend-dot {
    background: var(--rwp-osl-color-served);
}

/* Orders Container */
.rwp-osl-orders {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--rwp-osl-spacing-xl);
    box-sizing: border-box;
}

/* Order Card */
.rwp-osl-order-card {
    background: var(--rwp-osl-color-bg-white);
    border-radius: var(--rwp-osl-border-radius-lg);
    border: 1px solid var(--rwp-osl-color-border);
    box-shadow: var(--rwp-osl-shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 220px;
    box-sizing: border-box;
    overflow: hidden;
}

.rwp-osl-order-card[data-has-ready="true"] {
    border-left: 6px solid var(--rwp-osl-color-success);
}

.rwp-osl-order-card[data-has-ready="false"][data-has-preparing="true"] {
    border-left: 6px solid var(--rwp-osl-color-warning);
}

/* Card Header */
.rwp-osl-card-header {
    padding: var(--rwp-osl-spacing-lg) var(--rwp-osl-spacing-xl) var(--rwp-osl-spacing-md);
    border-bottom: 1px solid var(--rwp-osl-color-border-light);
    box-sizing: border-box;
}

.rwp-osl-card-header-title {
    margin: 0;
    font-size: var(--rwp-osl-font-size-xl);
    color: var(--rwp-osl-color-text);
    font-weight: 600;
    line-height: 1.2;
}

.rwp-osl-card-meta {
    margin-top: var(--rwp-osl-spacing-xs);
    display: flex;
    gap: var(--rwp-osl-spacing-md);
    flex-wrap: wrap;
    font-size: var(--rwp-osl-font-size-sm);
    color: var(--rwp-osl-color-text-light);
    box-sizing: border-box;
}

/* Card Summary */
.rwp-osl-card-summary {
    padding: var(--rwp-osl-spacing-md) var(--rwp-osl-spacing-xl);
    background: var(--rwp-osl-color-bg-light);
    display: flex;
    flex-wrap: wrap;
    gap: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-lg);
    font-size: var(--rwp-osl-font-size-md);
    color: var(--rwp-osl-color-text);
    box-sizing: border-box;
}

.rwp-osl-summary-pill {
    display: inline-flex;
    align-items: center;
    padding: var(--rwp-osl-spacing-xs) var(--rwp-osl-spacing-md);
    border-radius: var(--rwp-osl-border-radius-full);
    background: var(--rwp-osl-color-border);
    font-weight: 500;
    font-size: var(--rwp-osl-font-size-sm);
    box-sizing: border-box;
}

.rwp-osl-summary-pill[data-status="ready"] {
    background: rgba(58, 167, 109, 0.15);
    color: #216948;
}

.rwp-osl-summary-pill[data-status="preparing"] {
    background: rgba(209, 162, 76, 0.2);
    color: #8c5a1d;
}

.rwp-osl-summary-pill[data-status="pending"] {
    background: rgba(160, 174, 192, 0.25);
    color: #364152;
}

.rwp-osl-summary-pill[data-status="served"] {
    background: rgba(79, 91, 118, 0.2);
    color: #2d3748;
}

/* Items Container */
.rwp-osl-items {
    padding: var(--rwp-osl-spacing-lg) var(--rwp-osl-spacing-xl) var(--rwp-osl-spacing-xl);
    flex: 1;
    box-sizing: border-box;
}

.rwp-osl-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--rwp-osl-font-size-md);
    box-sizing: border-box;
}

.rwp-osl-items-table-header {
    text-align: left;
    font-weight: 600;
    color: var(--rwp-osl-color-text-light);
    padding: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-md);
    border-bottom: 1px solid var(--rwp-osl-color-border);
    box-sizing: border-box;
}

.rwp-osl-items-table-cell {
    padding: var(--rwp-osl-spacing-md) var(--rwp-osl-spacing-md);
    border-bottom: 1px solid var(--rwp-osl-color-border-light);
    vertical-align: top;
    color: var(--rwp-osl-color-text);
    box-sizing: border-box;
}

.rwp-osl-item-name {
    font-weight: 500;
    color: var(--rwp-osl-color-text);
    line-height: 1.4;
}

.rwp-osl-item-qty {
    color: var(--rwp-osl-color-text-light);
    font-size: var(--rwp-osl-font-size-sm);
    margin-left: var(--rwp-osl-spacing-xs);
}

.rwp-osl-item-notes {
    display: block;
    margin-top: var(--rwp-osl-spacing-sm);
    font-size: var(--rwp-osl-font-size-xs);
    color: var(--rwp-osl-color-text-muted);
    line-height: 1.4;
    font-style: italic;
}

.rwp-osl-item-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--rwp-osl-spacing-xs) var(--rwp-osl-spacing-sm);
    border-radius: var(--rwp-osl-border-radius-full);
    font-size: var(--rwp-osl-font-size-xs);
    font-weight: 600;
    text-transform: capitalize;
    box-sizing: border-box;
}

.rwp-osl-item-status--ready {
    background: rgba(58, 167, 109, 0.15);
    color: #216948;
}

.rwp-osl-item-status--preparing {
    background: rgba(209, 162, 76, 0.2);
    color: #8c5a1d;
}

.rwp-osl-item-status--pending {
    background: rgba(160, 174, 192, 0.25);
    color: #364152;
}

.rwp-osl-item-status--served {
    background: rgba(79, 91, 118, 0.2);
    color: #2d3748;
}

/* Empty State */
.rwp-osl-empty {
    margin-top: var(--rwp-osl-spacing-xxl);
    text-align: center;
    font-size: var(--rwp-osl-font-size-lg);
    color: var(--rwp-osl-color-text-light);
    box-sizing: border-box;
}

.rwp-osl-empty-text {
    margin: 0;
    color: var(--rwp-osl-color-text-light);
}

/* Fallback for table elements (maintained for compatibility) */
.rwp-osl-items-table thead th {
    text-align: left;
    font-weight: 600;
    color: var(--rwp-osl-color-text-light);
    padding: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-md);
    border-bottom: 1px solid var(--rwp-osl-color-border);
    box-sizing: border-box;
}

.rwp-osl-items-table tbody td {
    padding: var(--rwp-osl-spacing-md) var(--rwp-osl-spacing-md);
    border-bottom: 1px solid var(--rwp-osl-color-border-light);
    vertical-align: top;
    color: var(--rwp-osl-color-text);
    box-sizing: border-box;
}

/* ========================================
   Responsive Design - Mobile First
   ======================================== */

/* Mobile Devices (up to 767px) */
@media (max-width: 767px) {
    .rwp-order-status-list-wrapper {
        padding: 0;
        margin: 0;
    }
    
    .rwp-order-status-list {
        padding: var(--rwp-osl-spacing-lg);
        margin: 0;
        max-width: 100%;
        border-radius: 0;
    }
    
    .rwp-osl-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--rwp-osl-spacing-md);
    }
    
    .rwp-osl-title-text {
        font-size: var(--rwp-osl-font-size-xl);
    }
    
    .rwp-osl-actions {
        width: 100%;
    }
    
    .rwp-osl-refresh-button {
        width: 100%;
        justify-content: center;
    }
    
    .rwp-osl-orders {
        grid-template-columns: 1fr;
        gap: var(--rwp-osl-spacing-lg);
    }
    
    .rwp-osl-order-card {
        min-height: auto;
    }
    
    .rwp-osl-card-header {
        padding: var(--rwp-osl-spacing-md) var(--rwp-osl-spacing-lg) var(--rwp-osl-spacing-sm);
    }
    
    .rwp-osl-card-header-title {
        font-size: var(--rwp-osl-font-size-lg);
    }
    
    .rwp-osl-card-summary {
        padding: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-lg);
        gap: var(--rwp-osl-spacing-xs) var(--rwp-osl-spacing-md);
    }
    
    .rwp-osl-items {
        padding: var(--rwp-osl-spacing-md) var(--rwp-osl-spacing-lg);
    }
    
    .rwp-osl-items-table {
        font-size: var(--rwp-osl-font-size-sm);
        display: block;
        width: 100%;
    }
    
    .rwp-osl-items-table thead {
        display: none;
    }
    
    .rwp-osl-items-table tbody {
        display: block;
        width: 100%;
    }
    
    .rwp-osl-items-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-md);
        padding: var(--rwp-osl-spacing-md) 0;
        border-bottom: 1px solid var(--rwp-osl-color-border-light);
    }
    
    .rwp-osl-items-table tbody tr:last-child {
        border-bottom: none;
    }
    
    .rwp-osl-items-table tbody td {
        border-bottom: none;
        padding: 0;
        display: block;
    }
    
    .rwp-osl-items-table tbody td[data-label]::before {
        content: attr(data-label) ':';
        display: block;
        font-size: var(--rwp-osl-font-size-xs);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--rwp-osl-color-text-muted);
        margin-bottom: var(--rwp-osl-spacing-xs);
        font-weight: 600;
    }
    
    .rwp-osl-item-status {
        display: inline-flex;
        width: auto;
    }
}

/* Tablet Devices (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .rwp-order-status-list {
        padding: var(--rwp-osl-spacing-xl);
    }
    
    .rwp-osl-orders {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--rwp-osl-spacing-lg);
    }
    
    .rwp-osl-items-table {
        font-size: var(--rwp-osl-font-size-sm);
    }
    
    .rwp-osl-items-table-header,
    .rwp-osl-items-table-cell {
        padding: var(--rwp-osl-spacing-sm) var(--rwp-osl-spacing-md);
    }
}

/* Desktop Devices (1024px and above) */
@media (min-width: 1024px) {
    .rwp-order-status-list {
        padding: var(--rwp-osl-spacing-xxl);
    }
    
    .rwp-osl-orders {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

/* Large Desktop Devices (1400px and above) */
@media (min-width: 1400px) {
    .rwp-osl-orders {
        grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .rwp-order-status-list,
    .rwp-osl-order-card,
    .rwp-osl-summary-pill,
    .rwp-osl-item-status,
    .rwp-osl-refresh-button {
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .rwp-order-status-list-wrapper {
        background: white;
    }
    
    .rwp-order-status-list {
        background: white;
        box-shadow: none;
    }
    
    .rwp-osl-refresh-button {
        display: none;
    }
    
    .rwp-osl-order-card {
        page-break-inside: avoid;
    }
}
