:root {
    --primary-color: #000066;
    --secondary-color: #0066cc;
    --dark-blue: #0a0e27;
    --card-bg: #1a1f3a;
    --text-color: #ffffff;
    --text-secondary: #b0b8d0;
    --border-color: #2a2f4a;
    --accent-color: #4a90e2;
    --background-color: #0f1422;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, var(--background-color) 0%, var(--dark-blue) 100%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
}

/* Geometric pattern background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(74, 144, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 102, 204, 0.1) 0%, transparent 50%),
        linear-gradient(45deg, transparent 30%, rgba(74, 144, 226, 0.03) 50%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
}

.logo img {
    max-width: 200px;
    filter: brightness(0) invert(1);
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Error message */
.error-message {
    text-align: center;
    padding: 3rem 2rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    color: #ff6b6b;
}

.error-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* No listings message */
.no-listings {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.no-listings i {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

/* Listings grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Listing card */
.listing-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.listing-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.listing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
}

.listing-card:hover::before {
    opacity: 1;
}

.listing-image-container {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.08) 0%, 
        rgba(0, 102, 204, 0.05) 50%,
        rgba(26, 31, 58, 0.3) 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.listing-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center, 
        rgba(74, 144, 226, 0.2) 0%, 
        rgba(0, 102, 204, 0.1) 40%,
        transparent 70%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: 12px;
    z-index: 1;
}

.listing-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(26, 31, 58, 0.4) 100%
    );
    pointer-events: none;
    border-radius: 12px;
    opacity: 0.6;
    z-index: 1;
}

.listing-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.15) contrast(1.1) saturate(0.85) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 0;
    mix-blend-mode: normal;
}

.listing-card:hover .listing-image-container {
    border-color: var(--accent-color);
    box-shadow: inset 0 0 20px rgba(74, 144, 226, 0.1),
                0 4px 20px rgba(74, 144, 226, 0.2);
    transform: scale(1.02);
}

.listing-card:hover .listing-image-container::before {
    opacity: 1;
}

.listing-card:hover .listing-image-container::after {
    opacity: 0.4;
}

.listing-card:hover .listing-image {
    filter: brightness(1.25) contrast(1.15) saturate(0.95) drop-shadow(0 4px 16px rgba(74, 144, 226, 0.3));
}

.listing-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1.3;
}

.listing-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-details {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-item i {
    color: var(--accent-color);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.detail-item span {
    color: var(--text-secondary);
}

.detail-item .value {
    color: var(--text-color);
    font-weight: 500;
}

.otc-link {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.otc-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.trade-name {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.95rem;
}

/* View Details Button */
.view-details-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.view-details-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
}

.view-details-btn i {
    font-size: 1.1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal[hidden] {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, transparent 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-image {
    width: 100%;
    max-height: 300px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(74, 144, 226, 0.08) 0%, 
        rgba(0, 102, 204, 0.05) 50%,
        rgba(26, 31, 58, 0.3) 100%);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.modal-image img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    filter: brightness(1.15) contrast(1.1) saturate(0.85);
}

.modal-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
}

.modal-description p {
    margin-bottom: 1rem;
}

.modal-description ul,
.modal-description ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.modal-description li {
    margin-bottom: 0.5rem;
}

.modal-description a {
    color: var(--accent-color);
    text-decoration: none;
}

.modal-description a:hover {
    text-decoration: underline;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    background: linear-gradient(135deg, transparent 0%, rgba(74, 144, 226, 0.05) 100%);
}

.trade-btn {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 16px rgba(74, 144, 226, 0.3);
}

.trade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
}

.trade-btn i {
    font-size: 1.2rem;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .trade-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Rating stars */
.rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stars {
    color: #ffc107;
    font-size: 0.9rem;
}

.rating-value {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .listings-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .listing-card {
        padding: 1.25rem;
    }

    .listing-image {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.5rem;
    }

    .logo img {
        max-width: 150px;
    }

    .header h1 {
        font-size: 1.75rem;
    }
}

/* Hidden utility */
[hidden] {
    display: none !important;
}

