/**
 * Universal Point of Sale System - Styles
 * Website-agnostic POS system styling
 * Version: 1.0.0
 */

/* === PRODUCT STYLES === */
.pos-product {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.2s ease;
}

.pos-product:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.pos-quantity {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.pos-quantity:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pos-add-to-cart {
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pos-add-to-cart:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.pos-add-to-cart:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pos-stock {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f0fdf4;
    color: #166534;
    align-self: flex-start;
}

.pos-stock.pos-low-stock {
    background: #fef3c7;
    color: #92400e;
}

.pos-stock.pos-out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

/* === CART CONTAINER === */
.pos-cart-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* === CART TOGGLE BUTTON === */
.pos-cart-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    user-select: none;
}

.pos-cart-toggle:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.pos-cart-icon {
    font-size: 20px;
    line-height: 1;
}

.pos-cart-count {
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    display: none;
}

/* === CART DROPDOWN === */
.pos-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 400px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pos-cart-dropdown.pos-cart-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* === CART HEADER === */
.pos-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.pos-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.pos-cart-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.pos-cart-close:hover {
    background: #e5e7eb;
    color: #374151;
}

/* === CART ITEMS === */
.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    padding: 8px 0;
}

.pos-cart-empty {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.pos-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.pos-cart-item:hover {
    background: #f9fafb;
}

.pos-cart-item:last-child {
    border-bottom: none;
}

.pos-cart-item-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.pos-cart-item-details {
    flex: 1;
    min-width: 0;
}

.pos-cart-item-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.3;
}

.pos-cart-item-price {
    color: #3b82f6;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.pos-cart-item-sku {
    color: #6b7280;
    font-size: 12px;
}

.pos-cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 4px;
}

.pos-quantity-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #ffffff;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pos-quantity-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.pos-quantity-display {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.pos-cart-item-total {
    font-weight: 700;
    color: #1f2937;
    font-size: 14px;
    min-width: 60px;
    text-align: right;
}

.pos-cart-item-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pos-cart-item-remove:hover {
    background: #fecaca;
    color: #b91c1c;
}

/* === CART TOTALS === */
.pos-cart-totals {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.pos-totals-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.pos-totals-line:last-child {
    margin-bottom: 0;
}

.pos-totals-total {
    font-weight: 700;
    font-size: 16px;
    color: #1f2937;
    padding-top: 8px;
    border-top: 1px solid #d1d5db;
    margin-top: 8px;
}

/* === CART ACTIONS === */
.pos-cart-actions {
    padding: 20px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #e2e8f0;
}

.pos-cart-clear {
    flex: 1;
    padding: 12px 20px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pos-cart-clear:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.pos-cart-checkout {
    flex: 2;
    padding: 12px 20px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pos-cart-checkout:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.pos-cart-checkout:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === NOTIFICATIONS === */
.pos-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    animation: posSlideDown 0.3s ease;
}

.pos-notification-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.pos-notification-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.pos-notification-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

@keyframes posSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .pos-cart-container {
        top: 10px;
        right: 10px;
    }
    
    .pos-cart-dropdown {
        width: 95vw;
        right: -10px;
    }
    
    .pos-cart-toggle {
        padding: 10px 14px;
    }
    
    .pos-cart-icon {
        font-size: 18px;
    }
    
    .pos-cart-item {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .pos-cart-item-image {
        width: 40px;
        height: 40px;
    }
    
    .pos-cart-item-name {
        font-size: 13px;
    }
    
    .pos-cart-item-price {
        font-size: 13px;
    }
    
    .pos-cart-actions {
        flex-direction: column;
    }
    
    .pos-cart-actions button {
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    .pos-product {
        padding: 12px;
    }
    
    .pos-add-to-cart {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .pos-quantity {
        width: 60px;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .pos-cart-header {
        padding: 16px;
    }
    
    .pos-cart-header h3 {
        font-size: 16px;
    }
    
    .pos-notification {
        left: 10px;
        right: 10px;
        transform: none;
        font-size: 13px;
    }
}

/* === ACCESSIBILITY === */
.pos-add-to-cart:focus,
.pos-quantity:focus,
.pos-cart-toggle:focus,
.pos-cart-close:focus,
.pos-cart-clear:focus,
.pos-cart-checkout:focus,
.pos-quantity-btn:focus,
.pos-cart-item-remove:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* === HIGH CONTRAST MODE === */
@media (prefers-contrast: high) {
    .pos-product {
        border-width: 2px;
    }
    
    .pos-add-to-cart {
        border: 2px solid #1e40af;
    }
    
    .pos-cart-dropdown {
        border-width: 2px;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .pos-product,
    .pos-add-to-cart,
    .pos-cart-toggle,
    .pos-cart-dropdown,
    .pos-cart-close,
    .pos-cart-clear,
    .pos-cart-checkout,
    .pos-quantity-btn,
    .pos-cart-item-remove,
    .pos-cart-item {
        transition: none;
    }
    
    .pos-notification {
        animation: none;
    }
    
    .pos-add-to-cart:hover:not(:disabled),
    .pos-cart-toggle:hover,
    .pos-cart-checkout:hover:not(:disabled) {
        transform: none;
    }
}

/* === PRINT STYLES === */
@media print {
    .pos-cart-container,
    .pos-notification {
        display: none !important;
    }
    
    .pos-add-to-cart,
    .pos-quantity {
        display: none !important;
    }
}