/**
 * SWAPTIQ Frontend Styles
 *
 * @package SWAPTIQ
 */

/* Marketplace Layout */
.swaptiq-marketplace {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

.swaptiq-filters {
    flex: 0 0 250px;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.swaptiq-filters h3 {
    margin-top: 0;
    font-size: 1.2rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-filter {
    width: 100%;
    padding: 0.75rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-filter:hover {
    background: #0056b3;
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    flex: 1;
}

.swaptiq-listing-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.swaptiq-listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.listing-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.listing-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listing-content {
    padding: 1rem;
}

.listing-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.listing-type.sell {
    background: #d4edda;
    color: #155724;
}

.listing-type.buy {
    background: #d1ecf1;
    color: #0c5460;
}

.listing-title {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.listing-title a {
    color: #333;
    text-decoration: none;
}

.listing-title a:hover {
    color: #007bff;
}

.listing-meta {
    display: flex;
    justify-content: space-between;
    margin: 0.75rem 0;
    padding: 0.5rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.listing-location {
    color: #666;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.listing-author {
    color: #666;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.listing-excerpt {
    color: #555;
    font-size: 0.9rem;
    margin: 0.75rem 0;
}

.btn-view-listing {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 0.75rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 1rem;
}

.btn-view-listing:hover {
    background: #0056b3;
}

/* Single Listing Details */
.swaptiq-listing-details {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.listing-meta-box {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.meta-row:last-child {
    border-bottom: none;
}

.listing-type-badge {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.listing-type-badge.sell {
    background: #28a745;
    color: white;
}

.listing-type-badge.buy {
    background: #17a2b8;
    color: white;
}

.fulfillment-progress {
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #28a745;
    transition: width 0.3s;
}

.listing-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.btn-make-offer,
.btn-send-message {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-make-offer {
    background: #28a745;
    color: white;
}

.btn-send-message {
    background: #007bff;
    color: white;
}

/* Dashboard */
.swaptiq-dashboard {
    padding: 2rem 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-box {
    background: white;
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-box h3 {
    font-size: 2.5rem;
    margin: 0;
    color: #007bff;
}

.stat-box p {
    margin: 0.5rem 0 0;
    color: #666;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.listings-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.listings-table th,
.listings-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.listings-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Modal */
.swaptiq-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.close-modal {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #000;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.btn-submit {
    padding: 0.75rem 2rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
}

.btn-submit:hover {
    background: #218838;
}

/* Dashboard Styles */
.swaptiq-dashboard {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-box {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e9ecef;
}

.stat-box h3 {
    margin: 0;
    font-size: 2rem;
    color: #007bff;
}

.stat-box p {
    margin: 0.5rem 0 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.dashboard-listings {
    margin-top: 2rem;
}

.listings-table {
    overflow-x: auto;
}

.listings-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.listings-table th,
.listings-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.listings-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.listings-table td a {
    color: #007bff;
    text-decoration: none;
}

.listings-table td a:hover {
    text-decoration: underline;
}

/* Fulfillment Bar Styles */
.fulfillment-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.fulfillment-bar {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.fulfillment-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 10px;
}

.fulfillment-fill.none {
    background: #dc3545;
    width: 0%;
}

.fulfillment-fill.partial {
    background: #ffc107;
}

.fulfillment-fill.complete {
    background: #28a745;
}

.fulfillment-text {
    min-width: 60px;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.fulfillment-badge {
    color: #28a745;
    font-size: 1.2rem;
    margin-left: 0.25rem;
}

.fulfillment-na {
    color: #adb5bd;
    font-size: 1.2rem;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Dashboard Buttons */
.btn-edit,
.btn-toggle-status,
.btn-mark-done {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    margin-right: 0.5rem;
    text-decoration: none;
    display: inline-block;
}

.btn-edit {
    background: #007bff;
    color: white;
}

.btn-edit:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
}

.btn-toggle-status {
    background: #6c757d;
    color: white;
}

.btn-toggle-status:hover {
    background: #545b62;
}

.btn-mark-done {
    background: #28a745;
    color: white;
}

.btn-mark-done:hover {
    background: #218838;
}

.btn-mark-done:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .swaptiq-marketplace {
        flex-direction: column;
    }

    .swaptiq-filters {
        flex: 1;
    }

    .listings-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

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

    .listings-table {
        font-size: 0.875rem;
    }

    .listings-table th,
    .listings-table td {
        padding: 0.5rem;
    }

    .btn-edit,
    .btn-toggle-status,
    .btn-mark-done {
        display: block;
        margin-bottom: 0.5rem;
        text-align: center;
    }
}

/* New Single Listing Styles */
.swaptiq-single-listing {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.listing-gallery .main-image {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.listing-gallery .main-image img {
    width: 100%;
    height: auto;
}

.thumbnail-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.thumbnail-strip .thumbnail {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.thumbnail-strip .thumbnail img {
    width: 100%;
    height: auto;
}

.listing-details-content .listing-title {
    font-size: 2rem;
    margin-top: 0;
}

.listing-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.meta-item .meta-label {
    font-weight: 500;
    color: #666;
    display: block;
    margin-bottom: 0.25rem;
}

.listing-description {
    margin: 1.5rem 0;
}

.listing-author-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.author-avatar img {
    border-radius: 50%;
}

