/**
 * CTPAP Front-end Styles
 * Based on TPEP Design System (Deep Blue Theme)
 */

/* ========================================
   Resets and Base
   ======================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

body.layui-layout-body {
    overflow-y: auto;
}

a { text-decoration: none; color: #333; transition: all 0.3s; }
a:hover { color: #5DADE2; }

.ctpap-required { color: #e74c3c; margin-right: 2px; }

.ctpap-filter-form .layui-inline { margin-right: 15px; margin-bottom: 10px; }
.ctpap-filter-form .layui-inline label { display: block; margin-bottom: 5px; font-size: 12px; color: #666; }

/* Filter table layout - aligned search area，靠左不铺满 */
.ctpap-filter-form { margin-bottom: 15px; }
.ctpap-filter-table { width: auto; max-width: 100%; border-collapse: collapse; }
.ctpap-filter-table td { vertical-align: middle; padding: 0 12px 0 0; white-space: nowrap; }
.ctpap-filter-table td:last-child { padding-right: 0; }
.ctpap-filter-table label { display: block; margin-bottom: 5px; font-size: 12px; color: #666; }
/* 仅第一列标题搜索框较宽 */
.ctpap-filter-table td:first-child input { width: 200px; min-width: 160px; max-width: 280px; }
/* 下拉框及非第一列的输入框收窄 */
.ctpap-filter-table select.layui-input,
.ctpap-filter-table td:not(:first-child) input { width: 90px; min-width: 80px; max-width: 100px; }
/* Layui 下拉外层与标题区宽度与下拉一致，不撑开 */
.ctpap-filter-table .layui-form-select.layui-unselect,
.ctpap-filter-table .layui-select-title { width: 90px; min-width: 80px; max-width: 100px; box-sizing: border-box; }
/* 筛选区输入/下拉统一高度 */
.ctpap-filter-table .layui-input,
.ctpap-filter-table .layui-select-title { height: 38px; line-height: 38px; padding: 0 10px; box-sizing: border-box; }
.ctpap-filter-table .layui-select-title { line-height: 36px; }
/* 按钮与输入框对齐：与 label 下输入框同一水平线，高度一致 */
.ctpap-filter-table .ctpap-filter-actions { vertical-align: bottom; padding-top: 27px; }
.ctpap-filter-table .ctpap-filter-actions .layui-btn { height: 38px; line-height: 38px; padding: 0 18px; margin-right: 8px; box-sizing: border-box; }

/* Wrapper to enable sticky footer */
.ctpap-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.ctpap-main-content {
    flex: 1;
    padding: 30px 0;
}

/* ========================================
   Header
   ======================================== */
.ctpap-header {
    background: linear-gradient(135deg, #1B4F72 0%, #154360 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: relative;
    height: 70px;
}

.ctpap-header .layui-container {
    height: 100%;
    display: flex; /* Ensure container is flex */
    justify-content: space-between; /* brand, nav, auth */
    align-items: center;
}

.ctpap-header .header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    width: 100%;
}

/* Brand */
.ctpap-header .site-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ctpap-header .site-logo {
    height: 45px;
    width: auto;
}

.ctpap-header .site-name {
    font-size: 22px;
    font-weight: bold;
    color: #FFFFFF !important;
    text-decoration: none;
}

.ctpap-header .site-name:hover {
    color: #5DADE2 !important;
}

/* Navigation */
.ctpap-header .layui-nav {
    background: transparent;
    padding: 0;
}

.ctpap-nav { flex: 1; justify-content: center; }
.ctpap-nav-auth { margin-left: 20px; }
.ctpap-nav, .ctpap-nav-auth { display: flex; }
.ctpap-nav-auth {
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.ctpap-nav .layui-nav-item, .ctpap-nav-auth .layui-nav-item { line-height: 70px; }
.ctpap-nav .layui-nav-item a, .ctpap-nav-auth .layui-nav-item a {
    color: rgba(255,255,255,0.9) !important;
    font-size: 16px;
    padding: 0 18px;
}

.ctpap-nav .layui-nav-item.layui-this:after,
.ctpap-nav .layui-nav-item:hover:after,
.ctpap-nav-auth .layui-nav-item:hover:after,
.ctpap-nav-auth .layui-nav-item.layui-this:after {
    background-color: #5DADE2;
    height: 4px;
    bottom: 0px;
    width: 100%;
}

.ctpap-header .layui-nav .layui-nav-item {
    line-height: 70px;
}

.ctpap-header .layui-nav .layui-nav-item a {
    color: rgba(255,255,255,0.9) !important;
    font-size: 16px;
    padding: 0 25px;
}

.ctpap-header .layui-nav .layui-nav-item.layui-this:after,
.ctpap-header .layui-nav .layui-nav-item:hover:after {
    background-color: #5DADE2;
    height: 4px;
    bottom: 0px;
}

.ctpap-nav-auth .layui-nav-item:after,
.ctpap-nav-auth .layui-nav-item:hover:after,
.ctpap-nav-auth .layui-nav-item.layui-this:after {
    display: none !important;
}

.ctpap-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 36px;
    padding: 8px 14px !important;
    border-radius: 6px;
    font-size: 14px !important;
    font-weight: 500;
    line-height: 1.2 !important;
    text-decoration: none;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.14);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ctpap-header-btn:hover,
.ctpap-header-btn:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.ctpap-header-btn-login {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
}

.ctpap-header-btn-login:hover,
.ctpap-header-btn-login:focus-visible {
    background: rgba(255, 255, 255, 0.38);
}

.ctpap-header .layui-nav-bar {
    background-color: #5DADE2 !important;
}

.ctpap-search-bar {
    background: #f7f9fc;
    border-bottom: 1px solid #edf0f5;
    padding: 14px 0;
}

.ctpap-search-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctpap-search-form .layui-input {
    flex: 1;
    height: 40px;
    line-height: 40px;
}

.ctpap-search-form .layui-btn {
    height: 40px;
    line-height: 40px;
    padding: 0 24px;
}

.ctpap-type-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    border-radius: 4px;
    padding: 2px 6px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid transparent;
}

.ctpap-type-tag .layui-icon {
    font-size: 12px;
}

.ctpap-type-case {
    color: #1e6bb8;
    background: #eaf3ff;
    border-color: #cfe2ff;
}

.ctpap-type-student {
    color: #0f9d58;
    background: #e9f7ef;
    border-color: #cfead9;
}

/* ========================================
   Content & Typography
   ======================================== */
h2 {
    font-size: 24px;
    color: #154360;
    margin-bottom: 25px;
    font-weight: 700;
    position: relative;
    padding-left: 0;
}
/* Underline effect for H2 */
h2:after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #154360;
    margin-top: 8px;
    border-radius: 2px;
}

/* ========================================
   Cards
   ======================================== */
.layui-card {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: none;
    margin-bottom: 20px;
    background: #fff;
    transition: all 0.3s;
}

.layui-card:hover {
     box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.layui-card-header {
    border-bottom: 1px solid #ebedf0;
    font-weight: bold;
    font-size: 16px;
    color: #1B4F72;
}

.case-card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: none;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.case-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(27, 79, 114, 0.15);
}

.case-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    color: #154360;
}

.case-title a { color: #154360; }
.case-title a:hover { color: #5DADE2; }

.case-abstract {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.6;
    flex: 1;
}

.case-meta {
    color: #999;
    font-size: 13px;
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
}

/* Case list layout - 优化排版 */
.case-list-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    min-height: 120px;
}

.case-list-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.case-list-main .case-title {
    margin-bottom: 12px;
    font-size: 17px;
    line-height: 1.5;
}

.ctpap-list-meta {
    margin-bottom: 0 !important;
    padding-top: 12px !important;
    border-top: 1px dashed #e8eaed !important;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.ctpap-list-meta span {
    white-space: nowrap;
}

.ctpap-list-meta span:not(:last-child)::after {
    content: ' · ';
    margin-left: 4px;
    color: #bbb;
}

.ctpap-list-meta .ctpap-term-tags a {
    color: #5DADE2;
}

.ctpap-list-meta .ctpap-term-tags a:hover {
    color: #1B4F72;
}

.ctpap-feedback-tag {
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 4px;
}

.ctpap-fb-submitted {
    color: #0f9d58;
    background: #e9f7ef;
}

.ctpap-fb-none {
    color: #999;
    background: #f5f5f5;
}

.case-list-main .case-abstract {
    flex: 1;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-list-action {
    flex: 0 0 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-list-action .layui-btn {
    white-space: nowrap;
}

.ctpap-btn-lg {
    font-size: 15px;
}

/* 列表卡片整体优化 */
.ctpap-main-content .layui-col-md12 .case-card {
    padding: 24px 28px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-row .layui-btn-xs {
    margin-bottom: 4px;
}

/* Pagination */
.ctpap-pagination {
    display: flex;
    justify-content: center;
}

.ctpap-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 40px;
    margin: 0 6px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid #dcdfe6;
    background: #fff;
    color: #1B4F72;
    font-size: 15px;
}

.ctpap-pagination .page-numbers.current {
    background: #1B4F72;
    color: #fff;
    border-color: #1B4F72;
}

.ctpap-pagination .page-numbers:hover {
    border-color: #5DADE2;
    color: #5DADE2;
}

/* ========================================
   Case Player
   ======================================== */
#ctpap-player-container {
    align-items: center !important;
    justify-content: center !important;
    text-align: center;
}

#ctpap-player-container iframe {
    display: block;
    max-width: 100%;
    margin: 0 auto;
}

#player-video-view {
    width: 100%;
    height: 500px;
    display: block;
    margin: 0 auto;
    background: #000;
}

.ctpap-player-text {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    text-align: left;
}

/* ========================================
   Buttons & Tabs
   ======================================== */
.layui-btn-primary {
    border-color: #dcdfe6;
    color: #606266;
}
.layui-btn-primary:hover {
    border-color: #5DADE2;
    color: #5DADE2;
}

.layui-tab-brief > .layui-tab-title .layui-this {
    color: #1B4F72;
}
.layui-tab-brief > .layui-tab-more li.layui-this:after, 
.layui-tab-brief > .layui-tab-title .layui-this:after {
    border-bottom: 2px solid #1B4F72;
}

/* ========================================
   Home spacing & grid alignment - 卡片强制对齐
   ======================================== */
.ctpap-home .ctpap-section {
    margin-bottom: 40px;
}

.ctpap-home .ctpap-section h2 {
    margin-bottom: 18px;
}

.ctpap-home .ctpap-section-grid {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

.ctpap-home .ctpap-section-grid > .layui-col-md3,
.ctpap-home .ctpap-section-grid > .layui-col-sm6 {
    display: flex;
}

.ctpap-home .case-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ctpap-home .case-title {
    min-height: 44px;
    flex-shrink: 0;
}

.ctpap-home .case-abstract {
    flex: 1;
    min-height: 72px;
    flex-shrink: 0;
}

/* 首页卡片 meta：作者、日期各一行，类型和领域同一行，强制底部对齐 */
.ctpap-home-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: auto;
    flex-shrink: 0;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.ctpap-home-meta .ctpap-meta-line {
    width: 100%;
    font-size: 12px;
}

.ctpap-home-meta .ctpap-meta-terms {
    color: #666;
}

.ctpap-home-meta .ctpap-meta-terms a {
    color: #5DADE2;
}

.ctpap-home-meta .ctpap-meta-terms a:hover {
    color: #1B4F72;
}

/* ========================================
   Footer
   ======================================== */
.ctpap-feedback-header {
    overflow: hidden;
}

.ctpap-feedback-header h1 {
    vertical-align: middle;
}

/* ========================================
   Footer
   ======================================== */
.ctpap-footer {
    background: linear-gradient(135deg, #1B4F72 0%, #154360 100%);
    color: #ffffff;
    padding: 30px 0;
    margin-top: auto;
    text-align: center;
    font-size: 14px;
}

/* Override Admin Bar */
html { margin-top: 0 !important; }
* html body { margin-top: 0 !important; }

