/* Wholesale Order System Frontend Styles - Modernized & High Priority */

#wos-plugin-root {
    --wos-primary: #4f46e5;
    --wos-primary-hover: #4338ca;
    --wos-primary-light: #e0e7ff;
    --wos-text-main: #111827;
    --wos-text-muted: #4b5563;
    --wos-border: #e5e7eb;
    --wos-bg: #f9fafb;
    --wos-card-bg: #ffffff;
    --wos-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --wos-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --wos-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --wos-shadow-glow: 0 0 20px rgba(79, 70, 229, 0.15);
    --wos-radius: 16px;
    --wos-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#wos-plugin-root {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    color: var(--wos-text-main) !important;
    box-sizing: border-box !important;
    position: relative;
}

#wos-plugin-root *, #wos-plugin-root *::before, #wos-plugin-root *::after {
    box-sizing: inherit !important;
}

/* Customer Details Section */
#wos-plugin-root .wos-customer-details {
    background: var(--wos-card-bg) !important;
    padding: 30px !important;
    border-radius: var(--wos-radius) !important;
    margin-bottom: 30px !important;
    box-shadow: var(--wos-shadow-md) !important;
    border: 1px solid var(--wos-border) !important;
    position: relative;
    overflow: hidden;
}

#wos-plugin-root .wos-customer-details::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--wos-primary), #ec4899);
}

#wos-plugin-root .wos-customer-details h3 {
    margin-top: 0 !important;
    margin-bottom: 25px !important;
    color: var(--wos-text-main) !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    clear: none !important;
}

#wos-plugin-root .wos-customer-details h3 svg {
    width: 28px !important;
    height: 28px !important;
    color: var(--wos-primary) !important;
}

#wos-plugin-root .wos-customer-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
}

#wos-plugin-root .wos-customer-grid .full-width {
    grid-column: span 2 !important;
}

#wos-plugin-root .wos-input-group {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
}

#wos-plugin-root .wos-input-icon {
    position: absolute !important;
    left: 14px !important;
    top: 14px !important;
    width: 20px !important;
    height: 20px !important;
    color: #9ca3af !important;
    pointer-events: none !important;
    transition: var(--wos-transition) !important;
}

#wos-plugin-root .wos-input, 
#wos-plugin-root .wos-textarea {
    width: 100% !important;
    padding: 12px 14px 12px 42px !important;
    border: 2px solid var(--wos-border) !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    background: #fff !important;
    color: var(--wos-text-main) !important;
    transition: var(--wos-transition) !important;
    margin: 0 !important;
    box-shadow: none !important;
    line-height: 1.5 !important;
}

#wos-plugin-root .wos-input:focus, 
#wos-plugin-root .wos-textarea:focus {
    outline: none !important;
    border-color: var(--wos-primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15) !important;
}

#wos-plugin-root .wos-input:focus + .wos-input-icon,
#wos-plugin-root .wos-textarea:focus + .wos-input-icon {
    color: var(--wos-primary) !important;
}

#wos-plugin-root .wos-textarea {
    height: 110px !important;
    resize: vertical !important;
    padding-top: 14px !important;
}

#wos-plugin-root .wos-section-divider {
    height: 1px !important;
    background: var(--wos-border) !important;
    border: none !important;
    margin: 40px 0 !important;
}

/* Products Grid - Upgraded Cards */
#wos-plugin-root .wos-products-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 30px !important;
    margin-bottom: 120px !important;
}

#wos-plugin-root .wos-product-card {
    background: var(--wos-card-bg) !important;
    border: 1px solid var(--wos-border) !important;
    border-radius: var(--wos-radius) !important;
    padding: 0 !important;
    box-shadow: var(--wos-shadow-sm) !important;
    transition: var(--wos-transition) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
}

#wos-plugin-root .wos-product-card:hover {
    box-shadow: var(--wos-shadow-glow), var(--wos-shadow-lg) !important;
    transform: translateY(-4px) !important;
    border-color: var(--wos-primary-light) !important;
}

#wos-plugin-root .wos-card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    padding: 20px 24px !important;
    border-bottom: 1px solid var(--wos-border) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

#wos-plugin-root .wos-card-icon {
    width: 36px !important;
    height: 36px !important;
    background: #fff !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    color: var(--wos-primary) !important;
}
#wos-plugin-root .wos-card-icon svg { width: 20px; height: 20px; }

#wos-plugin-root .wos-product-card h3 {
    margin: 0 !important;
    color: var(--wos-text-main) !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
}

#wos-plugin-root .wos-card-body {
    padding: 0 !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Responsive Table Styling inside Cards */
#wos-plugin-root .wos-table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px 24px 24px !important; /* Internal padding so shadows/focus rings don't clip */
}

/* Custom Scrollbar for tables */
#wos-plugin-root .wos-table-responsive::-webkit-scrollbar {
    height: 6px !important;
}
#wos-plugin-root .wos-table-responsive::-webkit-scrollbar-track {
    background: var(--wos-bg) !important; 
    border-radius: 4px !important;
}
#wos-plugin-root .wos-table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important; 
    border-radius: 4px !important;
}
#wos-plugin-root .wos-table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--wos-text-muted) !important;
}

#wos-plugin-root .wos-variant-table, 
#wos-plugin-root .wos-normal-table {
    width: 100% !important;
    border-collapse: collapse !important;
    min-width: 280px !important;
    margin-top: 10px !important;
}

#wos-plugin-root .wos-variant-table th, 
#wos-plugin-root .wos-variant-table td,
#wos-plugin-root .wos-normal-table th, 
#wos-plugin-root .wos-normal-table td {
    padding: 12px 10px !important;
    text-align: center !important;
    border: 1px solid var(--wos-border) !important;
    font-size: 14px !important;
    vertical-align: middle !important;
    color: var(--wos-text-main) !important;
}

#wos-plugin-root .wos-variant-table tr:hover td,
#wos-plugin-root .wos-normal-table tr:hover td {
    background: var(--wos-bg) !important;
}

#wos-plugin-root .wos-variant-table th, 
#wos-plugin-root .wos-normal-table th {
    background: #f8fafc !important;
    font-weight: 600 !important;
    color: var(--wos-text-muted) !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    letter-spacing: 0.08em !important;
    border-bottom: 2px solid var(--wos-border) !important;
}

#wos-plugin-root .wos-variant-table th:first-child, 
#wos-plugin-root .wos-normal-table th:first-child,
#wos-plugin-root .wos-variant-table td:first-child, 
#wos-plugin-root .wos-normal-table td:first-child {
    text-align: left !important;
}

#wos-plugin-root .wos-item-title {
    display: block !important;
    font-weight: 600 !important;
    color: var(--wos-text-main) !important;
    margin-bottom: 4px !important;
}

#wos-plugin-root .wos-sku-label {
    display: inline-block !important;
    font-size: 11px !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    color: var(--wos-primary) !important;
    background: var(--wos-primary-light) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
}

#wos-plugin-root .wos-qty-input {
    width: 65px !important;
    padding: 10px 8px !important;
    border: 2px solid var(--wos-border) !important;
    border-radius: 8px !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: var(--wos-transition) !important;
    background: var(--wos-bg) !important;
    margin: 0 auto !important;
    color: var(--wos-text-main) !important;
    display: block !important;
    box-sizing: border-box !important;
}

#wos-plugin-root .wos-qty-input:focus {
    outline: none !important;
    border-color: var(--wos-primary) !important;
    background: var(--wos-card-bg) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2) !important;
}

/* Submit Container */
#wos-plugin-root .wos-submit-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    padding: 20px !important;
    border-top: 1px solid rgba(229, 231, 235, 0.5) !important;
    text-align: center !important;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.05) !important;
    z-index: 99999 !important;
}

#wos-plugin-root .wos-submit-btn {
    background: var(--wos-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 16px 48px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    transition: var(--wos-transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px !important;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

#wos-plugin-root .wos-submit-btn:hover {
    background: var(--wos-primary-hover) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 25px rgba(79, 70, 229, 0.4) !important;
}

#wos-plugin-root .wos-submit-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3) !important;
}

#wos-plugin-root .wos-submit-btn svg {
    width: 22px !important;
    height: 22px !important;
}

/* Animations */
@keyframes wosFadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

#wos-plugin-root .wos-product-card {
    animation: wosFadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    opacity: 0;
}

/* Stagger animations conceptually */
#wos-plugin-root .wos-product-card:nth-child(1) { animation-delay: 0.05s !important; }
#wos-plugin-root .wos-product-card:nth-child(2) { animation-delay: 0.1s !important; }
#wos-plugin-root .wos-product-card:nth-child(3) { animation-delay: 0.15s !important; }
#wos-plugin-root .wos-product-card:nth-child(4) { animation-delay: 0.2s !important; }
#wos-plugin-root .wos-product-card:nth-child(5) { animation-delay: 0.25s !important; }
#wos-plugin-root .wos-product-card:nth-child(6) { animation-delay: 0.3s !important; }

/* Success Modal */
#wos-plugin-root .wos-success-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(17, 24, 39, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999999 !important;
    padding: 20px !important;
    animation: wosFadeInUp 0.3s ease-out forwards !important;
}

#wos-plugin-root .wos-success-modal {
    background: #ffffff !important;
    border-radius: 24px !important;
    padding: 40px !important;
    max-width: 440px !important;
    width: 100% !important;
    text-align: center !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
    transform: scale(0.95);
    animation: wosModalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes wosModalPop {
    to { transform: scale(1); }
}

#wos-plugin-root .wos-success-icon {
    width: 80px !important;
    height: 80px !important;
    background: #dcfce7 !important;
    color: #16a34a !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 20px !important;
    box-shadow: 0 0 0 10px rgba(220, 252, 231, 0.5) !important;
}

#wos-plugin-root .wos-success-icon svg {
    width: 40px !important;
    height: 40px !important;
}

#wos-plugin-root .wos-success-modal h2 {
    margin: 0 0 12px !important;
    font-size: 26px !important;
    color: var(--wos-text-main) !important;
    font-weight: 800 !important;
}

#wos-plugin-root .wos-success-modal p {
    margin: 0 0 32px !important;
    color: var(--wos-text-muted) !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
}

#wos-plugin-root .wos-success-btn {
    display: inline-block !important;
    background: var(--wos-primary) !important;
    color: #ffffff !important;
    padding: 14px 40px !important;
    border-radius: 50px !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    transition: var(--wos-transition) !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3) !important;
}

#wos-plugin-root .wos-success-btn:hover {
    background: var(--wos-primary-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4) !important;
}

/* Error Modal Theme */
#wos-plugin-root .wos-error-icon {
    width: 80px !important;
    height: 80px !important;
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 20px !important;
    box-shadow: 0 0 0 10px rgba(254, 226, 226, 0.5) !important;
}

#wos-plugin-root .wos-error-icon svg {
    width: 40px !important;
    height: 40px !important;
}

#wos-plugin-root .wos-error-btn {
    display: inline-block !important;
    background: #dc2626 !important;
    color: #ffffff !important;
    padding: 14px 40px !important;
    border-radius: 50px !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    transition: var(--wos-transition) !important;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3) !important;
}

#wos-plugin-root .wos-error-btn:hover {
    background: #b91c1c !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.4) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #wos-plugin-root .wos-customer-grid {
        grid-template-columns: 1fr !important;
    }
    
    #wos-plugin-root .wos-customer-grid .full-width {
        grid-column: span 1 !important;
    }
    
    #wos-plugin-root .wos-products-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    #wos-plugin-root .wos-customer-details {
        padding: 20px !important;
    }
    
    #wos-plugin-root .wos-card-header {
        padding: 16px 20px !important;
    }
    
    #wos-plugin-root .wos-table-responsive {
        padding: 5px 20px 20px !important;
    }
}