/**
 * B2B Commerce Kit for WooCommerce - My Account Styles
 */

/* General My Account B2B Styles */
.woob2b-myaccount-quotes,
.woob2b-myaccount-quick-order,
.woob2b-myaccount-requisition-lists,
.woob2b-myaccount-company,
.woob2b-myaccount-credit,
.woob2b-myaccount-approvals {
    margin-bottom: 30px;
}

/* Status Badges */
.woob2b-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.status-converted { background: #cce5ff; color: #004085; }
.status-expired { background: #e2e3e5; color: #383d41; }
.status-active { background: #d4edda; color: #155724; }
.status-inactive { background: #f8d7da; color: #721c24; }

/* Quote Status */
.woob2b-quote-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Modal Styles */
.woob2b-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woob2b-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.woob2b-modal-small {
    max-width: 400px;
}

.woob2b-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    line-height: 1;
    transition: color 0.2s;
    background: none !important;
    border: none !important;
    padding: 5px 10px;
    z-index: 10;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
}

.woob2b-modal-close:hover,
.woob2b-modal-close:focus {
    color: #333;
    background: none !important;
    outline: none;
}

.woob2b-modal h3,
.woob2b-modal h4 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-right: 30px;
}

.woob2b-modal form .form-row {
    margin-bottom: 15px;
}

.woob2b-modal form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.woob2b-modal form input[type="text"],
.woob2b-modal form input[type="email"],
.woob2b-modal form input[type="number"],
.woob2b-modal form textarea,
.woob2b-modal form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.woob2b-modal form input:focus,
.woob2b-modal form textarea:focus,
.woob2b-modal form select:focus {
    border-color: #2c9c91;
    outline: none;
    box-shadow: 0 0 0 2px rgba(44, 156, 145, 0.1);
}

/* Company Overview */
.woob2b-company-overview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.woob2b-company-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.woob2b-company-header h3 {
    margin: 0;
    font-size: 20px;
}

.woob2b-company-details {
    display: grid;
    gap: 12px;
}

.woob2b-detail-row {
    display: flex;
    gap: 15px;
}

.woob2b-detail-label {
    font-weight: 600;
    min-width: 120px;
    color: #495057;
}

.woob2b-detail-value {
    color: #212529;
}

/* Credit Account Styles */
.woob2b-credit-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.woob2b-credit-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.woob2b-credit-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.woob2b-credit-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.woob2b-credit-card--available.status-good .woob2b-credit-value { color: #28a745; }
.woob2b-credit-card--available.status-warning .woob2b-credit-value { color: #ffc107; }
.woob2b-credit-card--available.status-critical .woob2b-credit-value { color: #dc3545; }

/* Credit Bar */
.woob2b-credit-bar-wrapper {
    margin-bottom: 20px;
}

.woob2b-credit-bar {
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.woob2b-credit-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.woob2b-credit-bar-fill.status-good { background: linear-gradient(90deg, #28a745, #20c997); }
.woob2b-credit-bar-fill.status-warning { background: linear-gradient(90deg, #ffc107, #fd7e14); }
.woob2b-credit-bar-fill.status-critical { background: linear-gradient(90deg, #dc3545, #e83e8c); }

.woob2b-credit-percentage {
    display: block;
    text-align: right;
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

/* Quick Order Styles */
.woob2b-quick-order-table {
    width: 100%;
    margin-bottom: 20px;
}

.woob2b-quick-order-table th {
    background: #f8f9fa;
    font-weight: 600;
    text-align: left;
    padding: 12px;
}

.woob2b-quick-order-table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.woob2b-quick-order-table .sku-col { width: 25%; }
.woob2b-quick-order-table .qty-col { width: 12%; }
.woob2b-quick-order-table .product-col { width: 35%; }
.woob2b-quick-order-table .price-col { width: 18%; }
.woob2b-quick-order-table .actions-col { width: 10%; text-align: center; }

.woob2b-sku-input,
.woob2b-qty-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.woob2b-sku-input:focus,
.woob2b-qty-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.woob2b-product-name {
    font-weight: 500;
}

.woob2b-product-name.found {
    color: #28a745;
}

.woob2b-product-name.not-found {
    color: #dc3545;
}

.woob2b-remove-row {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.woob2b-remove-row:hover {
    background: #c82333;
}

.woob2b-quick-order-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

/* Requisition Lists Grid */
.woob2b-lists-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.woob2b-lists-header h2 {
    margin: 0;
}

.woob2b-lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.woob2b-list-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.2s;
}

.woob2b-list-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.woob2b-list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.woob2b-list-card-header h4 {
    margin: 0;
    font-size: 16px;
}

.woob2b-list-item-count {
    background: #e9ecef;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
}

.woob2b-list-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.woob2b-list-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 15px;
}

.woob2b-list-actions {
    display: flex;
    gap: 10px;
}

.woob2b-list-actions .button {
    flex: 1;
    text-align: center;
}

/* Pagination */
.woocommerce-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.woob2b-page-info {
    color: #666;
    font-size: 14px;
}

/* Alerts */
.woob2b-credit-alert {
    margin-top: 15px;
}

/* =====================================================
   B2B Commerce Kit for WooCommerce - Unique Button Styles
   Use these classes to prevent conflicts with theme styles
   ===================================================== */

/* Primary B2B Button */
.woob2b-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.woob2b-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.4);
}

/* Primary Button (Teal/Green) */
.woob2b-btn--primary {
    background-color: #2c9c91 !important;
    color: #ffffff !important;
}

.woob2b-btn--primary:hover {
    background-color: #248a80 !important;
    color: #ffffff !important;
}

.woob2b-btn--primary:active {
    background-color: #1e756c !important;
}

/* Secondary Button */
.woob2b-btn--secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
}

.woob2b-btn--secondary:hover {
    background-color: #5a6268 !important;
    color: #ffffff !important;
}

/* Success Button (Green) */
.woob2b-btn--success {
    background-color: #28a745 !important;
    color: #ffffff !important;
}

.woob2b-btn--success:hover {
    background-color: #218838 !important;
    color: #ffffff !important;
}

/* Danger Button (Red) */
.woob2b-btn--danger {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

.woob2b-btn--danger:hover {
    background-color: #c82333 !important;
    color: #ffffff !important;
}

/* Warning Button */
.woob2b-btn--warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.woob2b-btn--warning:hover {
    background-color: #e0a800 !important;
    color: #212529 !important;
}

/* Outline Buttons */
.woob2b-btn--outline {
    background-color: transparent !important;
    border: 2px solid #2c9c91 !important;
    color: #2c9c91 !important;
}

.woob2b-btn--outline:hover {
    background-color: #2c9c91 !important;
    color: #ffffff !important;
}

.woob2b-btn--outline-danger {
    background-color: transparent !important;
    border: 2px solid #dc3545 !important;
    color: #dc3545 !important;
}

.woob2b-btn--outline-danger:hover {
    background-color: #dc3545 !important;
    color: #ffffff !important;
}

/* Small Button */
.woob2b-btn--small {
    padding: 8px 16px;
    font-size: 12px;
}

/* Large Button */
.woob2b-btn--large {
    padding: 14px 32px;
    font-size: 16px;
}

/* Full Width Button */
.woob2b-btn--full {
    width: 100%;
}

/* Disabled State */
.woob2b-btn:disabled,
.woob2b-btn--disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading State */
.woob2b-btn--loading {
    position: relative;
    pointer-events: none;
}

.woob2b-btn--loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: woob2b-spin 0.8s linear infinite;
}

@keyframes woob2b-spin {
    to { transform: rotate(360deg); }
}

/* Button Group */
.woob2b-btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.woob2b-btn-group--right {
    justify-content: flex-end;
}

.woob2b-btn-group--center {
    justify-content: center;
}

/* Icon Button */
.woob2b-btn--icon {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
}

/* Quick Order Tab Buttons */
.woob2b-tab-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    background-color: #2c9c91 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.woob2b-tab-btn:hover {
    background-color: #248a80 !important;
}

.woob2b-tab-btn.active {
    background-color: #1e756c !important;
}

/* Remove Row Button (Circle X) */
.woob2b-remove-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.woob2b-remove-row:hover {
    background-color: #c82333 !important;
}

/* Pending Count Badge */
.woob2b-pending-count {
    display: inline-block;
    min-width: 20px;
    padding: 2px 6px;
    background-color: #dc3545;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    border-radius: 10px;
    margin-left: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .woob2b-credit-summary {
        grid-template-columns: 1fr;
    }
    
    .woob2b-lists-grid {
        grid-template-columns: 1fr;
    }
    
    .woob2b-company-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .woob2b-detail-row {
        flex-direction: column;
        gap: 3px;
    }
    
    .woob2b-detail-label {
        min-width: auto;
    }
    
    .woob2b-quick-order-actions {
        flex-direction: column;
    }
    
    .woob2b-lists-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .woob2b-list-actions {
        flex-direction: column;
    }
}
