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

/* Wrapper */
.tradeline-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    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 {
    margin-bottom: 30px;
}

.filter-grid {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    background: #ffffff;
    padding: 30px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(-15px);
}

.filter-grid.show {
    display: grid;
    opacity: 1;
    transform: translateY(0);
    animation: fadeSlideIn 0.25s ease forwards;
}

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

.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: none;
    gap: 10px;
    flex-wrap: wrap;
    background: #ffffff;
    padding: 20px 30px 30px 30px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(-15px);
}

.filter-actions.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    animation: fadeSlideIn 0.25s ease 0.05s forwards;
}

#filter-hidden {
    text-align: center;
    margin: 0;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#filter-hidden.hide {
    opacity: 0;
    transform: translateY(-5px);
    pointer-events: none;
}

/* Buttons - Unified Yellow Theme - High Specificity */
.tradeline-wrapper .btn,
.tradeline-wrapper button.btn,
.tradeline-wrapper .btn-primary,
.tradeline-wrapper .btn-secondary,
.tradeline-wrapper #show-filter,
.tradeline-wrapper #hide-filter,
.tradeline-wrapper #clear-filters,
.tradeline-wrapper .btn-show-all {
    padding: 12px 30px !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    transition: all 0.3s !important;
    text-decoration: none !important;
    display: inline-block !important;
    font-family: inherit !important;
    background: #E8DC4F !important;
    background-color: #E8DC4F !important;
    color: #2c3e50 !important;
    box-shadow: none !important;
}

.tradeline-wrapper .btn:hover,
.tradeline-wrapper button.btn:hover,
.tradeline-wrapper .btn-primary:hover,
.tradeline-wrapper .btn-secondary:hover,
.tradeline-wrapper #show-filter:hover,
.tradeline-wrapper #hide-filter:hover,
.tradeline-wrapper #clear-filters:hover,
.tradeline-wrapper .btn-show-all:hover {
    background: #dcc940 !important;
    background-color: #dcc940 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(232, 220, 79, 0.4) !important;
    text-decoration: none !important;
    color: #2c3e50 !important;
    border: none !important;
}

.tradeline-wrapper .btn:active,
.tradeline-wrapper button.btn:active {
    transform: translateY(0) !important;
}

/* Primary button - same as default */
.tradeline-wrapper .btn-primary {
    background: #E8DC4F !important;
    background-color: #E8DC4F !important;
    color: #2c3e50 !important;
}

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

/* Secondary button - also yellow now */
.tradeline-wrapper .btn-secondary {
    background: #E8DC4F !important;
    background-color: #E8DC4F !important;
    color: #2c3e50 !important;
    opacity: 0.9 !important;
}

.tradeline-wrapper .btn-secondary:hover {
    background: #dcc940 !important;
    background-color: #dcc940 !important;
    opacity: 1 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(232, 220, 79, 0.3) !important;
}

/* Add to Cart Button - Yellow */
.tradeline-wrapper .btn-add-to-cart,
.tradeline-table .btn-add-to-cart {
    background: #E8DC4F !important;
    background-color: #E8DC4F !important;
    color: #2c3e50 !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    display: inline-block !important;
    text-align: center !important;
    min-width: 110px !important;
    border: none !important;
    text-decoration: none !important;
}

.tradeline-wrapper .btn-add-to-cart:hover,
.tradeline-table .btn-add-to-cart:hover {
    background: #dcc940 !important;
    background-color: #dcc940 !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    color: #2c3e50 !important;
    border: none !important;
}

/* View Cart Link - Yellow Button Style */
.tradeline-wrapper .added_to_cart,
.tradeline-table .added_to_cart,
.woocommerce .added_to_cart,
a.added_to_cart {
    background: #E8DC4F !important;
    background-color: #E8DC4F !important;
    color: #2c3e50 !important;
    padding: 10px 20px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    display: inline-block !important;
    text-align: center !important;
    min-width: 110px !important;
    border: none !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    margin-left: 8px !important;
}

.tradeline-wrapper .added_to_cart:hover,
.tradeline-table .added_to_cart:hover,
.woocommerce .added_to_cart:hover,
a.added_to_cart:hover {
    background: #dcc940 !important;
    background-color: #dcc940 !important;
    text-decoration: none !important;
    transform: translateY(-1px) !important;
    color: #2c3e50 !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(232, 220, 79, 0.4) !important;
}

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

.tradeline-wrapper .btn-show-all,
.tradeline-wrapper #show-all-tradelines {
    background: #E8DC4F !important;
    background-color: #E8DC4F !important;
    color: #2c3e50 !important;
    padding: 12px 40px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    text-decoration: none !important;
}

.tradeline-wrapper .btn-show-all:hover,
.tradeline-wrapper #show-all-tradelines:hover {
    background: #dcc940 !important;
    background-color: #dcc940 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(232, 220, 79, 0.4) !important;
    color: #2c3e50 !important;
    border: none !important;
}

/* 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;
}

/* Action column - ensure button fits */
.tradeline-table td:last-child {
    min-width: 130px;
    white-space: nowrap;
}

/* 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;
    }
}

/* ============================================
   PAGINATION STYLES
   ============================================ */

.tradeline-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    background: #ffffff;
    border-radius: 0 0 8px 8px;
    margin-top: 0;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 20px;
}

.pagination-info {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.pagination-info span {
    color: #2c3e50;
    font-weight: 600;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-controls label {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
    margin: 0;
}

.pagination-select {
    height: 36px;
    padding: 6px 30px 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232c3e50' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.pagination-select:hover {
    border-color: #E8DC4F;
}

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

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d0d0d0;
    background: #ffffff;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(.pagination-btn-active) {
    background: #f8f9fa;
    border-color: #E8DC4F;
    color: #2c3e50;
}

.pagination-btn-active {
    background: #E8DC4F;
    border-color: #E8DC4F;
    color: #2c3e50;
    font-weight: 600;
    cursor: default;
}

.pagination-prev,
.pagination-next {
    font-size: 18px;
    font-weight: 600;
    padding: 0;
    width: 36px;
}

.pagination-ellipsis {
    padding: 0 6px;
    color: #6c757d;
    font-size: 14px;
    display: flex;
    align-items: center;
}

/* Mobile Responsive for Pagination */
@media (max-width: 768px) {
    .tradeline-pagination {
        flex-direction: column;
        align-items: stretch;
        padding: 15px 20px;
        gap: 15px;
    }

    .pagination-info {
        text-align: center;
        order: 3;
    }

    .pagination-controls {
        justify-content: center;
        order: 1;
    }

    .pagination-nav {
        justify-content: center;
        order: 2;
        flex-wrap: wrap;
    }

    .pagination-btn {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .pagination-prev,
    .pagination-next {
        width: 32px;
    }
}

@media (max-width: 480px) {
    .pagination-btn {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
        padding: 0 6px;
    }

    .pagination-prev,
    .pagination-next {
        width: 28px;
    }

    .pagination-select {
        height: 32px;
        font-size: 13px;
    }

    .pagination-controls label {
        font-size: 13px;
    }

    .pagination-info {
        font-size: 13px;
    }
}
