/* Color & Tracing Detail Page Stylesheet - Scoped */
body, 
button, 
input, 
select, 
textarea, 
.ct-container {
    font-family: var(--smw-font-stack);
    -webkit-font-smoothing: antialiased;
}

.ct-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0;
    color: #131518;
    background-color: #ffffff;
    box-sizing: border-box;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.ct-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: #5B6478;
    margin-bottom: 20px;
}

.ct-breadcrumb a {
    color: #2F5FEE;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.ct-breadcrumb a:hover {
    color: #1E46C4;
    text-decoration: underline;
}

.ct-breadcrumb .sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin: 0 1px;
}

.ct-breadcrumb .active {
    color: #1B2237;
    font-weight: 600;
}

/* ============================================================
   HERO SECTION (Header Panel matched to site standards)
   ============================================================ */
.ct-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: left;
    margin-top: 0;
    margin-bottom: 1.5rem;
    margin-left: 0;
    padding: 1.375rem 1.75rem;
    background: oklch(0.95 0.03 264);
    border: 2px solid oklch(0.75 0.12 264);
    border-radius: 1rem;
    box-shadow: 0 1px 2px oklch(0.2 0.035 274 / .03), 0 6px 18px oklch(0.54 0.22 266 / .05);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.ct-hero-content {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.ct-title {
    text-align: center;
    margin: 0 0 0.5rem 0;
    font-family: var(--smw-font-stack);
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #0e2770;
}

.ct-highlight-blue {
    color: #0e2770;
}

.ct-description {
    margin: 0 0 1.25rem 0;
    width: 100%;
    max-width: 100%;
    text-align: left;
    font-family: var(--smw-font-stack);
    font-size: 0.9375rem; /* 15px */
    line-height: 1.5;
    color: #0b205f;
    font-weight: 500;
}

/* Hero Stats Pills */
.ct-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.ct-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: 999px;
    background: #ffffff;
    font-family: var(--smw-font-stack);
    font-size: 13px;
    font-weight: 700;
    color: #1D2A44;
    box-shadow: 0 2px 6px rgba(20, 40, 80, 0.05);
}

.ct-pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
}

.ct-pill--purple .ct-pill-icon { background: #EFEAFE; color: #7C3AED; }
.ct-pill--pink .ct-pill-icon   { background: #FDE8EF; color: #E11D48; }
.ct-pill--green .ct-pill-icon  { background: #E2F8E9; color: #16A34A; }
.ct-pill--orange .ct-pill-icon { background: #FFEDD5; color: #EA580C; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.ct-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: #FFFFFF;
    padding: 10px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    border: 1px solid #E2E8F0;
}

.ct-search-box {
    position: relative;
    flex: 1 1 160px;
    max-width: 300px;
    min-width: 0;
}

.ct-search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    font-size: 13px;
    outline: none;
    background: #EDF2F7;
    box-sizing: border-box;
}

.ct-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.ct-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: #EDF2F7;
    padding: 3px;
    border-radius: 8px;
}

.ct-filter-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #4A5568;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ct-filter-btn.active {
    background: #2563EB;
    color: #FFFFFF;
}

.ct-theme-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 0;
    font-size: 13px;
    color: #000000;
    font-weight: 600;
}

.ct-theme-box label {
    white-space: nowrap;
}

/* ------------------------------------------------------------
   Shared dropdown style (Themes + Sort by)
   Plain, classic select. The open list is the browser's native
   popup (blue highlight on hover/selection comes from the browser).
   ------------------------------------------------------------ */
.ct-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 220px;
    padding: 5px 28px 5px 10px;
    border: 1px solid #64748B;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #1E293B;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231E293B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    cursor: pointer;
    outline: none;
    text-overflow: ellipsis;
}

.ct-select:focus,
.ct-select:focus-visible {
    border-color: #2563EB;
    outline: none;
}

.ct-select option {
    background-color: #ffffff;
    color: #1E293B;
}

.ct-sort-box {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #000000;
    font-weight: 600;
}

/* ============================================================
   WORKSHEET GRID & CARDS
   ============================================================ */
.ct-worksheet-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.ct-card {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    min-width: 0;
    box-sizing: border-box;
}

.ct-card:hover {
    transform: translateY(-3px);
    border-color: #CBD5E1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.ct-card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F8FAFC;
    border: 1px solid #F1F5F9;
    border-radius: 8px;
    overflow: hidden;
    padding: 8px;
    box-sizing: border-box;
}

/* Image Loading Shimmer Effect */
.ct-card-image-wrap.is-loading {
    background: linear-gradient(90deg, #f0f4f8 25%, #e1e7f0 50%, #f0f4f8 75%);
    background-size: 200% 100%;
    animation: ct-shimmer 1.5s infinite linear;
}

@keyframes ct-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ct-card-image-wrap.is-loading img {
    opacity: 0;
}

.ct-card-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.04));
    transition: opacity 0.3s ease;
    opacity: 1;
}

.ct-card-title {
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
    margin: 10px 0 8px 0;
    text-align: center;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-card-variants {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
    width: 100%;
}

.ct-radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.ct-radio-label.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ct-radio-label input[type="radio"] {
    display: none;
}

.ct-radio-custom {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #CBD5E1;
    display: inline-block;
    position: relative;
    transition: all 0.15s ease;
}

.ct-radio-label input[type="radio"]:checked + .ct-radio-custom {
    border-color: #2563EB;
    background-color: #FFFFFF;
}

.ct-radio-label input[type="radio"]:checked + .ct-radio-custom::after {
    content: "";
    width: 6px;
    height: 6px;
    background: #2563EB;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ct-card-actions {
    display: flex;
    width: 100%;
    margin-top: auto;
}

.ct-download-btn {
    display: block;
    box-sizing: border-box;
    text-decoration: none;
    width: 100%;
    background: #2563EB;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.ct-download-btn:hover,
.ct-download-btn:visited,
.ct-download-btn:focus {
    color: #FFFFFF;
}

.ct-download-btn:hover {
    background: #1D4ED8;
}

.ct-download-btn:active {
    transform: scale(0.98);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (min-width: 640px) {
    .ct-title {
        font-size: 2.125rem;
    }
}

@media (max-width: 1200px) {
    .ct-worksheet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}

@media (max-width: 900px) {
    .ct-worksheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

@media (max-width: 768px) {
    .ct-hero {
        margin-bottom: 1rem;
        padding: 1rem;
        border-radius: 0.875rem;
    }
    .ct-title {
        font-size: 1.5rem;
        text-align: left;
        margin: 0 0 0.5rem 0;
    }
    .ct-description {
        font-size: 0.875rem;
    }
    .ct-sort-box { 
        width: 100%; 
        justify-content: flex-start; 
        margin-left: 0;
    }
    .ct-search-box,
    .ct-theme-box {
        flex: 1 1 100%;
        max-width: 100%;
    }
    /* Match Topic Detail (.cdt-ws-field label / .cdt-ws-select) proportions */
    .ct-theme-box label,
    .ct-sort-box label {
        font-size: 11.5px;
        font-weight: 700;
    }
    .ct-theme-box .ct-select,
    .ct-sort-box .ct-select {
        flex: 0 1 auto;
        max-width: 100%;
        font-size: 12.5px;
        font-weight: 600;
        padding: 7px 28px 7px 10px;
    }
}

@media (max-width: 500px) {
    .ct-worksheet-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .ct-card-image-wrap { aspect-ratio: 4 / 3; height: auto; }
}