/* ============================================================
   PowderSight Product Discovery — Shared Styles
   Used by: product_catalog, product_grade, product_search_results,
            product_detail, product_grade_not_found, SEO pages
   Design tokens from base.html: --primary #1a365d, --accent #d4af37
   ============================================================ */

/* ── Container & Layout ── */
.pd-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.pd-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.pd-main {
    flex: 1;
    min-width: 0;
}

/* ── Hero Banner ── */
.pd-hero {
    background: linear-gradient(135deg, var(--primary, #1a365d) 0%, var(--secondary, #2a4a7f) 100%);
    border-radius: 12px;
    padding: 36px 40px;
    margin-bottom: 24px;
    color: #fff;
}
.pd-hero h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}
.pd-hero p {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Hero Stats Row */
.pd-hero-stats {
    display: flex;
    gap: 32px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pd-hero-stat {
    text-align: center;
}
.pd-hero-stat strong {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}
.pd-hero-stat span {
    display: block;
    font-size: 0.8rem;
    opacity: 0.75;
    margin-top: 2px;
}

/* ── Breadcrumb ── */
.pd-breadcrumb {
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--gray, #6c757d);
}
.pd-breadcrumb a {
    color: var(--primary, #1a365d);
    text-decoration: none;
}
.pd-breadcrumb a:hover {
    text-decoration: underline;
}

/* ── Cards ── */
.pd-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 24px;
    transition: all 0.25s ease;
    margin-bottom: 16px;
}
.pd-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* Supplier Card — with colored left border */
.pd-supplier-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px 24px;
    margin-bottom: 16px;
    border-left: 4px solid var(--border, #e9ecef);
    transition: all 0.25s ease;
}
.pd-supplier-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.pd-supplier-card.featured {
    border-left-color: var(--accent, #d4af37);
}

.pd-supplier-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.pd-supplier-card .card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary, #1a365d);
    margin: 0;
}

/* Grade Card — in grid */
.pd-grade-card {
    display: block;
    background: #fff;
    border: 1px solid var(--border, #e9ecef);
    border-radius: 10px;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--dark, #2d3748);
    transition: all 0.2s ease;
}
.pd-grade-card:hover {
    border-color: var(--primary, #1a365d);
    background: #f0f4ff;
    color: var(--primary, #1a365d);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.pd-grade-card .grade-name {
    font-weight: 600;
    font-size: 1rem;
}
.pd-grade-card .grade-meta {
    font-size: 0.8rem;
    color: var(--gray, #6c757d);
    margin-top: 4px;
}

/* Result Card — search results */
.pd-result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border, #e9ecef);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--dark, #2d3748);
}
.pd-result-card:hover {
    border-color: var(--primary, #1a365d);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ── Pills / Tags ── */
.pd-pill {
    display: inline-block;
    padding: 6px 16px;
    background: #fff;
    border: 1px solid var(--primary, #1a365d);
    color: var(--primary, #1a365d);
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    margin: 4px;
}
.pd-pill:hover {
    background: var(--primary, #1a365d);
    color: #fff;
}

.pd-pill-sm {
    padding: 3px 10px;
    font-size: 0.75rem;
    border-radius: 12px;
}

.pd-pill.featured {
    background: linear-gradient(135deg, var(--accent, #d4af37), #e6c84d);
    border-color: var(--accent, #d4af37);
    color: #fff;
    font-weight: 600;
}

/* ── Tables ── */
.pd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.pd-table thead {
    background: #f5f7fa;
}
.pd-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--primary, #1a365d);
    border-bottom: 2px solid var(--border, #e9ecef);
    white-space: nowrap;
}
.pd-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #e9ecef);
    vertical-align: middle;
}
.pd-table tbody tr:hover {
    background: #f8faff;
}
.pd-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Price Display ── */
.pd-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: #e53e3e;
    white-space: nowrap;
}
.pd-price-lg {
    font-size: 2rem;
    font-weight: 800;
    color: #e53e3e;
    line-height: 1;
}

/* ── Search ── */
.pd-search-wrapper {
    position: relative;
    width: 100%;
}
.pd-search-input {
    width: 100%;
    padding: 14px 52px 14px 20px;
    font-size: 1rem;
    border: 2px solid var(--border, #e9ecef);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pd-search-input:focus {
    border-color: var(--primary, #1a365d);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}
.pd-search-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    width: 44px;
    background: var(--primary, #1a365d);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s ease;
}
.pd-search-btn:hover {
    background: var(--secondary, #2a4a7f);
}

/* Autocomplete dropdown */
.pd-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border, #e9ecef);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}
.pd-suggestions.show {
    display: block;
}
.pd-suggestions a {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--dark, #2d3748);
    font-size: 0.9rem;
    transition: background 0.1s ease;
}
.pd-suggestions a:hover,
.pd-suggestions a.active {
    background: #f0f4ff;
}

/* ── Grids ── */
.pd-grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.pd-tds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.pd-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* ── Sidebar ── */
.pd-sidebar {
    width: 280px;
    flex-shrink: 0;
}
@media (max-width: 991px) {
    .pd-sidebar {
        width: 100%;
    }
}

.pd-sidebar-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 20px;
    margin-bottom: 16px;
}
.pd-sidebar-section h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary, #1a365d);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent, #d4af37);
}
.pd-sidebar-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.pd-sidebar-section li {
    padding: 6px 0;
}
.pd-sidebar-section a {
    color: var(--dark, #2d3748);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s ease;
}
.pd-sidebar-section a:hover {
    color: var(--primary, #1a365d);
}

.pd-sidebar-sticky {
    position: sticky;
    top: 20px;
}

/* Sidebar Toggle (mobile) */
.pd-sidebar-toggle {
    display: none;
    width: 100%;
    padding: 10px 16px;
    background: #f5f7fa;
    border: 1px solid var(--border, #e9ecef);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--primary, #1a365d);
    margin-bottom: 12px;
    text-align: left;
}
.pd-sidebar-toggle:hover {
    background: #e9ecef;
}
@media (max-width: 991px) {
    .pd-sidebar-toggle {
        display: block;
    }
    .pd-sidebar-collapse {
        display: none;
    }
    .pd-sidebar-collapse.show {
        display: block;
    }
}

/* ── CTA Section ── */
.pd-cta {
    background: linear-gradient(135deg, #f0f4ff, #e8ecf8);
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
    margin-top: 24px;
}
.pd-cta p {
    font-size: 1.05rem;
    color: var(--dark, #2d3748);
    margin-bottom: 12px;
}
.pd-cta .btn {
    padding: 10px 28px;
    font-size: 1rem;
}

/* ── Section Title ── */
.pd-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary, #1a365d);
    margin-top: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent, #d4af37);
}

/* ── Empty State ── */
.pd-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray, #6c757d);
}
.pd-empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.4;
}

/* ── Image Gallery ── */
.pd-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}
.pd-sem-image {
    max-width: 300px;
    border-radius: 8px;
    border: 1px solid var(--border, #e9ecef);
    object-fit: cover;
    height: 180px;
}

/* ── Filter Bar ── */
.pd-filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 0;
    margin-bottom: 12px;
}
.pd-filter-bar select,
.pd-filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border, #e9ecef);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
}
.pd-filter-bar select:focus,
.pd-filter-bar input:focus {
    border-color: var(--primary, #1a365d);
}

/* ── Result count ── */
.pd-result-count {
    font-size: 0.9rem;
    color: var(--gray, #6c757d);
    margin: 8px 0 16px;
}

/* ── Pagination (Bootstrap override) ── */
.pagination .page-link {
    color: var(--primary, #1a365d);
    border-radius: 6px;
    margin: 0 2px;
    border-color: var(--border, #e9ecef);
}
.pagination .page-item.active .page-link {
    background: var(--primary, #1a365d);
    border-color: var(--primary, #1a365d);
}

/* ── SEO Article Content ── */
.pd-article {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 36px 40px;
    line-height: 1.9;
    font-size: 0.95rem;
}
.pd-article h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary, #1a365d);
    margin-top: 28px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent, #d4af37);
}
.pd-article h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 20px;
    color: var(--dark, #2d3748);
}
.pd-article p {
    margin-bottom: 12px;
}
.pd-article ul,
.pd-article ol {
    margin-bottom: 12px;
    padding-left: 20px;
}

/* ── Featured Badge ── */
.pd-featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--accent, #d4af37), #e6c84d);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.pd-featured-badge i {
    font-size: 0.65rem;
}

/* ── Material Family List (sidebar) ── */
.pd-material-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.pd-material-list li {
    padding: 5px 0;
}
.pd-material-list a {
    color: var(--dark, #2d3748);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}
.pd-material-list a:hover {
    color: var(--primary, #1a365d);
}

/* ── Animations ── */
@keyframes pd-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.pd-card,
.pd-supplier-card,
.pd-grade-card,
.pd-result-card {
    animation: pd-fadeInUp 0.4s ease-out;
}

/* ── Mobile Responsive ── */

/* ── Pill group (hot grades flex container) ─────────────────────── */
.pd-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.pd-pill .pill-meta {
    color: var(--gray);
    font-size: 0.8rem;
    margin-left: 8px;
}
.pd-pill .pill-price {
    color: var(--danger);
    font-size: 0.8rem;
    margin-left: 4px;
}

/* ── Grade card family label ────────────────────────────────────── */
.pd-grade-card .grade-family {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 2px;
}

/* ── Sticky CTA (mobile contact button) ─────────────────────────── */
.pd-sticky-cta {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--border);
    padding: 12px 16px;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}
.pd-sticky-cta .btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
}

/* ── Grade card tags ────────────────────────────────────────────── */
.grade-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.pd-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f0f4f8;
    color: var(--gray);
    white-space: nowrap;
}

/* ── Tag row (for app/process tags in TDS cards) ─────────────────── */
.pd-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .pd-sticky-cta {
        display: block;
    }
}


/* ── Grade card tags ────────────────────────────────────────────── */
.grade-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.pd-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f0f4f8;
    color: var(--gray);
    white-space: nowrap;
}

/* ── Tag row (for app/process tags in TDS cards) ─────────────────── */
.pd-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .pd-container {
        padding: 16px 12px;
    }
    .pd-hero {
        padding: 24px 20px;
    }
    .pd-hero h1 {
        font-size: 1.35rem;
    }
    .pd-hero-stats {
        gap: 16px;
    }
    .pd-hero-stat strong {
        font-size: 1.5rem;
    }
    .pd-row {
        flex-direction: column;
    }
    .pd-article {
        padding: 20px 16px;
    }
    .pd-grade-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .pd-tds-grid {
        grid-template-columns: 1fr;
    }
    .pd-sem-image {
        max-width: 100%;
        height: auto;
    }
}
