/* Custom CSS for Event POS System */

/* CSS Variables for Design System */
:root {
    /* Primary Brand Colors */
    --bs-primary: #722F37;
    --bs-primary-rgb: 114, 47, 55;
    --bs-primary-hover: #5a252a;
    --bs-primary-active: #4a1f24;
    
    /* Cultural Accent Colors */
    --cultural-gold: #FFD700;
    --cultural-red: #DC143C;
    --cultural-jade: #00A86B;
    
    /* Status Colors */
    --status-paid: #198754;
    --status-draft: #ffc107;
    --status-pending: #0dcaf0;
    --status-cancelled: #dc3545;
}

/* Chinese font support */
body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans CN";
    line-height: 1.6;
}

/* Navigation enhancements */
.navbar-brand {
    font-weight: bold;
    font-size: 1.2rem;
}

.navbar-dark {
    background-color: var(--bs-primary) !important;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
    color: var(--cultural-gold);
}

/* Bilingual text support */
.bilingual-text {
    font-size: 1rem;
    line-height: 1.6;
}

.chinese-primary {
    font-weight: 600;
    font-size: 1.1em;
}

.english-secondary {
    font-weight: 400;
    font-size: 0.9em;
    color: #6c757d;
    margin-left: 0.5rem;
}

/* Card enhancements */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Button styles */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: var(--bs-primary-hover);
    border-color: var(--bs-primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    background-color: var(--bs-primary-active);
    border-color: var(--bs-primary-active);
    transform: translateY(0);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    min-height: 44px; /* Touch-friendly */
}

.btn-sm {
    min-height: 32px;
}

/* Table enhancements */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

/* Alert enhancements */
.alert {
    border-radius: 0.5rem;
    border: none;
}

/* POS specific styles - Only apply to POS pages */
.pos-page .pos-container {
    height: calc(100vh - 80px);
    overflow: hidden;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 1rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.item-card {
    position: relative;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    background: white;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
}

.item-card .card-body {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.item-card .card-title {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.item-card .card-text {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.item-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.15);
    transform: translateY(-2px);
}

.item-card.selected {
    border-color: var(--status-paid);
    background-color: rgba(25, 135, 84, 0.05);
}

.card-img-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    margin-right: 1rem;
}

.card-img-top {
    height: 60px;
    object-fit: cover;
    width: 60px;
}

.price-badge {
    position: static;
    background: var(--bs-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.selection-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 1.5rem;
}

.item-card.selected .selection-indicator {
    opacity: 1;
}

.icon-wrapper {
    color: var(--bs-primary);
}

.custom-amount-card {
    min-height: 80px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.custom-amount-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.custom-amount-btn {
    border-radius: 0px !important;
}

/* Shopping Cart Sidebar */
.cart-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 400px;
    background: white;
    border-left: 1px solid #e9ecef;
    z-index: 1050;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.cart-sidebar.show {
    transform: translateX(0);
}

.cart-header {
    padding: 1.25rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
}

.cart-item {
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.quantity-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
}

.quantity-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.cart-footer {
    padding: 1.25rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.cart-total {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.cart-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
}

.cart-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cart-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Receipt styles */
.receipt {
    background-color: white;
    max-width: 400px;
    margin: 0 auto;
    padding: 1rem;
    font-family: monospace;
    border: 1px solid #ddd;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin: 0.25rem 0;
}

.receipt-total {
    border-top: 2px solid #000;
    padding-top: 0.5rem;
    margin-top: 1rem;
    font-weight: bold;
}

/* Dashboard Statistics Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    height: 100%;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card.stat-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, #8e3a44 100%);
    color: white;
}

.stat-card.stat-success {
    background: linear-gradient(135deg, var(--status-paid) 0%, #146c43 100%);
    color: white;
}

.stat-card.stat-warning {
    background: linear-gradient(135deg, var(--status-draft) 0%, #cc9a06 100%);
    color: #000;
}

.stat-card.stat-info {
    background: linear-gradient(135deg, var(--status-pending) 0%, #0aa2c0 100%);
    color: white;
}

.stat-icon {
    font-size: 2.5rem;
    margin-right: 1rem;
    opacity: 0.8;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Form enhancements */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* Status badges */
.status-badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-weight: 500;
}

.status-paid {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--status-paid);
    border: 1px solid rgba(25, 135, 84, 0.2);
}

.status-draft {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--status-draft);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.status-refunded {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--status-cancelled);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.status-pending {
    background-color: rgba(13, 202, 240, 0.1);
    color: var(--status-pending);
    border: 1px solid rgba(13, 202, 240, 0.2);
}

/* Stock status indicators */
.stock-available {
    color: #28a745;
}

.stock-low {
    color: #ffc107;
}

.stock-out {
    color: #dc3545;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

/* Modal Enhancements */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-radius: 12px 12px 0 0;
    background: #f8f9fa;
}

/* Form Enhancements */
.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(114, 47, 55, 0.25);
}

.form-control, .form-select {
    border-radius: 8px;
    min-height: 44px;
}

.input-group-lg .form-control {
    min-height: 52px;
}

/* Receipt Styles */
.receipt-template {
    max-width: 300px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid #ddd;
}

.receipt-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
}

.receipt-divider {
    border-top: 1px dashed #000;
    margin: 10px 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .pos-product-grid {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .cart-sidebar {
        width: 100%;
    }
    
    .card-img-top {
        height: 120px;
    }
    
    .stat-card .stat-icon {
        font-size: 2rem;
        margin-right: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .pos-page .pos-container {
        height: auto;
        min-height: calc(100vh - 120px);
    }
    
    .main-content {
        padding-bottom: 80px;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .receipt {
        border: none;
        box-shadow: none;
    }
    
    body {
        background: white;
    }
    
    .navbar, .footer, .btn {
        display: none !important;
    }
}
/* Performance Optimizations for Event Day */

/* Hardware acceleration for animations */
.item-card, .cart-item, .btn {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize font loading */
@font-face {
    font-family: 'Chinese-Fallback';
    src: local('Microsoft YaHei'), local('PingFang SC'), local('Hiragino Sans GB');
    font-display: swap;
}

/* Critical CSS for above-the-fold content */
.pos-layout {
    contain: layout style paint;
}

.product-selection-panel {
    contain: layout style paint;
}

/* Touch optimization for tablets */
@media (pointer: coarse) {
    .btn, .category-tab, .item-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    .quantity-btn {
        min-height: 40px;
        min-width: 40px;
    }
}

/* Reduce motion for performance on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Network-aware loading */
@media (max-width: 768px) and (max-resolution: 150dpi) {
    .card-img-top {
        content-visibility: auto;
        contain-intrinsic-size: 150px;
    }
}

/* Memory optimization for large lists */
.pos-product-grid {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

/* Optimize repaints */
.cart-panel, .product-selection-panel {
    contain: layout style paint;
    isolation: isolate;
}

/* Enhanced Toast Notifications */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
}

/* Use Bootstrap's built-in toast transitions */
.toast:not(.show) {
    transform: translateX(100%);
    opacity: 0;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-header {
    background: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px 12px 0 0;
    font-weight: 600;
}

.toast-body {
    font-size: 0.95rem;
    padding: 1rem;
    font-weight: 500;
}

.toast.text-bg-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.toast.text-bg-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%) !important;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.toast.text-bg-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%) !important;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.toast.text-bg-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%) !important;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.toast .btn-close {
    filter: brightness(0) saturate(100%) invert(0%) opacity(60%);
}

.toast .btn-close:hover {
    filter: brightness(0) saturate(100%) invert(0%) opacity(80%);
}

/* Remove custom keyframe animations - let Bootstrap handle transitions */
