/* ============================================================
   数学教学课件 - 检索页样式
   沿用站点已有的半透明卡片风格，新增列表、弹窗和按钮
   ============================================================ */

.cw-intro {
    color: #555;
    line-height: 1.9;
    margin-bottom: 22px;
    max-width: 980px;
}

/* 搜索框 */
.cw-filter-bar {
    align-items: flex-end;
}

.cw-search-group {
    flex: 1 1 340px;
}

.cw-search-group input {
    flex: 1 1 auto;
    min-width: 220px;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background-color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cw-search-group input:focus {
    border-color: #66bb6a;
    box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.16);
}

.cw-reset,
.cw-refresh {
    border: none;
    background: transparent;
    color: #2e7d32;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.cw-reset:hover,
.cw-refresh:hover {
    color: #1b5e20;
    background-color: rgba(102, 187, 106, 0.12);
}

/* 索引状态 */
.cw-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-bottom: 16px;
    color: #666;
    font-size: 14px;
}

.cw-status #cw-count {
    font-weight: bold;
    color: #333;
}

.cw-status #cw-updated {
    color: #777;
}

.cw-status .cw-refresh {
    margin-left: auto;
    font-size: 13px;
}

/* 课件列表 */
.cw-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.cw-item {
    display: flex;
    gap: 15px;
    padding: 18px;
    min-width: 0;
    background-color: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
}

.cw-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
    background-color: rgba(255, 255, 255, 0.2);
}

.cw-icon {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.cw-icon-ppt {
    background: linear-gradient(135deg, #ef6c00, #c62828);
}

.cw-icon-doc {
    background: linear-gradient(135deg, #1e88e5, #1565c0);
}

.cw-icon-pdf {
    background: linear-gradient(135deg, #e53935, #b71c1c);
}

.cw-icon-other {
    background: linear-gradient(135deg, #78909c, #455a64);
}

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

.cw-name {
    margin: 0 0 4px;
    font-size: 17px;
    line-height: 1.45;
    color: #222;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
}

.cw-path {
    margin: 0 0 9px;
    font-size: 12px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cw-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.cw-chip {
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.5;
}

.cw-chip-grade {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.cw-chip-type {
    background-color: #e3f2fd;
    color: #1976d2;
}

.cw-size,
.cw-time {
    font-size: 12px;
    color: #777;
}

.cw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cw-btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.cw-btn:hover {
    transform: translateY(-1px);
}

.cw-btn:active {
    transform: translateY(0);
}

.cw-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.cw-btn-primary {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: #fff;
    box-shadow: 0 2px 6px rgba(67, 160, 71, 0.3);
}

.cw-btn-primary:hover {
    background: linear-gradient(135deg, #5cb860, #388e3c);
}

.cw-btn-ghost {
    background-color: rgba(255, 255, 255, 0.7);
    border-color: #cfd8dc;
    color: #333;
}

.cw-btn-ghost:hover {
    background-color: #fff;
}

/* 空状态 */
.cw-empty {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #666;
    background-color: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cw-empty h4 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #333;
}

.cw-empty p {
    margin: 0;
    line-height: 1.8;
}

/* 弹窗 */
.cw-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cw-modal[hidden] {
    display: none;
}

.cw-modal-mask {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.cw-modal-card {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: 82vh;
    overflow-y: auto;
    padding: 24px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

.cw-modal-card h4 {
    margin: 0 0 12px;
    font-size: 20px;
    color: #222;
}

.cw-modal-body {
    font-size: 14px;
    line-height: 1.8;
    color: #444;
}

.cw-modal-body p {
    margin: 0 0 10px;
}

.cw-modal-body ul {
    margin: 0 0 12px 20px;
    padding: 0;
}

.cw-modal-body li {
    margin-bottom: 4px;
}

.cw-modal-note {
    padding: 10px 12px;
    background-color: #fff8e1;
    border-left: 3px solid #ffb300;
    border-radius: 4px;
    color: #8d6e63;
    font-size: 13px;
}

.cw-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

body.cw-modal-open {
    overflow: hidden;
}

/* Toast */
.cw-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    z-index: 10000;
    max-width: 90vw;
    padding: 10px 18px;
    background-color: rgba(33, 33, 33, 0.92);
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    border-radius: 22px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.25s, transform 0.25s;
}

.cw-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
    .cw-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .cw-filter-bar {
        align-items: stretch;
    }

    .cw-search-group {
        flex-basis: 100%;
    }

    .cw-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .cw-status .cw-refresh {
        margin-left: 0;
    }

    .cw-item {
        padding: 15px;
    }

    .cw-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }
}

@media (max-width: 480px) {
    .cw-search-group input {
        min-width: 0;
    }

    .cw-actions .cw-btn {
        flex: 1 1 auto;
    }

    .cw-name {
        font-size: 16px;
    }

    .cw-modal-card {
        padding: 20px;
    }

    .cw-modal-actions .cw-btn {
        flex: 1 1 auto;
    }
}
