:root {
    --bg-dark: #E2D8D0;
    --bg-panel: #F4EBE4;
    --bg-card: #FFFFFF;
    --text-main: #350516;
    --text-muted: #805E68;
    --primary: #350516; /* Deep Maroon */
    --primary-hover: #501227;
    --accent: #E2D8D0;
    --border: #D1C5BC;
    --danger: #ef476f;
    --success: #06d6a0;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow: 0 4px 20px rgba(53, 5, 22, 0.08);
    --shadow-hover: 0 10px 40px rgba(53, 5, 22, 0.15);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.pos-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Mobile Bottom Nav & Floating Cart */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    padding: 10px 0;
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-nav-btn.active {
    color: var(--primary);
}

.mobile-nav-btn i {
    font-size: 1.4rem;
}

.floating-cart-badge {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--primary);
    color: var(--bg-card);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-hover);
    z-index: 999;
    border: none;
    cursor: pointer;
}

.cart-count-pill {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--primary);
    color: var(--bg-card);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(53, 5, 22, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideInToast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transition: opacity 0.3s;
}

@keyframes slideInToast {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media screen and (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 100px;
        right: 0;
        left: 0;
        align-items: center;
    }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    color: var(--primary);
    font-size: 1.2rem;
}

.logo i {
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(53, 5, 22, 0.1);
    color: var(--primary);
}

.nav-item i {
    font-size: 1.2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    width: 400px;
    max-width: 100%;
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 12px;
    font-size: 1.2rem;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    width: 100%;
    font-size: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.datetime {
    font-weight: 500;
    color: var(--text-muted);
}

.icon-btn {
    background-color: var(--bg-panel);
    border: none;
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.3s;
}

.icon-btn:hover {
    background-color: var(--primary);
    color: var(--bg-dark);
}

/* Menu Section */
.menu-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.categories {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.categories::-webkit-scrollbar {
    height: 4px;
}
.categories::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 4px;
}

.category-btn {
    background-color: var(--bg-panel);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-btn:hover, .category-btn.active {
    background-color: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    overflow-y: auto;
    padding-bottom: 40px;
    padding-right: 10px;
}

.products-grid::-webkit-scrollbar {
    width: 6px;
}
.products-grid::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 6px;
}

/* Product Card Component Styles */
.product-card {
    background-color: var(--bg-panel);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--border);
}

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

.product-img-container {
    height: 180px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Right Sidebar (Cart) */
.cart-sidebar {
    width: 380px;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

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

.cart-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
}

.order-id {
    color: var(--primary);
    font-weight: 500;
    background-color: rgba(53, 5, 22, 0.1);
    padding: 4px 12px;
    border-radius: var(--radius-lg);
}

.cart-type-selector {
    display: flex;
    background-color: var(--bg-dark);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.type-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 0;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
}

.type-btn.active {
    background-color: var(--bg-panel);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cart-items-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 8px;
    margin-bottom: 20px;
}

.cart-items-container::-webkit-scrollbar {
    width: 4px;
}
.cart-items-container::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 4px;
}

.empty-cart-message {
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
    font-style: italic;
}

/* Cart Item Component Styles */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-dark);
    border-radius: var(--radius-md);
    padding: 12px;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.cart-item-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.cart-item-customs {
    font-size: 0.75rem;
    color: var(--primary);
    font-style: italic;
    opacity: 0.8;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 500;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    background-color: var(--bg-panel);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.qty-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.qty-btn:hover {
    background-color: rgba(53, 5, 22, 0.1);
}

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

.item-qty {
    width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Cart Summary & Checkout */
.cart-summary {
    background-color: var(--bg-dark);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 1rem;
}

.summary-row.total-row {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    color: var(--text-main);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0;
}

.total-row span:last-child {
    color: var(--primary);
}

.checkout-btn {
    width: 100%;
    background-color: var(--primary);
    color: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(53, 5, 22, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.checkout-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(53, 5, 22, 0.3);
}

.checkout-btn:active {
    transform: translateY(0);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(53, 5, 22, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
}

.modal-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.3);
    width: 450px;
    max-width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    text-align: left;
}

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

.modal-card h3 {
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 1.5rem;
}

.custom-group {
    margin-bottom: 20px;
}

.custom-group h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.option-btn {
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    text-align: center;
}

.option-btn:hover {
    border-color: var(--primary);
    background: rgba(53, 5, 22, 0.05);
}

.option-btn.selected {
    background: var(--primary);
    color: var(--bg-card);
    border-color: var(--primary);
}

.modal-footer {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.add-to-cart-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
}

.add-to-cart-btn:hover {
    background: var(--primary-hover);
}

/* Mobile Responsiveness */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
        align-items: center;
    }

    .logo img {
        max-height: 32px !important;
    }

    .nav-item span, .user-info {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 15px;
        width: 50px;
        height: 50px;
    }

    .nav-item i {
        margin: 0;
        font-size: 1.4rem;
    }

    .cart-sidebar {
        width: 320px;
    }
}

@media screen and (max-width: 768px) {
    .pos-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    .sidebar {
        display: none; /* Hide original sidebar on mobile */
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .floating-cart-badge {
        display: flex;
    }

    .main-content {
        padding: 15px 15px 80px 15px; /* Bottom padding for nav */
        height: 100vh;
        overflow-y: auto;
    }

    .top-header {
        margin-bottom: 20px;
    }

    .search-bar {
        width: 100%;
        margin-bottom: 0;
    }

    .header-actions {
        display: none; /* Hide date/time on mobile header to save space */
    }

    .categories {
        padding-bottom: 15px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding-bottom: 100px;
    }

    .product-img-container {
        height: 140px;
    }

    .cart-sidebar {
        position: fixed;
        bottom: -100%; /* Hidden by default */
        left: 0;
        width: 100%;
        height: 80vh;
        background: var(--bg-card);
        z-index: 1001;
        border-top-left-radius: 30px;
        border-top-right-radius: 30px;
        border-left: none;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
        transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 30px 20px 20px 20px;
    }

    .cart-sidebar.open {
        bottom: 0;
    }

    .cart-sidebar::before {
        content: '';
        position: absolute;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    .cart-header h3 {
        font-size: 1.2rem;
    }

    /* Modal Mobile Tweaks */
    .modal-card {
        width: 92%;
        margin: 10px;
        padding: 20px;
    }

    .option-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-overlay {
        z-index: 9999 !important;
    }
}

@media screen and (max-width: 480px) {
    .nav-item {
        width: 40px;
        height: 40px;
    }

    .products-grid {
        grid-template-columns: 1fr 1fr;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 0.95rem;
    }

    .category-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

.size-options, .payment-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.size-btn, .payment-btn {
    padding: 15px 25px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    min-width: 100px;
}

.size-btn:hover, .payment-btn:hover {
    background: var(--primary);
    color: var(--bg-card);
    border-color: var(--primary);
}

.payment-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 130px;
}

.payment-btn i {
    font-size: 1.8rem;
}

.cancel-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}

.payment-status {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
}

.status-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-panel);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.print-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-btn:hover {
    filter: brightness(1.1);
}
