/* POS Mobile Responsive Styles */

/* Mobile First Approach */
@media (max-width: 768px) {
    .pos-container {
        padding: 5px;
    }

    .pos-header {
        padding: 10px;
        margin-bottom: 15px;
    }

    .pos-header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .pos-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .products-section,
    .cart-section {
        padding: 15px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card {
        padding: 10px;
    }

    .product-image {
        height: 80px;
        font-size: 32px;
    }

    .product-name {
        font-size: 14px;
        margin-bottom: 3px;
    }

    .product-details {
        font-size: 11px;
        margin-bottom: 5px;
    }

    .product-price {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .product-stock {
        font-size: 11px;
    }

    .add-to-cart-btn {
        padding: 6px 15px;
        font-size: 12px;
        margin-top: 8px;
    }

    .cart-section {
        position: static;
        margin-top: 0;
    }

    .cart-items {
        max-height: 300px;
    }

    .cart-item {
        padding: 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-details {
        width: 100%;
        margin-bottom: 8px;
    }

    .quantity-controls {
        justify-content: center;
        width: 100%;
    }

    .remove-item {
        position: absolute;
        top: 5px;
        right: 5px;
    }

    .modal-dialog {
        margin: 5px;
        max-width: calc(100vw - 10px);
    }

    .modal-content {
        padding: 15px;
    }

    .customer-search input,
    .product-search input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Extra Small Devices */
@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 10px;
    }

    .product-image {
        width: 60px;
        height: 60px;
        margin-right: 10px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .product-info {
        flex: 1;
    }

    .add-to-cart-btn {
        width: auto;
        padding: 5px 10px;
        margin-top: 5px;
    }

    .pos-header h1 {
        font-size: 1.25rem;
    }

    .cart-item {
        position: relative;
        padding: 10px;
        padding-right: 35px;
    }
}

/* Landscape Phones */
@media (max-width: 768px) and (orientation: landscape) {
    .pos-grid {
        grid-template-columns: 1fr 350px;
        gap: 15px;
    }

    .cart-section {
        position: sticky;
        top: 10px;
        height: calc(100vh - 20px);
        overflow-y: auto;
    }
}

/* Touch-friendly improvements */
.product-card,
.cart-item,
.customer-item,
.qty-btn,
.remove-item,
.add-to-cart-btn,
.checkout-btn {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

/* Improved form controls for mobile */
.form-control {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px; /* iOS recommended touch target */
}

.qty-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 14px;
}

.remove-item {
    min-width: 44px;
    min-height: 44px;
}

/* Cart improvements for mobile */
.cart-items {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.cart-items::-webkit-scrollbar {
    width: 4px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Modal improvements for mobile */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }

    .modal-dialog {
        margin: 0;
        height: 100vh;
        max-width: 100vw;
        display: flex;
        flex-direction: column;
    }

    .modal-content {
        flex: 1;
        border-radius: 0;
        height: 100%;
        overflow-y: auto;
    }
}

/* Loading states */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4e73df;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card,
    .cart-item,
    .modal-content {
        border-width: 2px;
    }
}

/* Dark mode considerations */
@media (prefers-color-scheme: dark) {
    .product-image {
        background: #2c3e50;
        color: #ecf0f1;
    }
}
