/**
 * POS Honesty Bar - Mobile-First Clean Design 2024
 * 
 * Brand Colors:
 * - Primary: #4D5A52 (Forest Green)
 * - Background: #E8E9E3 (Light Sage)
 * - Surface: #FFFFFF (White)
 * - Text: #2C3E50 (Dark Blue-Gray)
 * - Secondary Text: #6B7280 (Medium Gray)
 * 
 * Design Principles:
 * - 0px border-radius everywhere (except circular price tags)
 * - Mobile-first approach
 * - Clean product layout: image → name → circular price
 */

/* ==========================================================================
   CSS Variables & Base Styles
   ========================================================================== */

/* Ensure Elementor widget takes full width */
.elementor-widget-pos-honesty-bar {
    width: 100% !important;
}

.elementor-widget-pos-honesty-bar .elementor-widget-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Override any Elementor column or section width restrictions */
.elementor-element.elementor-widget-pos-honesty-bar {
    width: 100% !important;
    max-width: none !important;
}

.elementor-element.elementor-widget-pos-honesty-bar > .elementor-widget-container {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.pos-honesty-bar-widget {
    --primary-color: #4D5A52;
    --background-color: #E8E9E3;
    --surface-color: #FFFFFF;
    --text-primary: #2C3E50;
    --text-secondary: #6B7280;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

.pos-honesty-bar-widget {
    position: relative;
    width: 100%;
    max-width: none;
    margin: 0;
    background: var(--background-color);
    border-radius: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

.pos-honesty-bar-widget * {
    box-sizing: border-box;
}

/* ==========================================================================
   Header Section
   ========================================================================== */

.pos-widget-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3a4540 100%);
    color: white;
    padding: var(--spacing-lg);
    text-align: center;
    position: relative;
    border-radius: 0;
}

.pos-welcome-message {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

/* ==========================================================================
   Widget Body Layout
   ========================================================================== */

.pos-widget-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    background: var(--surface-color);
    padding: var(--spacing-lg);
    min-height: 60vh;
    width: 100%;
    box-sizing: border-box;
}

.pos-products-section {
    flex: 1;
    background: var(--surface-color);
    border-radius: 0;
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   Product Filters
   ========================================================================== */

.pos-product-filters {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    align-items: center;
}

.pos-search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.pos-search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 48px;
    border: 2px solid #E5E7EB;
    border-radius: 0;
    font-size: 16px;
    background: var(--surface-color);
    transition: all 0.3s ease;
    font-weight: 500;
}

.pos-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(77, 90, 82, 0.1);
}

.pos-search-btn {
    position: absolute;
    left: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
}

.pos-category-filter select,
.pos-sort-filter select {
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid #E5E7EB;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    background: var(--surface-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.pos-category-filter select:focus,
.pos-sort-filter select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(77, 90, 82, 0.1);
}

/* ==========================================================================
   Products Grid - Clean Layout
   ========================================================================== */

.pos-products-grid {
    position: relative;
}

.pos-products-loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 500;
}

.pos-products-container {
    display: grid;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

/* Responsive Grid Layout */
.pos-products-grid-1 .pos-products-container { grid-template-columns: 1fr; }
.pos-products-grid-2 .pos-products-container { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.pos-products-grid-3 .pos-products-container { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.pos-products-grid-4 .pos-products-container { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pos-products-grid-5 .pos-products-container { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pos-products-grid-6 .pos-products-container { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ==========================================================================
   Product Cards - Clean Design: Image → Name → Circular Price
   ========================================================================== */

.pos-honesty-bar-widget .pos-product-card {
    background: var(--surface-color);
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.pos-honesty-bar-widget .pos-product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.pos-honesty-bar-widget .pos-product-card.adding-to-cart {
    transform: scale(0.98);
    opacity: 0.8;
    pointer-events: none;
}

.pos-honesty-bar-widget .pos-product-card.adding-to-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(77, 90, 82, 0.1), rgba(77, 90, 82, 0.2));
    border-radius: 0;
    z-index: 1;
}

/* Product Image Container */
.pos-honesty-bar-widget .pos-product-image {
    position: relative;
    width: 100%;
    height: 160px;
    background: #FFFFFF;
    border-radius: 0;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.pos-honesty-bar-widget .pos-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pos-honesty-bar-widget .pos-product-card:hover .pos-product-image img {
    transform: scale(1.05);
}

/* Product Info Container */
.pos-honesty-bar-widget .pos-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
}

/* Product Name */
.pos-honesty-bar-widget .pos-product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.4;
    text-align: center;
    letter-spacing: -0.025em;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

/* Circular Price Tag */
.pos-honesty-bar-widget .pos-product-price {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    z-index: 2;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.025em;
    margin: 0 auto;
    flex-shrink: 0;
}

/* ==========================================================================
   Shopping Cart - Mobile-First Design
   ========================================================================== */

.pos-cart-sidebar {
    width: 100%;
    max-width: 400px;
    background: var(--surface-color);
    border-radius: 0;
    box-shadow: var(--shadow-sm);
    margin-top: var(--spacing-lg);
    box-sizing: border-box;
}

.pos-shopping-cart {
    padding: var(--spacing-lg);
}

.pos-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid #F3F4F6;
}

.pos-cart-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.pos-cart-count {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Cart Items */
.pos-cart-items {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: var(--spacing-lg);
}

.pos-cart-item {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-direction: column;
}

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

.pos-cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 0;
    overflow: hidden;
    flex-shrink: 0;
    background: #F9FAFB;
}

.pos-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.pos-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.pos-cart-item-price {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

/* Styled Quantity Controls */
.pos-cart-item-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.pos-cart-item-quantity {
    display: flex;
    align-items: center;
    border: 2px solid #E5E7EB;
    border-radius: 0;
    overflow: hidden;
    background: var(--surface-color);
}

.pos-cart-item-quantity button {
    width: 32px;
    height: 32px;
    border: none;
    background: #F3F4F6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.pos-cart-item-quantity button:hover {
    background: var(--primary-color);
    color: white;
}

.pos-cart-item-quantity button:active {
    transform: scale(0.95);
}

.pos-cart-item-quantity input {
    width: 65px;
    height: 32px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    background: white;
    color: var(--text-primary);
}

.pos-cart-item-quantity input:focus {
    outline: none;
    background: #F9FAFB;
}

.pos-remove-item-btn {
    color: #EF4444;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 0;
    transition: all 0.2s ease;
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pos-remove-item-btn:hover {
    background: #FEF2F2;
    color: #DC2626;
}

/* Cart Total */
.pos-cart-total {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--background-color) 0%, #dfe0db 100%);
    border-radius: 0;
    text-align: center;
}

.pos-total-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Cart Actions */
.pos-cart-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.pos-btn {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0;
    text-align: center;
}

.pos-btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.pos-btn-primary:hover {
    background: #3a4540;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.pos-btn-secondary {
    background: #F3F4F6;
    color: var(--text-primary);
    border: 1px solid #E5E7EB;
}

.pos-btn-secondary:hover {
    background: #E5E7EB;
}

/* Empty Cart State */
.pos-cart-empty {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.pos-cart-empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

/* ==========================================================================
   Mobile Responsiveness - Mobile First
   ========================================================================== */

/* Mobile Optimization (Default - under 640px) */
@media (max-width: 640px) {
    .pos-honesty-bar-widget {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .pos-widget-header {
        padding: var(--spacing-md);
    }

    .pos-widget-body {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }

    .pos-products-section {
        padding: var(--spacing-md);
    }

    .pos-product-filters {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .pos-search-box {
        min-width: auto;
    }

    .pos-products-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--spacing-sm);
    }

    .pos-honesty-bar-widget .pos-product-card {
        min-height: 240px;
        padding: var(--spacing-sm);
    }

    .pos-honesty-bar-widget .pos-product-image {
        height: 120px;
        margin-bottom: var(--spacing-sm);
    }

    .pos-honesty-bar-widget .pos-product-name {
        font-size: 14px;
        min-height: 36px;
        margin-bottom: var(--spacing-sm);
    }

    .pos-honesty-bar-widget .pos-product-price {
        width: 50px;
        height: 50px;
        font-size: 12px;
    }

    /* Mobile Cart Improvements */
    .pos-cart-actions {
        flex-direction: column;
    }

    .pos-cart-item {
        padding: var(--spacing-sm) 0;
    }

    .pos-cart-item-image {
        width: 50px;
        height: 50px;
    }

    .pos-cart-item-name {
        font-size: 13px;
    }

    .pos-cart-item-quantity {
        transform: scale(0.9);
    }
}

/* Extra Small Mobile */
@media (max-width: 375px) {
    .pos-products-container {
        grid-template-columns: 1fr !important;
    }

    .pos-honesty-bar-widget .pos-product-card {
        min-height: 220px;
    }

    .pos-honesty-bar-widget .pos-product-image {
        height: 100px;
    }

    .pos-honesty-bar-widget .pos-product-price {
        width: 45px;
        height: 45px;
        font-size: 11px;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .pos-widget-body {
        flex-direction: row;
        align-items: flex-start;
    }

    .pos-cart-sidebar {
        width: 320px;
        min-width: 280px;
        margin-top: 0;
        margin-left: var(--spacing-lg);
        flex-shrink: 0;
    }

    .pos-products-section {
        flex: 1;
        min-width: 0;
    }

    .pos-products-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .pos-widget-body {
        flex-direction: row;
        align-items: flex-start;
    }

    .pos-cart-sidebar {
        width: 350px;
        min-width: 350px;
        max-width: 400px;
        margin-top: 0;
        margin-left: var(--spacing-xl);
        flex-shrink: 0;
    }
    
    .pos-products-section {
        flex: 1;
        min-width: 0;
    }
}

/* ==========================================================================
   Animations & Interactions
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pos-honesty-bar-widget .pos-product-card {
    animation: fadeIn 0.4s ease-out;
}

/* Focus States for Accessibility */
.pos-honesty-bar-widget .pos-product-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.pos-search-input:focus,
.pos-category-filter select:focus,
.pos-sort-filter select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Button Focus States */
.pos-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.pos-cart-item-quantity button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

/* ==========================================================================
   Loading & Success States
   ========================================================================== */

.pos-adding-to-cart {
    position: relative;
}

.pos-adding-to-cart::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 10;
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Add Indicator Styles
   ========================================================================== */

.pos-add-indicator {
    display: inline-flex;
    justify-content: center;
    margin: 5px 0px 5px 0px;
}

.pos-tap-to-add {
    background:#738760;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    animation: pulse 1.5s infinite;
    white-space: nowrap;
}

.pos-added-to-cart {
    background: var(--primary-color, #4D5A52);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Notification Styles
   ========================================================================== */

.pos-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    padding: 16px 20px;
    background: white;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #4D5A52;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pos-notification-show {
    opacity: 1;
    transform: translateX(0);
}

.pos-notification-success {
    border-left-color: #10B981;
}

.pos-notification-error {
    border-left-color: #EF4444;
}

.pos-notification-info {
    border-left-color: #3B82F6;
}

.pos-notification-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
}

.pos-notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #9CA3AF;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.pos-notification-close:hover {
    color: #374151;
}

/* Mobile responsiveness for notifications */
@media (max-width: 640px) {
    .pos-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .pos-notification-show {
        transform: translateY(0);
    }
} 