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

/* Marketplace Layout */
.swaptiq-marketplace {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 2rem 0;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 992px) {
    .swaptiq-marketplace {
        flex-direction: row;
        align-items: flex-start;
    }
}

.swaptiq-filters {
    flex: 0 0 280px;
    width: 100%;
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

@media (min-width: 992px) {
    .swaptiq-filters {
        width: 280px;
    }
}

/* Listings Container */
.swaptiq-listings-container {
    flex: 1;
    width: 100% !important;
    min-width: 0;
}

/* Listings Grid */
.listings-grid {
    display: grid !important;
    grid-template-columns: 1fr; /* Default mobile */
    gap: 20px;
    width: 100% !important;
}

@media (min-width: 600px) {
    .listings-grid {
        grid-template-columns: repeat(2, 1fr); /* Force 2 columns on small screens */
    }
}

@media (min-width: 1200px) {
    .listings-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on large screens */
    }
}

@media (max-width: 576px) {
    .listings-grid {
        grid-template-columns: 1fr;
    }
}

.swaptiq-listing-card {
    background: white;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
}

.swaptiq-listing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #007bff;
}

.listing-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f8f9fa;
    position: relative;
}

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

.listing-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.listing-type {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.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;
    align-items: center;
    margin: 1rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
}

.listing-meta .quantity {
    font-weight: 700;
    color: #2c3e50;
    font-size: 0.95rem;
}

.listing-meta .price {
    color: #28a745;
    font-weight: 700;
    font-size: 1.1rem;
}

.listing-meta .price-negotiable {
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.listing-location {
    color: #5a6c7f;
    font-size: 0.85rem;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.listing-author {
    color: #95a5a6;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.listing-excerpt {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-view-listing {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.85rem;
    background: #f8f9fa;
    color: #333;
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
    margin-top: auto;
}

.btn-view-listing:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Pagination */
.swaptiq-listings-container .pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

/* Filters Enhancement */
.swaptiq-filters .filter-group {
    margin-bottom: 1.25rem;
}

.swaptiq-filters .filter-group label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.swaptiq-filters input, 
.swaptiq-filters select {
    background: #fdfdfd;
    border-color: #ddd;
    padding: 0.65rem;
    transition: border-color 0.2s;
}

.swaptiq-filters input:focus, 
.swaptiq-filters select:focus {
    border-color: #007bff;
    outline: none;
}

.btn-filter {
    margin-top: 0.5rem;
    padding: 0.85rem;
    background: #333;
    transition: background 0.2s;
}

.btn-filter:hover {
    background: #000;
}

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

.unread-badge {
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

.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%;
}


/* User Registration Form */
.swaptiq-registration-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 40px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    cursor: pointer;
    font-size: 18px;
    user-select: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.strength-meter {
    margin-top: 8px;
    display: none;
}

.strength-meter.active {
    display: block;
}

.strength-meter-bar {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-meter-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    transition: width 0.3s, background-color 0.3s;
}

.strength-meter-bar.very-weak::after { width: 25%; background: #ff4b4b; }
.strength-meter-bar.weak::after { width: 50%; background: #ff9800; }
.strength-meter-bar.good::after { width: 75%; background: #ffc107; }
.strength-meter-bar.excellent::after { width: 100%; background: #339966; }

.strength-meter-label {
    font-size: 12px;
    font-weight: 600;
}

.very-weak + .strength-meter-label { color: #ff4b4b; }
.weak + .strength-meter-label { color: #ff9800; }
.good + .strength-meter-label { color: #ffc107; }
.excellent + .strength-meter-label { color: #339966; }

.password-requirements {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.password-requirements li {
    font-size: 11px;
    color: #999;
    padding-left: 18px;
    position: relative;
}

.password-requirements li::before {
    content: '?';
    position: absolute;
    left: 0;
}

.password-requirements li.met {
    color: #339966;
}

.password-requirements li.met::before {
    content: '?';
}
