/* Vanguard Trade Basket Styles */

.vanguard-trade-basket-page,
.vanguard-trade-response,
.vanguard-select-for-trade {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.vanguard-trade-basket-page h2,
.vanguard-trade-response h2,
.vanguard-select-for-trade h2 {
    margin: 0 0 30px;
    font-size: 24px;
    font-weight: 600;
}

/* Empty basket */
.basket-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 12px;
}

.basket-empty p {
    font-size: 16px;
    color: #666;
    margin: 10px 0;
}

.btn-browse {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 30px;
    background: #d63384;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

.btn-browse:hover {
    background: #c22b76;
    color: #fff;
}

/* Vendor basket section */
.vendor-basket {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 30px;
    overflow: hidden;
}

.vendor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.vendor-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.vendor-header .item-count {
    background: #d63384;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Basket items */
.basket-items {
    padding: 15px;
}

.basket-item,
.requested-item,
.selection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.basket-item:last-child,
.requested-item:last-child {
    margin-bottom: 0;
}

.basket-item:hover,
.requested-item:hover {
    background: #f0f0f0;
}

.basket-item.ui-sortable-helper {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.basket-item.ui-sortable-placeholder {
    background: #e0e0e0;
    border: 2px dashed #aaa;
    visibility: visible !important;
}

/* Make entire item draggable on touch */
.basket-item {
    cursor: move;
    -webkit-user-select: none;
    user-select: none;
}

.drag-handle {
    color: #999;
    font-size: 16px;
    padding: 0 5px;
}

.item-order {
    width: 28px;
    height: 28px;
    background: #d63384;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.item-thumb {
    width: 50px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.item-thumb.no-image {
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-info strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-info .condition {
    font-size: 12px;
    color: #666;
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 4px;
}

.btn-remove {
    width: 30px;
    height: 30px;
    border: none;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
}

.btn-remove:hover {
    background: #c82333;
}

/* Options */
.basket-options {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.priority-mode {
    margin-bottom: 15px;
}

.priority-mode label {
    display: block;
    margin: 8px 0;
    cursor: pointer;
}

.priority-mode label:first-child {
    font-weight: 600;
    cursor: default;
}

.message-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.message-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Actions */
.basket-actions,
.response-actions,
.selection-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-clear,
.btn-reject,
.btn-cancel-selection {
    padding: 14px 24px;
    background: #fff;
    border: 2px solid #dc3545;
    color: #dc3545;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    min-height: 48px;
}

.btn-clear:hover,
.btn-reject:hover,
.btn-cancel-selection:hover {
    background: #dc3545;
    color: #fff;
}

.btn-submit-trade,
.btn-accept-trade,
.btn-confirm-selection {
    padding: 14px 30px;
    background: #d63384;
    border: none;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    min-height: 48px;
}

.btn-submit-trade:hover,
.btn-accept-trade:hover,
.btn-confirm-selection:hover {
    background: #c22b76;
}

.btn-submit-trade:disabled,
.btn-accept-trade:disabled,
.btn-confirm-selection:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-view-shelf {
    padding: 14px 24px;
    background: #fff;
    border: 2px solid #d63384;
    color: #d63384;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-view-shelf:hover {
    background: #d63384;
    color: #fff;
}

/* Loading state */
.btn-submit-trade.is-loading,
.btn-accept-trade.is-loading,
.btn-confirm-selection.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Trade Response Page */
.request-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.request-message {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.priority-note {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.requested-items {
    margin-bottom: 20px;
}

.requested-items h3 {
    margin: 0 0 15px;
    font-size: 18px;
}

.item-action {
    flex-shrink: 0;
}

/* Accept item button - large and tap-friendly */
.btn-accept-item {
    padding: 12px 24px;
    background: #fff;
    border: 2px solid #d63384;
    color: #d63384;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    min-width: 100px;
    min-height: 48px;
    transition: all 0.2s;
}

.btn-accept-item:hover:not(:disabled) {
    background: #d63384;
    color: #fff;
}

.btn-accept-item.accepted {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

.btn-accept-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Remove old checkbox toggle styles */
.accept-toggle {
    display: none;
}

.response-summary {
    background: #fff3cd;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.threshold-note {
    font-size: 13px;
    color: #856404;
    margin: 5px 0 0;
}

/* Selection Grid */
.selection-header {
    margin-bottom: 20px;
}

.selection-counter {
    background: #d63384;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.selection-item {
    flex-direction: column;
    text-align: center;
    padding: 15px;
    cursor: pointer;
    border: 2px solid transparent;
}

.selection-item:hover {
    border-color: #d63384;
}

.selection-item.selected {
    background: #f8d7e3;
    border-color: #d63384;
}

.selection-item .item-thumb {
    width: 80px;
    height: 110px;
    margin: 0 auto 10px;
}

.selection-item .item-info {
    margin-bottom: 10px;
}

.btn-select-item {
    padding: 12px 24px;
    background: #d63384;
    border: none;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    min-height: 48px;
    min-width: 120px;
}

.btn-select-item:hover {
    background: #c22b76;
}

.selection-item.selected .btn-select-item {
    background: #28a745;
}

.selection-item.selected .btn-select-item::before {
    content: "✓ ";
}

/* Response Status */
.response-status {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 12px;
}

.response-status.status-matched {
    background: #d4edda;
}

.response-status.status-rejected {
    background: #f8d7da;
}

.btn-continue {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 30px;
    background: #d63384;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

/* Floating basket */
.vanguard-floating-basket {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #d63384;
    color: #fff;
    padding: 12px 18px;
    border-radius: 30px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 9999;
    font-weight: 600;
    transition: transform 0.2s;
}

.vanguard-floating-basket:hover {
    transform: scale(1.05);
    color: #fff;
}

.vanguard-floating-basket .basket-icon {
    font-size: 18px;
}

.vanguard-floating-basket .basket-count {
    background: #fff;
    color: #d63384;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Toast notification - STICKY until dismissed */
.vanguard-trade-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 280px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.vanguard-trade-toast.toast-visible {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 600px) {
    .vendor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .basket-actions,
    .response-actions,
    .selection-actions {
        flex-direction: column;
    }
    
    .btn-clear,
    .btn-submit-trade,
    .btn-reject,
    .btn-view-shelf,
    .btn-accept-trade,
    .btn-cancel-selection,
    .btn-confirm-selection {
        width: 100%;
        text-align: center;
    }
    
    .basket-item,
    .requested-item {
        flex-wrap: wrap;
    }
    
    .item-info {
        flex: 1 1 60%;
    }
    
    .selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .vanguard-floating-basket .basket-label {
        display: none;
    }
}

/* ========================================
   Counter-Offer Page Styles
   ======================================== */

.vanguard-counter-offer {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.vanguard-counter-offer h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

.counter-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #d63384;
}

.counter-summary p {
    margin: 0 0 10px 0;
}

.counter-summary .rejected-notice {
    color: #856404;
    background: #fff3cd;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 15px;
}

.counter-section {
    margin-bottom: 30px;
}

.counter-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.counter-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.counter-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.counter-item.accepted {
    border-left: 4px solid #28a745;
}

.counter-item.selection {
    border-left: 4px solid #d63384;
}

.counter-item.rejected {
    border-left: 4px solid #dc3545;
    opacity: 0.7;
    background: #f8f8f8;
}

.counter-item .item-thumb {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.counter-item .item-info {
    flex: 1;
}

.counter-item .item-info strong {
    display: block;
    font-size: 15px;
    margin-bottom: 5px;
}

.counter-item .item-info .condition {
    font-size: 13px;
    color: #666;
}

.counter-item .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.counter-item .status-badge.rejected {
    background: #f8d7da;
    color: #721c24;
}

.accepted-section h3 {
    color: #28a745;
}

.rejected-section h3 {
    color: #dc3545;
}

.counter-trade-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.counter-trade-summary h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.trade-summary-table {
    width: 100%;
    border-collapse: collapse;
}

.trade-summary-table td {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.trade-summary-table tr:last-child td {
    border-bottom: none;
    font-size: 18px;
}

.counter-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn-accept-counter,
.btn-decline-counter {
    padding: 14px 30px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    min-height: 48px;
    border: none;
}

.btn-accept-counter {
    background: #28a745;
    color: #fff;
}

.btn-accept-counter:hover {
    background: #218838;
}

.btn-decline-counter {
    background: #fff;
    color: #dc3545;
    border: 2px solid #dc3545;
}

.btn-decline-counter:hover {
    background: #dc3545;
    color: #fff;
}

.btn-accept-counter:disabled,
.btn-decline-counter:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.counter-help {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 20px;
}

/* Requester/Vendor status pages */
.response-status {
    text-align: center;
    padding: 40px 20px;
}

.response-status h3 {
    font-size: 22px;
    margin-bottom: 20px;
}

.btn-continue {
    display: inline-block;
    padding: 12px 24px;
    background: #d63384;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}

.btn-continue:hover {
    background: #c22b76;
    color: #fff;
}

.status-matched .btn-continue {
    background: #28a745;
}

.status-matched .btn-continue:hover {
    background: #218838;
}

@media (max-width: 600px) {
    .counter-actions {
        flex-direction: column;
    }
    
    .btn-accept-counter,
    .btn-decline-counter {
        width: 100%;
    }
    
    .counter-item {
        flex-wrap: wrap;
    }
}

/* ========================================
   Trades Dashboard Styles
   ======================================== */

.vanguard-trades-dashboard {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.vanguard-trades-dashboard h2 {
    font-size: 28px;
    margin-bottom: 25px;
    color: #333;
}

.trades-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.trades-tabs .tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    position: relative;
    bottom: -2px;
    border-bottom: 2px solid transparent;
}

.trades-tabs .tab-btn:hover {
    color: #d63384;
}

.trades-tabs .tab-btn.active {
    color: #d63384;
    border-bottom-color: #d63384;
}

.trades-tabs .tab-btn .count {
    display: inline-block;
    background: #e0e0e0;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    margin-left: 6px;
}

.trades-tabs .tab-btn.active .count {
    background: #d63384;
    color: #fff;
}

.no-trades {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.trade-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.trade-card.status-pending {
    border-left: 4px solid #ffc107;
}

.trade-card.status-selecting {
    border-left: 4px solid #17a2b8;
}

.trade-card.status-counter_offer {
    border-left: 4px solid #fd7e14;
}

.trade-card.status-matched {
    border-left: 4px solid #28a745;
}

.trade-card.status-completed {
    border-left: 4px solid #6c757d;
    opacity: 0.8;
}

.trade-card.status-rejected,
.trade-card.status-cancelled {
    border-left: 4px solid #dc3545;
    opacity: 0.6;
}

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

.trade-from {
    font-size: 16px;
}

.trade-from strong {
    color: #666;
    font-weight: normal;
}

.trade-date {
    font-size: 13px;
    color: #888;
}

.trade-body {
    margin-bottom: 15px;
}

.trade-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.trade-info .item-count {
    font-size: 15px;
    color: #333;
}

.trade-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.trade-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.trade-status.status-selecting {
    background: #d1ecf1;
    color: #0c5460;
}

.trade-status.status-counter_offer {
    background: #ffe5d0;
    color: #a94c00;
}

.trade-status.status-matched {
    background: #d4edda;
    color: #155724;
}

.trade-status.status-completed {
    background: #e2e3e5;
    color: #383d41;
}

.trade-status.status-rejected,
.trade-status.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.trade-message {
    margin-top: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    color: #555;
}

.trade-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.btn-action {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: none;
}

.btn-action.btn-respond {
    background: #d63384;
    color: #fff;
}

.btn-action.btn-respond:hover {
    background: #c22b76;
    color: #fff;
}

.btn-action.btn-cart {
    background: #28a745;
    color: #fff;
}

.btn-action.btn-cart:hover {
    background: #218838;
    color: #fff;
}

.btn-action.btn-cancel-trade {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-action.btn-cancel-trade:hover {
    background: #dc3545;
    color: #fff;
}

.status-note {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.status-note.completed {
    color: #28a745;
    font-style: normal;
}

@media (max-width: 600px) {
    .trades-tabs {
        flex-direction: column;
        gap: 0;
    }
    
    .trades-tabs .tab-btn {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .trade-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .trade-actions {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   BASKET TIMEOUT STYLES
   ========================================================================== */

/* Timeout notice at top of basket */
.basket-timeout-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

.basket-timeout-notice .timeout-icon {
    font-size: 18px;
}

/* Individual item timer */
.item-timer {
    display: inline-block;
    font-size: 11px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}

.item-timer.urgent {
    background: #fff3cd;
    color: #856404;
    font-weight: 600;
    animation: pulse-urgent 2s ease-in-out infinite;
}

.item-timer.expired {
    background: #f8d7da;
    color: #721c24;
    font-weight: 600;
}

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

/* Expired item styling */
.basket-item[data-expired="true"] {
    opacity: 0.5;
    pointer-events: none;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .basket-timeout-notice {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .item-timer {
        display: block;
        margin-top: 6px;
    }
}
