/**
 * Tradeline Table Styles - Minimalist Design
 */

/* Wrapper */
.tradeline-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
}

/* Sort Instruction */
.sort-instruction {
    text-align: center;
    margin: 30px 0 20px;
}

.sort-instruction h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    text-decoration: underline;
    margin: 0;
}

/* Filters */
.tradeline-filters {
    background: #ffffff;
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
}

.filter-select,
.filter-input {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #E8DC4F;
    box-shadow: 0 0 0 2px rgba(232, 220, 79, 0.2);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-inputs input {
    flex: 1;
}

.range-inputs span {
    color: #666;
    font-weight: 500;
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons - Yellow Theme */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-primary {
    background: #E8DC4F;
    color: #2c3e50;
}

.btn-primary:hover {
    background: #dcc940;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(232, 220, 79, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Add to Cart Button - Yellow */
.btn-add-to-cart {
    background: #E8DC4F;
    color: #2c3e50;
    padding: 10px 20px;
    font-size: 13px;
    border-radius: 6px;
    white-space: nowrap;
}

.btn-add-to-cart:hover {
    background: #dcc940;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Show All Button */
.show-all-wrapper {
    text-align: center;
    padding: 20px 0;
}

.btn-show-all {
    background: #E8DC4F;
    color: #2c3e50;
    padding: 12px 40px;
    font-size: 15px;
    font-weight: 600;
}

.btn-show-all:hover {
    background: #dcc940;
}

/* Table */
.tradeline-table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tradeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
}

/* Table Header */
.tradeline-table thead {
    background: #f0f0f0;
}

.tradeline-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    position: relative;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

.tradeline-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.tradeline-table th.sortable:hover {
    background: #e8e8e8;
}

/* Sort Icons - Dropdown Arrows */
.tradeline-table th i {
    margin-left: 5px;
    font-size: 10px;
    opacity: 0.5;
    display: inline-block;
}

.tradeline-table th.sortable i:before {
    content: "▼";
    font-family: Arial, sans-serif;
    font-style: normal;
}

/* Table Body */
.tradeline-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
    transition: background-color 0.2s;
}

.tradeline-table tbody tr:hover {
    background: #f9f9f9;
}

.tradeline-table tbody tr:last-child {
    border-bottom: none;
}

.tradeline-table td {
    padding: 14px 12px;
    vertical-align: middle;
    color: #555;
}

/* Hidden rows */
.tradeline-hidden {
    display: none;
}

.tradeline-visible {
    display: table-row;
    animation: fadeInRow 0.3s ease-in;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Availability Badge */
.availability-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.availability-badge.in-stock {
    background: #d4edda;
    color: #155724;
}

.availability-badge.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

/* Out of Stock Label */
.out-of-stock-label {
    color: #dc3545;
    font-weight: 600;
    font-size: 13px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px 20px !important;
    color: #6c757d;
    font-size: 15px;
}

/* Loading */
#tradeline-loading {
    text-align: center;
    padding: 40px;
    background: #ffffff;
    border-radius: 8px;
    margin-top: 20px;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #E8DC4F;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tradeline-wrapper {
        padding: 10px;
    }

    .tradeline-filters {
        padding: 15px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .tradeline-table {
        font-size: 12px;
    }

    .tradeline-table th,
    .tradeline-table td {
        padding: 10px 6px;
    }

    /* Hide some columns on mobile */
    .tradeline-table th:nth-child(6),
    .tradeline-table td:nth-child(6),
    .tradeline-table th:nth-child(7),
    .tradeline-table td:nth-child(7) {
        display: none;
    }

    .sort-instruction h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    /* Hide more columns on very small screens */
    .tradeline-table th:nth-child(4),
    .tradeline-table td:nth-child(4),
    .tradeline-table th:nth-child(5),
    .tradeline-table td:nth-child(5) {
        display: none;
    }

    .btn-add-to-cart {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Tooltip */
.head-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
}

.head-tooltip i {
    color: #6c757d;
    cursor: help;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    font-weight: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.head-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Smooth animations */
.tradeline-table tbody tr {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Print styles */
@media print {
    .tradeline-filters,
    .show-all-wrapper,
    .btn {
        display: none;
    }

    .tradeline-hidden {
        display: table-row !important;
    }
}

/* ============================================
   AJAX Add to Cart Popup Styles
   ============================================ */

/* Popup Container */
.tradeline-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.tradeline-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* Popup Content Box */
.tradeline-popup-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    text-align: center;
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tradeline-popup-content.tradeline-popup-show {
    transform: scale(1);
    opacity: 1;
}

/* Close Button */
.tradeline-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.tradeline-popup-close:hover {
    color: #333;
    background: #f0f0f0;
    transform: rotate(90deg);
}

/* Success Section */
.tradeline-popup-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.tradeline-popup-icon {
    width: 50px;
    height: 50px;
    background: #d4edda;
    color: #155724;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    animation: popupIconBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popupIconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.tradeline-popup-message {
    font-size: 18px;
    font-weight: 600;
    color: #155724;
}

#tradeline-popup-quantity {
    font-weight: 700;
    color: #0f4520;
}

/* Go to Cart Button */
.tradeline-popup-button {
    display: inline-block;
    background: #E8DC4F;
    color: #2c3e50;
    padding: 14px 40px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
    margin-bottom: 30px;
    border: none;
    cursor: pointer;
}

.tradeline-popup-button:hover {
    background: #dcc940;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 220, 79, 0.4);
    text-decoration: none;
    color: #2c3e50;
}

/* Info Section */
.tradeline-popup-info {
    text-align: left;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #E8DC4F;
}

.tradeline-popup-info h3 {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 15px 0;
}

.tradeline-popup-info ul {
    list-style: disc;
    margin: 0 0 15px 0;
    padding-left: 25px;
}

.tradeline-popup-info li {
    font-size: 15px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.5;
}

.tradeline-popup-info p {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.tradeline-popup-warning {
    color: #991b1b !important;
    font-weight: 600;
    font-size: 15px !important;
}

/* Scrollbar for popup content */
.tradeline-popup-content::-webkit-scrollbar {
    width: 8px;
}

.tradeline-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tradeline-popup-content::-webkit-scrollbar-thumb {
    background: #E8DC4F;
    border-radius: 4px;
}

.tradeline-popup-content::-webkit-scrollbar-thumb:hover {
    background: #dcc940;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tradeline-popup-content {
        width: 95%;
        padding: 30px 20px;
    }

    .tradeline-popup-close {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 35px;
        height: 35px;
    }

    .tradeline-popup-success {
        flex-direction: column;
        gap: 10px;
    }

    .tradeline-popup-icon {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }

    .tradeline-popup-message {
        font-size: 16px;
    }

    .tradeline-popup-button {
        padding: 12px 30px;
        font-size: 15px;
    }

    .tradeline-popup-info {
        padding: 20px 15px;
    }

    .tradeline-popup-info h3 {
        font-size: 16px;
    }

    .tradeline-popup-info li,
    .tradeline-popup-info p {
        font-size: 14px;
    }
}
