/* =============================================
   Catalog — Test marketplace grid
   ============================================= */

/* ── Active attempt banner ── */
.enttest-active-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #4052B5 0%, #6B7EE8 100%);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    gap: 12px;
    margin-bottom: 12px;
}
.enttest-active-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.enttest-active-label { font-weight: 600; font-size: 13px; white-space: nowrap; }
.enttest-active-exam {
    font-size: 13px; opacity: 0.9; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.enttest-active-time {
    font-size: 13px; font-weight: 700; opacity: 0.9;
    background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 6px; white-space: nowrap;
}
.enttest-active-btn {
    background: #fff; color: #4052B5; border-radius: 8px; font-weight: 600;
    white-space: nowrap; padding: 7px 16px; font-size: 13px;
    text-decoration: none; transition: background 0.15s; flex-shrink: 0;
}
.enttest-active-btn:hover { background: #eef0ff; color: #4052B5; text-decoration: none; }

/* ── Toolbar: compact one-line strip ── */
.enttest-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}

.enttest-tb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
}
.enttest-tb-item:hover {
    background: #fff;
    color: #1e293b;
    text-decoration: none;
}
.enttest-tb-item svg { flex-shrink: 0; opacity: 0.6; }

.enttest-tb-label { font-weight: 500; }

.enttest-tb-badge {
    font-size: 11px; font-weight: 700; background: #4052B5; color: #fff;
    padding: 1px 7px; border-radius: 10px; min-width: 18px; text-align: center;
    line-height: 1.3;
}

/* Code input in toolbar */
.enttest-tb-code { flex: 1; min-width: 0; cursor: default; gap: 8px; }
.enttest-tb-code-form { display: flex; gap: 0; flex: 1; min-width: 0; }
.enttest-tb-code-input {
    flex: 1; min-width: 60px; max-width: 140px;
    height: 30px; padding: 0 8px;
    border: 1px solid #dce1ec; border-right: none; border-radius: 6px 0 0 6px;
    font-size: 12px; font-weight: 600; letter-spacing: 1.5px;
    text-transform: uppercase; text-align: center;
    outline: none; background: #fff; color: #1e293b;
    transition: border-color 0.2s;
}
.enttest-tb-code-input::placeholder { letter-spacing: 2px; color: #b0b8c9; font-weight: 500; }
.enttest-tb-code-input:focus { border-color: #cbd5e1; outline: none; box-shadow: none; }
.enttest-tb-code-btn {
    height: 30px; padding: 0 10px;
    background: #4052B5; color: #fff; border: none;
    border-radius: 0 6px 6px 0;
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: background 0.15s; white-space: nowrap;
}
.enttest-tb-code-btn:hover { background: #3445a0; }

/* Results link */
.enttest-tb-results { margin-left: auto; }

/* My tests toggle in toolbar */
.enttest-tb-my { text-decoration: none; }
.enttest-tb-my--active {
    background: #4052B5 !important;
    color: #fff !important;
}
.enttest-tb-my--active svg { opacity: 1; }

/* My tests panel */
.enttest-my-panel {
    padding-top: 4px;
}
.enttest-my-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.enttest-my-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    color: #1e293b;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.enttest-my-card:hover {
    border-color: #4052B5;
    box-shadow: 0 2px 8px rgba(64,82,181,0.1);
    text-decoration: none;
    color: #1e293b;
}
.enttest-my-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.enttest-my-card-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.enttest-my-card-meta {
    font-size: 12px;
    color: #64748b;
}
.enttest-my-card-btn {
    font-size: 13px;
    font-weight: 600;
    color: #4052B5;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dark theme */
body.theme-dark .enttest-my-card {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
body.theme-dark .enttest-my-card:hover {
    border-color: #818cf8;
    box-shadow: 0 2px 8px rgba(99,102,241,0.15);
    color: #e2e8f0;
}
body.theme-dark .enttest-my-card-meta { color: #94a3b8; }
body.theme-dark .enttest-my-card-btn { color: #818cf8; }
body.theme-dark .enttest-tb-my--active { background: #4f46e5 !important; }

/* Header */
.enttest-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.enttest-cat-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}

.enttest-cat-search-wrap {
    position: relative;
    width: 280px;
    max-width: 100%;
}

.enttest-cat-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    pointer-events: none;
}

.enttest-cat-search {
    width: 100%;
    padding: 9px 12px 9px 38px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
}

.enttest-cat-search:focus {
    border-color: #4052B5;
}

/* Filters row */
.enttest-cat-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.enttest-cat-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.enttest-cat-chip {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.enttest-cat-chip:hover {
    border-color: #4052B5;
    color: #4052B5;
}

.enttest-cat-chip.active {
    background: #4052B5;
    border-color: #4052B5;
    color: #fff;
}

.enttest-cat-sort-select {
    padding: 7px 28px 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    appearance: auto;
}

/* Grid */
.enttest-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* Card */
.enttest-cat-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.enttest-cat-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Cover */
.enttest-cat-cover {
    position: relative;
    height: 140px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.enttest-cat-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.enttest-cat-cover-icon {
    opacity: 0.7;
}

.enttest-cat-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

/* Body */
.enttest-cat-body {
    padding: 14px 16px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.enttest-cat-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #1e293b;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.enttest-cat-meta {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

.enttest-cat-dot {
    margin: 0 3px;
    color: #94a3b8;
}

.enttest-cat-author {
    font-size: 12px;
    color: #6366f1;
    margin: 0 0 6px;
    font-weight: 500;
}

/* Rating */
.enttest-cat-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    margin-bottom: 8px;
}

.enttest-cat-star {
    color: #f59e0b;
    font-size: 14px;
}

.enttest-cat-rating-val {
    font-weight: 600;
    color: #1e293b;
}

.enttest-cat-review-cnt {
    color: #94a3b8;
    font-size: 12px;
}

.enttest-cat-sales {
    color: #94a3b8;
    font-size: 12px;
}

/* Price */
.enttest-cat-price-row {
    margin-top: auto;
    padding-top: 4px;
}

.enttest-cat-price {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.enttest-cat-free {
    font-size: 15px;
    font-weight: 600;
    color: #059669;
}

/* CTA row (button + optional admin edit) */
.enttest-cat-cta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 16px 16px;
}

/* CTA button */
.enttest-cat-btn {
    display: block;
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    margin: 0;
    background: #4052B5;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.enttest-cat-btn:hover {
    background: #3445a0;
    color: #fff;
    text-decoration: none;
}

/* Admin edit icon on catalog card */
.enttest-cat-admin-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f0f2f5;
    color: #64748b;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.enttest-cat-admin-edit:hover {
    background: #4052B5;
    color: #fff;
    text-decoration: none;
}
body.theme-dark .enttest-cat-admin-edit {
    background: #2a2d4a;
    color: #94a3b8;
}
body.theme-dark .enttest-cat-admin-edit:hover {
    background: #4f46e5;
    color: #fff;
}

/* Promotion badge on cover */
.enttest-cat-promo-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    z-index: 2;
}

/* Promo price stack */
.enttest-cat-price-stack {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.enttest-cat-price-old {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.enttest-cat-price-new {
    font-size: 17px;
    font-weight: 700;
    color: #ef4444;
}

.enttest-cat-timer {
    font-size: 11px;
    color: #f59e0b;
    font-weight: 500;
    margin-left: 4px;
}

/* Empty state */
.enttest-cat-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}

.enttest-cat-empty p {
    margin: 12px 0 0;
    font-size: 15px;
}

/* Show more */
.enttest-cat-more-wrap {
    text-align: center;
    margin: 24px 0 12px;
}

.enttest-cat-more-btn {
    padding: 10px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.enttest-cat-more-btn:hover {
    border-color: #4052B5;
    color: #4052B5;
}

/* =============================================
   Dark Theme
   ============================================= */

/* Active attempt dark */
body.theme-dark .enttest-active-btn { background: rgba(255,255,255,0.95); }
body.theme-dark .enttest-active-btn:hover { background: rgba(255,255,255,0.85); }

/* Toolbar dark */
body.theme-dark .enttest-toolbar {
    background: #151d30;
    border-color: #1e293b;
}
body.theme-dark .enttest-tb-item { color: #94a3b8; }
body.theme-dark .enttest-tb-item:hover { background: #1e293b; color: #e2e8f0; }
body.theme-dark .enttest-tb-badge { background: #4f46e5; }
body.theme-dark .enttest-tb-code-input {
    background: #1e293b; border-color: #334155; color: #e2e8f0;
}
body.theme-dark .enttest-tb-code-input::placeholder { color: #4a5568; }
body.theme-dark .enttest-tb-code-input:focus { border-color: #475569; outline: none; box-shadow: none; }
body.theme-dark .enttest-tb-code-btn { background: #4f46e5; color: #fff; }
body.theme-dark .enttest-tb-code-btn:hover { background: #6366f1; color: #fff; }

body.theme-dark .enttest-cat-title {
    color: #e2e8f0;
}

body.theme-dark .enttest-cat-search {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.theme-dark .enttest-cat-search:focus {
    border-color: #818cf8;
}

body.theme-dark .enttest-cat-chip {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.theme-dark .enttest-cat-chip:hover {
    border-color: #818cf8;
    color: #818cf8;
}

body.theme-dark .enttest-cat-chip.active {
    background: #4052B5;
    border-color: #4052B5;
    color: #fff;
}

body.theme-dark .enttest-cat-sort-select {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.theme-dark .enttest-cat-card {
    background: #1e293b;
    border-color: #334155;
}

body.theme-dark .enttest-cat-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body.theme-dark .enttest-cat-name {
    color: #e2e8f0;
}

body.theme-dark .enttest-cat-meta {
    color: #94a3b8;
}

body.theme-dark .enttest-cat-author {
    color: #a5b4fc;
}

body.theme-dark .enttest-cat-rating-val {
    color: #e2e8f0;
}

body.theme-dark .enttest-cat-price {
    color: #e2e8f0;
}

body.theme-dark .enttest-cat-free {
    color: #34d399;
}

body.theme-dark .enttest-cat-btn {
    background: #4f46e5;
    color: #fff;
}

body.theme-dark .enttest-cat-btn:hover {
    background: #6366f1;
    color: #fff;
}

body.theme-dark .enttest-cat-more-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.theme-dark .enttest-cat-more-btn:hover {
    border-color: #818cf8;
    color: #818cf8;
}

body.theme-dark .enttest-cat-empty {
    color: #64748b;
}

body.theme-dark .enttest-cat-price-old {
    color: #64748b;
}

body.theme-dark .enttest-cat-price-new {
    color: #fca5a5;
}

body.theme-dark .enttest-cat-timer {
    color: #fbbf24;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .enttest-active-card { flex-wrap: wrap; }
    .enttest-active-info { flex-wrap: wrap; gap: 6px; }
    .enttest-toolbar { flex-wrap: wrap; gap: 2px; }
    .enttest-tb-code { order: 10; flex-basis: 100%; }
    .enttest-tb-code-input { max-width: none; }
    .enttest-cat-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .enttest-cat-search-wrap {
        width: 100%;
    }

    .enttest-cat-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .enttest-cat-chips {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .enttest-cat-chips::-webkit-scrollbar {
        display: none;
    }

    .enttest-cat-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .enttest-active-card { padding: 8px 12px; gap: 8px; border-radius: 8px; }
    .enttest-active-label { font-size: 12px; }
    .enttest-active-exam { font-size: 12px; }
    .enttest-active-btn { padding: 6px 12px; font-size: 12px; }
    .enttest-toolbar { padding: 3px; border-radius: 8px; }
    .enttest-tb-item { padding: 6px 8px; font-size: 12px; gap: 4px; }
    .enttest-tb-code-input { height: 28px; font-size: 11px; }
    .enttest-tb-code-btn { height: 28px; padding: 0 8px; font-size: 10px; }
    .enttest-cat-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
