/**
 * DOOK Snippets Frontend CSS
 * Styles for frontend functionality
 */

/* Cart Category Counter */
#cart-category-count {
    font-weight: bold;
    color: #333;
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    display: none; /* Hidden by default, shown via JavaScript when content exists */
    margin: 10px 0;
}

/* Sales Manager Company Info (already inline in PHP, but can be moved here) */
#salesmanager-company-info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #151c2a;
    color: #fff;
    padding: 8px 12px;
    border-radius: 35px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    font-family: Arial, sans-serif;
}


/* Custom Product Image Preview */
.custom-image-preview {
    max-width: 100px;
    max-height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 10px 0;
}

.image-preview-wrapper {
    margin: 15px 0;
}

/* Commission field styles for both classic and blocks cart */
.commission-field-container {
    margin-top: 12px !important;
    padding-top: 8px !important;
    border-top: 1px solid #eee !important;
    font-size: 13px !important;
}

.commission-field-container label {
    display: inline-block !important;
    margin-right: 8px !important;
    font-weight: normal !important;
    color: #666 !important;
    font-size: 13px !important;
}

.commission-input {
    width: 120px !important;
    padding: 4px 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    font-size: 12px !important;
}

.save-commission {
    display: inline-block !important;
    margin-left: 6px !important;
    padding: 6px 8px !important;
    background: #151b29 !important;
    color: white !important;
    border: none !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    vertical-align: middle !important;
}

.save-commission:hover {
    background: #0f1419 !important;
}

.save-commission:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Classic cart specific styles */
.woocommerce-cart .commission-field-container {
    margin-top: 12px !important;
    padding-top: 8px !important;
    border-top: 1px solid #eee !important;
}

/* Variation SKU Display */
.dook-variation-sku-wrapper {
    display: none; /* Hidden by default, shown by JS */
    margin: 10px 0;
    font-size: 14px;
    font-weight: 500;
}

.dook-variation-sku-wrapper::before {
    content: "Item number: ";
    font-weight: normal;
    color: #666;
}

/* Price Toggle Switch */
.dook-price-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dook-price-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.dook-price-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.dook-price-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #485062;
    transition: .4s;
    border-radius: 34px;
}

.dook-price-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .dook-price-toggle-slider {
    background-color: #202839;
}

input:focus + .dook-price-toggle-slider {
    box-shadow: 0 0 1px #151b29;
}

input:checked + .dook-price-toggle-slider:before {
    transform: translateX(26px);
}

.dook-price-toggle-slider.round {
    border-radius: 34px;
}

.dook-price-toggle-slider.round:before {
    border-radius: 50%;
}

/* POS Modal Styles */
#pos-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

#pos-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    z-index: 10000;
    overflow: hidden;
    flex-direction: column;
}

.pos-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pos-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

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

#close-pos-modal:hover {
    background: #f3f4f6;
    color: #374151;
}

.pos-search-container {
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

#pos-search {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    background: #f9fafb;
}

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

.pos-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

#pos-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.pos-product {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.pos-product:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.pos-product.selected {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.pos-product-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    accent-color: #10b981;
}

.pos-product h4 {
    margin: 0 20px 8px 0;
    font-size: 16px!important;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.pos-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
    margin-bottom: 8px;
}

.pos-product-sku {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.pos-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.pos-selected-count {
    font-size: 14px;
    color: #6b7280;
}

#open-pos-modal {
    margin: 20px 0;
    background: #9d9d9d;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#add-selected-pos-to-cart {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#add-selected-pos-to-cart:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

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

.pos-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
    font-size: 16px;
}

.pos-no-results {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-size: 16px;
}

@media (max-width: 768px) {
    #pos-modal {
        width: 95%;
        height: 90vh;
    }
    
    #pos-products {
        grid-template-columns: 1fr;
    }
    
    .pos-modal-header,
    .pos-search-container,
    .pos-content,
    .pos-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* General plugin styles */
.dook-snippets-frontend {
    /* Frontend-specific styles */
}
