/* ===================================
   STATUS BADGE FIX
   Prevent badge overflow in cards
   =================================== */

/* Ensure status badges stay within card bounds */
.status-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    flex-shrink: 1;
}

/* Fix the header row that contains order number and status badge */
.order-card .flex.justify-between.items-start {
    gap: 0.5rem;
    align-items: flex-start;
}

/* Make order number container flexible */
.order-card .flex.justify-between.items-start > div:first-child {
    flex: 1;
    min-width: 0;
}

/* Limit status badge width to prevent overflow */
.order-card .flex.justify-between.items-start > .status-badge {
    flex-shrink: 0;
    max-width: 45%;
}

/* Specific fix for processing badge (longest text) */
.status-processing {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
}

/* Alternative: Stack on very small cards */
@media (max-width: 360px) {
    .order-card .flex.justify-between.items-start {
        flex-direction: column;
        gap: 0.75rem;
    }

    .order-card .flex.justify-between.items-start > .status-badge {
        max-width: 100%;
        align-self: flex-start;
    }
}

/* ===================================
   ORIGINAL QUEUE STYLES
   (Keep all existing styles below)
   =================================== */

/* ===================================
   ORDER CARDS - BASE STYLES
   =================================== */
.order-card {
    transition: all 0.3s ease;
    height: 350px;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.order-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.order-card > div {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Order card text colors - make labels blue for better visibility */
.order-card .text-gray-600 {
    color: black !important;
    font-weight: 500;
}

.order-card .font-medium {
    color: black !important;
    font-weight: 600;
}

/* Specific styling for order information */
.order-card .space-y-2 > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-card .space-y-2 > div > span:first-child {
    color: #3b82f6;
    font-weight: 500;
}

.order-card .space-y-2 > div > span:last-child {
    color: #1e3a8a;
    font-weight: 600;
}

/* ===================================
   PULSE ANIMATION
   =================================== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ===================================
   SLIDE IN ANIMATION
   =================================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   GRID LAYOUTS
   =================================== */
#cashier-orders-grid,
#kitchen-orders-grid,
#customer-orders-grid {
    align-items: start;
}

/* ===================================
   CONNECTION STATUS
   =================================== */
#connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===================================
   EMPTY STATE STYLING
   =================================== */
.empty-state-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-subtitle {
    font-size: 0.875rem;
}

/* ===================================
   STAFF LOGIN MODAL
   =================================== */
#staff-login-modal {
    z-index: 9999;
}

.staff-login-option {
    transition: all 0.2s ease;
}

.staff-login-option:hover {
    transform: translateY(-1px);
}

.staff-login-option:active {
    transform: scale(0.98);
}

/* ===================================
   PIN ENTRY STYLES
   =================================== */
.pin-key:active {
    transform: scale(0.95);
}

/* ===================================
   QUEUE HEADER BADGES
   =================================== */
#queue-token-balance {
    cursor: pointer;
    transition: all 0.2s;
}

#queue-token-balance:hover {
    transform: translateY(-1px);
}

/* ===================================
   MANAGER DASHBOARD STATS
   =================================== */
.manager-stats-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===================================
   CUSTOMER VIEW STYLING
   =================================== */
#customer-screen {
    background-color: #1f2937;
    min-height: 100vh;
}

#customer-orders-grid .order-card {
    animation: zoom-in 0.3s ease;
}

@keyframes zoom-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===================================
   SALES SUMMARY CARDS
   =================================== */
.sales-summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 0.5rem;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ===================================
   TABLET RESPONSIVE (768px - 1024px)
   =================================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .order-card {
        height: 280px;
    }

    .order-card > div {
        padding: 1rem;
    }

    #cashier-orders-grid,
    #kitchen-orders-grid,
    #customer-orders-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .order-card h2 {
        font-size: 1.5rem;
    }

    .order-card button {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .manager-stats-card {
        padding: 1rem;
    }
}

/* ===================================
   MOBILE RESPONSIVE (< 768px)
   =================================== */
@media (max-width: 767px) {
    .order-card {
        height: 240px;
    }

    .order-card > div {
        padding: 0.75rem;
    }

    #cashier-orders-grid,
    #kitchen-orders-grid,
    #customer-orders-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .order-card h2 {
        font-size: 1.25rem;
    }

    .order-card .text-sm {
        font-size: 0.75rem;
    }

    .order-card button {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }

    .order-card .space-y-2 > * + * {
        margin-top: 0.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .manager-stats-card {
        padding: 0.75rem;
    }

    .manager-stats-card h3 {
        font-size: 0.875rem;
    }

    .manager-stats-card p {
        font-size: 1.5rem;
    }

    .filter-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-bar button {
        white-space: nowrap;
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }

    #queue-token-balance {
        font-size: 0.8125rem;
    }

    .empty-state-icon {
        font-size: 3rem;
    }

    .empty-state-title {
        font-size: 1rem;
    }

    #customer-screen .order-card {
        height: auto;
        min-height: 200px;
    }
}

/* ===================================
   SMALL MOBILE (< 480px)
   =================================== */
@media (max-width: 479px) {
    .order-card {
        height: 220px;
    }

    .order-card > div {
        padding: 0.5rem;
    }

    .order-card h2 {
        font-size: 1.125rem;
    }

    .order-card button {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    .order-card .flex.space-x-2 {
        flex-direction: column;
        gap: 0.375rem;
    }

    .order-card .flex.space-x-2 button {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    nav .flex.space-x-4 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    nav .flex.space-x-4 a {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        white-space: nowrap;
    }

    .history-table {
        font-size: 0.75rem;
    }

    .modal-content {
        max-width: 95vw;
        padding: 1rem;
    }
}

/* ===================================
   LANDSCAPE MOBILE (< 768px height)
   =================================== */
@media (max-height: 600px) and (orientation: landscape) {
    .order-card {
        height: auto;
        min-height: 180px;
    }

    #staff-login-modal > div {
        max-height: 90vh;
        overflow-y: auto;
    }

    .order-card > div {
        padding: 0.5rem;
    }

    .order-card .space-y-2 > * + * {
        margin-top: 0.25rem;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .order-card {
        height: auto;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .order-card button {
        display: none;
    }

    nav,
    .filter-bar,
    #connection-status {
        display: none;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
@media (prefers-reduced-motion: reduce) {
    .order-card,
    .pulse,
    .pin-key,
    #queue-token-balance {
        animation: none;
        transition: none;
    }
}

@media (prefers-contrast: high) {
    .order-card {
        border: 2px solid currentColor;
    }

    .status-new,
    .status-processing,
    .status-ready,
    .status-cancelled,
    .status-completed {
        border-left-width: 12px;
    }
}

/* ===================================
   TOUCH DEVICE OPTIMIZATIONS
   =================================== */
@media (hover: none) and (pointer: coarse) {
    .order-card button {
        min-height: 44px;
    }

    .pin-key {
        min-height: 48px;
        min-width: 48px;
    }

    .order-card:hover {
        transform: none;
    }

    .order-card button,
    .pin-key,
    .staff-login-option {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* ===================================
   SCROLLBAR STYLING
   =================================== */
#cashier-orders-grid::-webkit-scrollbar,
#kitchen-orders-grid::-webkit-scrollbar,
#customer-orders-grid::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#cashier-orders-grid::-webkit-scrollbar-track,
#kitchen-orders-grid::-webkit-scrollbar-track,
#customer-orders-grid::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

#cashier-orders-grid::-webkit-scrollbar-thumb,
#kitchen-orders-grid::-webkit-scrollbar-thumb,
#customer-orders-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

#cashier-orders-grid::-webkit-scrollbar-thumb:hover,
#kitchen-orders-grid::-webkit-scrollbar-thumb:hover,
#customer-orders-grid::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===================================
   LOADING STATES
   =================================== */
.order-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.order-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===================================
   DARK MODE SUPPORT
   =================================== */
@media (prefers-color-scheme: dark) {
    .order-card {
        background: #1f2937;
        color: #f9fafb;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
}

/* ===================================
   QUEUE HEADER INTEGRATION
   =================================== */
body {
    background-color: #f3f4f6;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.queue-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 1rem;
}

.queue-status.connected {
    background: #d1fae5;
    color: #065f46;
}

.queue-status.disconnected {
    background: #fee2e2;
    color: #991b1b;
}

.queue-status.reconnected {
    background: #d1fae5;
    color: #065f46;
}

.status-icon {
    width: 16px;
    height: 16px;
}

.queue-nav-buttons {
    display: flex;
    gap: 0.5rem;
}

.queue-nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.queue-nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.queue-nav-btn[data-view="cashier"] {
    background: #3b82f6;
}

.queue-nav-btn[data-view="cashier"]:hover {
    background: #2563eb;
}

.queue-nav-btn[data-view="customer"] {
    background: #10b981;
}

.queue-nav-btn[data-view="customer"]:hover {
    background: #059669;
}

.queue-nav-btn[data-view="kitchen"] {
    background: #f97316;
}

.queue-nav-btn[data-view="kitchen"]:hover {
    background: #ea580c;
}

.queue-nav-btn[data-view="manager"] {
    background: #ef4444;
}

.queue-nav-btn[data-view="manager"]:hover {
    background: #dc2626;
}

.queue-nav-btn[data-view="history"] {
    background: #8b5cf6;
}

.queue-nav-btn[data-view="history"]:hover {
    background: #7c3aed;
}

.queue-nav-btn.active {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Grid min-heights */
#cashier-orders-grid {
    min-height: calc(100vh - 350px);
}

#kitchen-orders-grid,
#customer-orders-grid {
    min-height: calc(100vh - 250px);
}

#manager-orders-table {
    min-height: 200px;
}

#history-table-body {
    min-height: 300px;
}

@media (max-width: 767px) {
    #cashier-orders-grid,
    #kitchen-orders-grid,
    #customer-orders-grid {
        min-height: calc(100vh - 300px);
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    #cashier-orders-grid {
        min-height: calc(100vh - 320px);
    }

    .queue-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .queue-nav-buttons {
        overflow-x: auto;
        width: 100%;
    }

    .queue-nav-btn {
        white-space: nowrap;
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
    }
}

