/* com_theses front-end
   Re-theme by overriding the variables on .ths-wrapper in your template CSS. */
.ths-wrapper {
    --pp-accent: #17a2b8;
    --pp-accent-dark: #128a9d;
    --pp-ink: #1f2d3d;
    --pp-muted: #5f6f7f;
    --pp-card: #f4fafc;
    --pp-card-hover: #fff;
    --pp-line: #d9ecf1;
    --pp-t-phd: #7e3fb5;      --pp-t-phd-bg: #f0e5fa;
    --pp-t-masters: #0e7c8f;  --pp-t-masters-bg: #dff3f7;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    color: var(--pp-ink);
}

/* ---------- Toolbar ---------- */
.ths-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
    padding: 12px;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    border-radius: 12px;
}

.ths-search { display: flex; flex: 1 1 360px; min-width: 240px; gap: 6px; }

.ths-search-input {
    min-width: 0;
    flex: 1 1 auto;
    height: 42px;
    border: 1px solid var(--pp-line);
    border-radius: 999px;
    padding: 0 18px;
    background: #fff;
}
.ths-search-input:focus {
    border-color: var(--pp-accent);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, .2);
    outline: 0;
}

.ths-search-btn,
.ths-clear-search {
    height: 42px;
    padding: 0 20px;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
    transition: background-color .18s ease, box-shadow .18s ease;
}

.ths-search-btn { border: 0; background: var(--pp-accent); color: #fff; }
.ths-search-btn:hover, .ths-search-btn:focus { background: var(--pp-accent-dark); box-shadow: 0 4px 12px rgba(23, 162, 184, .35); }

.ths-filter { display: flex; align-items: center; gap: 8px; }
.ths-filter-label { margin: 0; font-weight: 700; color: var(--pp-muted); font-size: 14px; }

.ths-filter-select {
    min-width: 190px;
    height: 42px;
    padding: 6px 34px 6px 14px;
    border: 1px solid var(--pp-line);
    border-radius: 999px;
    font-size: 14px;
    color: #222 !important;
    background-color: #fff !important;
}
.ths-filter-select:focus { border-color: var(--pp-accent); box-shadow: 0 0 0 3px rgba(23, 162, 184, .2); outline: 0; }
.ths-filter-select option { color: #222 !important; background: #fff !important; }

.ths-clear-search { border: 1px solid var(--pp-line); color: var(--pp-muted); background: #fff; }
.ths-clear-search:hover { color: var(--pp-ink); border-color: var(--pp-accent); }

.ths-result-info { margin: -6px 0 16px; color: var(--pp-muted); font-size: 14px; }

/* ---------- List & cards ---------- */
.ths-list { display: flex; flex-direction: column; gap: 14px; }

.ths-item {
    --pp-c: var(--pp-accent);
    --pp-c-bg: var(--pp-t-masters-bg);
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 18px;
    padding: 16px 18px;
    background: var(--pp-card);
    border: 1px solid var(--pp-line);
    border-right: 4px solid var(--pp-c);
    border-radius: 10px;
    box-sizing: border-box;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.ths-item:hover, .ths-item:focus-within {
    background: var(--pp-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(23, 80, 100, .12);
}
.ths-item-single:hover { transform: none; }


.ths-item--phd      { --pp-c: var(--pp-t-phd);      --pp-c-bg: var(--pp-t-phd-bg); }
.ths-item--masters  { --pp-c: var(--pp-t-masters);  --pp-c-bg: var(--pp-t-masters-bg); }

.ths-item-body { flex: 1 1 auto; min-width: 0; text-align: right; order: 1; }

.ths-item-title { font-weight: 700; line-height: 1.85; margin-bottom: 6px; }
.ths-item-title a { color: var(--pp-ink); text-decoration: none; }
.ths-item-title a:hover, .ths-item-title a:focus { color: var(--pp-c); text-decoration: none; }


/* ---------- Meta: degree badge and defense date ---------- */
.ths-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 13.5px;
    color: var(--pp-muted);
    line-height: 1.7;
}

.ths-item-type {
    display: inline-block;
    padding: 1px 12px;
    border-radius: 999px;
    background: var(--pp-c-bg);
    color: var(--pp-c);
    font-weight: 700;
    white-space: nowrap;
}


/* ---------- Custom fields ---------- */
.ths-custom-fields {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--pp-line);
    font-size: 13.5px;
    line-height: 1.9;
}
.ths-custom-field { display: block; }
.ths-custom-label { font-weight: 700; margin-left: 4px; color: var(--pp-ink); }
.ths-custom-value { display: inline; }

/* ---------- Buttons ---------- */
.ths-item-action {
    flex: 0 0 auto;
    order: 2;
    align-self: flex-end;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.ths-download-link,
.ths-view-btn,
.ths-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 36px;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

.ths-download-link { background: var(--pp-accent); border: 1px solid var(--pp-accent); color: #fff; }
.ths-download-link:hover, .ths-download-link:focus {
    background: var(--pp-accent-dark);
    border-color: var(--pp-accent-dark);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(23, 162, 184, .35);
}

.ths-view-btn { background: #fff; border: 1px solid var(--pp-line); color: var(--pp-c); }
.ths-view-btn:hover, .ths-view-btn:focus { background: var(--pp-c-bg); border-color: var(--pp-c); color: var(--pp-c); text-decoration: none; }

.ths-back { gap: 6px; margin-bottom: 14px; background: #fff; border: 1px solid var(--pp-line); color: var(--pp-muted); }
.ths-back:hover, .ths-back:focus { border-color: var(--pp-accent); color: var(--pp-accent-dark); text-decoration: none; }

/* ---------- Single thesis ---------- */
.ths-item-single { display: block; padding: 22px 24px; }
.ths-item-single .ths-item-title { font-size: 1.2rem; line-height: 1.75; margin: 0 0 12px; }
.ths-item-single .ths-item-action { margin-top: 18px; }

/* ---------- Empty state & pagination ---------- */
.ths-empty { padding: 28px; text-align: center; color: var(--pp-muted); border: 1px dashed var(--pp-line); border-radius: 10px; background: var(--pp-card); }

.ths-pagination { margin-top: 26px; display: flex; justify-content: center; }
.ths-pagination .pagination { margin: 0; flex-wrap: wrap; gap: 4px; }
.ths-pagination .page-link { min-width: 38px; text-align: center; border-radius: 8px !important; color: var(--pp-accent-dark); border-color: var(--pp-line); }
.ths-pagination .page-item.active .page-link { background: var(--pp-accent); border-color: var(--pp-accent); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
    .ths-toolbar { display: block; }
    .ths-search, .ths-filter { width: 100%; margin-bottom: 10px; }
    .ths-filter-select { flex: 1 1 auto; min-width: 0; width: 100%; }
    .ths-item { flex-direction: column; gap: 12px; padding: 14px 16px; }
    .ths-item-action { order: 2; align-self: stretch; width: 100%; }
    .ths-item-title { font-size: 1rem; }
    .ths-item-single { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .ths-item, .ths-search-btn, .ths-download-link, .ths-view-btn { transition: none; }
    .ths-item:hover, .ths-item:focus-within { transform: none; }
}

/* ---------- Clickable category (single thesis page) ---------- */
a.ths-item-type { color: var(--pp-c); text-decoration: none; transition: filter .18s ease, box-shadow .18s ease; }
a.ths-item-type:hover, a.ths-item-type:focus { filter: brightness(.95); box-shadow: 0 0 0 2px var(--pp-c-bg); text-decoration: none; color: var(--pp-c); }

/* ---------- Student line, date, separator ---------- */
.ths-item-student { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--pp-ink); font-weight: 600; line-height: 1.8; }
.ths-item-student .ths-icon { flex: 0 0 auto; color: var(--pp-c); }
.ths-item-student-label { color: var(--pp-muted); font-weight: 700; }
.ths-item-sep { color: var(--pp-line); }
.ths-item-date { color: var(--pp-muted); }
.ths-item-date-label { font-weight: 700; }
.ths-icon { flex: 0 0 auto; }

/* ---------- Sort buttons and item count ---------- */
.ths-sort { display: flex; align-items: center; gap: 6px; }
.ths-sort-label { font-weight: 700; color: var(--pp-muted); font-size: 14px; margin-left: 4px; }
.ths-sort-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid var(--pp-line); border-radius: 999px;
    background: #fff; color: var(--pp-muted);
    font-size: 18px; line-height: 1; text-decoration: none;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.ths-sort-btn:hover, .ths-sort-btn:focus, .ths-sort-btn.is-active { border-color: var(--pp-accent); color: var(--pp-accent-dark); background: var(--pp-c-bg, #dff3f7); text-decoration: none; }

.ths-count { margin: 0 0 14px; color: var(--pp-muted); font-size: 14px; font-weight: 700; }
.ths-count span { color: var(--pp-ink); }

@media (max-width: 767.98px) {
    .ths-sort { width: 100%; margin-bottom: 10px; flex-wrap: wrap; }
}

/* ---------- Detail rows and abstract (single thesis page) ---------- */
.ths-details { margin: 10px 0 0; padding: 0; font-size: 14px; line-height: 1.95; }
.ths-detail { display: block; }
.ths-details dt { display: inline; font-weight: 700; color: var(--pp-ink); }
.ths-details dd { display: inline; margin: 0; color: var(--pp-ink); }
.ths-abstract { margin-top: 12px; font-size: 14px; line-height: 2; }
.ths-abstract--open { padding-top: 12px; border-top: 1px dashed var(--pp-line); }
.ths-abstract-title { margin: 0 0 6px; font-size: 1rem; font-weight: 700; color: var(--pp-c); }
.ths-abstract-text { color: var(--pp-ink); text-align: justify; }
.ths-item--bachelor { --pp-c: #a05a00; --pp-c-bg: #fdefd6; }

.ths-item-extra { color: var(--pp-muted); }

/* Filters sit on their own row under the search box */
.ths-search { flex: 1 1 100%; }
.ths-filters { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.ths-filters .ths-filter-select { min-width: 150px; }
@media (max-width: 768px) { .ths-filters { display: block; } .ths-filters .ths-filter { margin-bottom: 10px; } }
