:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background-color: var(--card-background);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.navbar-logo {
    height: 40px;
    width: auto;
}

.navbar-nav {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.navbar-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s, color 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-muted);
}

/* Page Banner */
.page-banner {
    margin-bottom: 2rem;
    border-radius: 1rem;
    overflow: hidden;
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .page-banner {
        border-radius: 0.75rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    .page-banner {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
}

/* Search Bar */
.search-container {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.search-input {
    width: 100%;
    max-width: 700px;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Product Card */
.product-card {
    background-color: var(--card-background);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.product-thumbnail {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 180px;
    max-height: 250px;
    object-fit: contain;
    background-color: var(--border-color);
}

.product-thumbnail-placeholder {
    width: 100%;
    min-height: 180px;
    max-height: 250px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

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

.product-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    width: fit-content;
}

.product-type-badge.ppw {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.product-type-badge.course {
    background-color: #dcfce7;
    color: #166534;
}

.product-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--warning-color);
}

.product-price {
    font-weight: 700;
    color: var(--primary-color);
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

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

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover,
.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Product Detail Page */
.product-detail {
    background-color: var(--card-background);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-detail-header {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.product-detail-thumbnail {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    object-fit: contain;
}

.product-detail-thumbnail-placeholder {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 5rem;
}

.product-detail-info h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.product-detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.product-detail-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--background-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.product-detail-section {
    margin-top: 2rem;
}

.product-detail-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.product-detail-description {
    color: var(--text-muted);
    line-height: 1.8;
}

/* Back Button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 500;
}

.back-button:hover {
    text-decoration: underline;
}

/* Search Page */
.search-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--border-color);
    background-color: var(--card-background);
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.no-results h3 {
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar-nav {
        gap: 1rem;
    }

    .product-detail-header {
        grid-template-columns: 1fr;
    }

    .product-detail-thumbnail {
        max-height: 300px;
        width: 100%;
    }

    .product-thumbnail {
        min-height: 150px;
        max-height: 200px;
    }

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

    .share-container {
        flex-direction: column;
        text-align: center;
    }

    .qr-code {
        margin-bottom: 1rem;
    }
}

/* Share Section */
.share-section {
    background-color: var(--background-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 2rem;
}

.share-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.qr-code img {
    width: 150px;
    height: 150px;
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    background-color: white;
    padding: 0.5rem;
}

.share-link {
    flex: 1;
}

.share-link p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.share-url-container {
    display: flex;
    gap: 0.5rem;
}

.share-url-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: var(--card-background);
    color: var(--text-color);
}

.share-url-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.copy-btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-btn:hover {
    background-color: var(--primary-hover);
}

.copy-btn.copied {
    background-color: var(--success-color);
}

/* Inline Share (in product header) */
.share-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.qr-code-small img {
    width: 80px;
    height: 80px;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background-color: white;
    padding: 0.25rem;
}

.share-link-inline {
    flex: 1;
}

.share-link-inline .share-url-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-inline .share-url-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.share-link-inline .copy-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .share-inline {
        flex-direction: column;
        align-items: flex-start;
    }

    .share-link-inline {
        width: 100%;
    }
}

/* Topics Grid */
.topics-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background-color: var(--background-color);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.topic-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.topic-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.topic-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

.topic-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.topic-description-wrapper {
    position: relative;
}

.topic-description-wrapper .truncated {
    display: block;
}

.topic-description-wrapper .full {
    display: none;
}

.show-more-hint {
    font-size: 0.75rem;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    margin-top: 0.25rem;
    display: inline-block;
}

.topic-description-wrapper:hover .truncated {
    display: none;
}

.topic-description-wrapper:hover .full {
    display: block;
}

.topic-description-wrapper:hover .show-more-hint {
    display: none;
}


/* Course Topics Tags */
.course-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.topic-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--background-color);
    color: var(--text-muted);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}