@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #C8142F;
    --primary-light: #e61c3a;
    --primary-dark: #a01026;
    --bg: #f4f6f8;
    --white: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --radius: 12px;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    background-color: var(--white);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-container img {
    height: 50px;
    object-fit: contain;
}

.logo-container h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-left: 10px;
    border-left: 2px solid var(--border);
    padding-left: 20px;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: rgba(200, 20, 47, 0.05);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg);
    color: var(--text);
}

.btn-icon:hover {
    background-color: #e2e8f0;
}

/* Main Layout */
.pos-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel - Products */
.products-panel {
    flex: 1;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg);
}

.filters {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-bar {
    position: relative;
    width: 300px;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border-radius: 30px;
    border: 1px solid var(--border);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary);
}

.search-bar i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.price-type-selector {
    display: flex;
    gap: 10px;
    background: var(--white);
    padding: 5px;
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.price-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.price-btn.active {
    background-color: var(--primary);
    color: var(--white);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

.product-card {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: rgba(200, 20, 47, 0.3);
}

.product-card.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-section {
    margin-bottom: 20px;
}

.category-title {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #fce7eb;
    font-weight: 700;
}

.product-card:active {
    transform: translateY(-2px);
}

.product-image-placeholder {
    width: 100px;
    height: 100px;
    background-color: #fce7eb; /* default */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    color: var(--primary); /* default */
    font-size: 40px;
    transition: all 0.3s ease;
}

/* Category Colors */
.color-gray { background-color: #f1f5f9; color: #475569; }
.color-red { background-color: #fee2e2; color: #b91c1c; }
.color-black { background-color: #e5e7eb; color: #111827; }
.color-green { background-color: #dcfce7; color: #15803d; }
.color-orange { background-color: #ffedd5; color: #c2410c; }
.color-pink { background-color: #fce7f3; color: #db2777; }
.color-burgundy { background-color: #ffe4e6; color: #881337; }
.color-yellow { background-color: #fef9c3; color: #a16207; }
.color-brown { background-color: #f5ebd5; color: #78350f; }
.color-purple { background-color: #f3e8ff; color: #7e22ce; }
.color-blue-1 { background-color: #e0f2fe; color: #0284c7; }
.color-blue-2 { background-color: #dbeafe; color: #1d4ed8; }
.color-blue-3 { background-color: #ccfbf1; color: #0f766e; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}



.product-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text);
    min-height: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
}

.product-clave {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-top: auto;
}

.product-stock {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e2e8f0;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
}

.product-stock.low {
    background: #fef08a;
    color: #854d0e;
}

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

/* Right Panel - Cart */
.cart-panel {
    width: 380px;
    background-color: var(--white);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    box-shadow: -2px 0 15px rgba(0,0,0,0.03);
    z-index: 5;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-header .clear-cart {
    color: var(--primary);
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-cart-msg {
    text-align: center;
    color: var(--text-light);
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.empty-cart-msg i {
    font-size: 48px;
    color: #cbd5e1;
}

.cart-item {
    display: flex;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
    padding-right: 10px;
}

.cart-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.cart-item-price {
    color: var(--text-light);
    font-size: 13px;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: 20px;
    padding: 4px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.qty-btn:hover {
    color: var(--primary);
}

.cart-item-qty {
    font-weight: 600;
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.cart-item-total {
    font-weight: 700;
    width: 70px;
    text-align: right;
    color: var(--primary);
}

.cart-summary {
    padding: 20px;
    background-color: var(--white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -5px 15px rgba(0,0,0,0.03);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 15px;
    color: var(--text-light);
}

.summary-row.total {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border);
}

.summary-row.total .total-amount {
    color: var(--primary);
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    margin-top: 20px;
    height: auto;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--white);
    width: 400px;
    border-radius: 20px;
    padding: 30px;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-header h3 {
    font-size: 22px;
    color: var(--text);
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.method-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.method-card i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--text-light);
}

.method-card.active {
    border-color: var(--primary);
    background-color: rgba(200, 20, 47, 0.05);
}

.method-card.active i, .method-card.active span {
    color: var(--primary);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 15px;
}

.modal-actions .btn {
    flex: 1;
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--white);
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    border-left: 5px solid var(--primary);
}

.notification.show {
    transform: translateX(0);
}

.notification.success { border-left-color: #10b981; }
.notification.error { border-left-color: var(--primary); }

.notification-icon {
    font-size: 24px;
}

.notification.success .notification-icon { color: #10b981; }
.notification.error .notification-icon { color: var(--primary); }

/* Responsive adjustments for tablet */
@media (max-width: 900px) {
    .cart-panel {
        width: 320px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .search-bar {
        width: 100%;
    }
}

/* Mobile Responsive */
@media (max-width: 850px) {
    header {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }
    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    .header-actions .btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
    .pos-layout {
        flex-direction: column;
        height: calc(100vh - 140px); /* Adjust for taller header */
    }
    .products-panel {
        height: 55%;
        flex: none;
        padding: 15px;
    }
    .cart-panel {
        width: 100%;
        height: 45%;
        flex: none;
        border-left: none;
        border-top: 3px solid var(--border);
    }
    .filters {
        flex-direction: column;
        gap: 15px;
    }
    .search-bar { width: 100%; }
    .price-type-selector { width: 100%; justify-content: space-between; }
    .price-btn { flex: 1; }
    
    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .product-card {
        padding: 15px 10px;
    }
    .product-image-placeholder {
        width: 60px;
        height: 60px;
        font-size: 24px;
        margin-bottom: 10px;
    }
    .product-title {
        font-size: 14px;
        min-height: 35px;
    }
    .payment-methods {
        flex-wrap: wrap;
    }
    .method-card {
        flex: 1 1 30%;
        padding: 10px;
    }
    
    .cart-header {
        padding: 15px;
    }
    
    .cart-items {
        padding: 10px 15px;
    }
    
    .cart-summary {
        padding: 15px;
    }
}
