/* ============================================
   家训轮播横幅样式
   css/components/_motto-banner.css
   ============================================ */

/* ---- 横幅容器 ---- */
.motto-banner {
    height: 36px;
    background: linear-gradient(90deg, #fdf6ec 0%, #fef9f0 50%, #fdf6ec 100%);
    border-bottom: 1px solid #f0e6d2;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    z-index: 50;
    flex-shrink: 0;
}

.motto-banner.collapsed {
    height: 0;
    opacity: 0;
    padding: 0;
    border-bottom: none;
}

/* ---- 轮播文字区域 ---- */
.motto-banner .motto-scroll-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    padding: 0 60px;
}

.motto-banner .motto-text-wrapper {
    position: relative;
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.motto-banner .motto-item {
    position: absolute;
    width: 100%;
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
    font-size: 13px;
    color: #8B6914;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.motto-banner .motto-item.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.motto-banner .motto-item .motto-content {
    font-weight: 500;
}

.motto-banner .motto-item .motto-source {
    margin-left: 8px;
    color: #a0842a;
    font-size: 12px;
    font-weight: 400;
}

.motto-banner .motto-item .motto-category {
    display: inline-block;
    font-size: 10px;
    background: rgba(139, 105, 20, 0.12);
    color: #8B6914;
    padding: 0 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    line-height: 16px;
}

/* ---- 圆点指示器 ---- */
.motto-banner .motto-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.motto-banner .motto-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d4c4a1;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    border: none;
    padding: 0;
}

.motto-banner .motto-dot.active {
    background: #8B6914;
    transform: scale(1.3);
}

.motto-banner .motto-dot:hover {
    background: #b8a36a;
}

/* ---- 右侧操作按钮 ---- */
.motto-banner .motto-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.motto-banner .motto-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: #a0842a;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s ease, color 0.2s ease;
    padding: 0;
}

.motto-banner .motto-action-btn:hover {
    background: rgba(139, 105, 20, 0.12);
    color: #8B6914;
}

/* ---- 管理面板模态框 ---- */
.motto-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.motto-modal-overlay.visible {
    display: flex;
}

.motto-modal {
    background: #fff;
    border-radius: 12px;
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    animation: mottoModalIn 0.25s ease;
}

@keyframes mottoModalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.motto-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0e6d2;
    background: linear-gradient(135deg, #fdf6ec, #fef9f0);
    border-radius: 12px 12px 0 0;
}

.motto-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #5a4516;
    display: flex;
    align-items: center;
    gap: 8px;
}

.motto-modal-header h3 i {
    color: #8B6914;
}

.motto-modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s ease, color 0.2s ease;
}

.motto-modal-close:hover {
    background: rgba(0,0,0,0.06);
    color: #333;
}

.motto-modal-body {
    padding: 20px;
}

/* ---- 堂号设置 ---- */
.motto-hall-name-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0e6d2;
}

.motto-hall-name-section label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.motto-hall-name-section input {
    width: 100%;
    max-width: 240px;
    padding: 7px 10px;
    border: 1px solid #e0d5b8;
    border-radius: 6px;
    font-size: 14px;
    color: #5a4516;
    background: #fefcf8;
    transition: border-color 0.2s ease;
}

.motto-hall-name-section input:focus {
    outline: none;
    border-color: #8B6914;
    box-shadow: 0 0 0 2px rgba(139, 105, 20, 0.12);
}

/* ---- 家训列表 ---- */
.motto-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.motto-list-header h4 {
    margin: 0;
    font-size: 14px;
    color: #5a4516;
}

.motto-list-header .motto-count {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

.motto-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.motto-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #f0e6d2;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fefcf8;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.motto-list-item:hover {
    border-color: #d4c4a1;
    box-shadow: 0 2px 8px rgba(139, 105, 20, 0.08);
}

.motto-list-item .motto-drag-handle {
    color: #d4c4a1;
    cursor: grab;
    font-size: 14px;
    padding-top: 2px;
    user-select: none;
}

.motto-list-item .motto-drag-handle:active {
    cursor: grabbing;
}

.motto-list-item .motto-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.motto-list-item .motto-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.motto-list-item input[type="text"],
.motto-list-item textarea {
    padding: 5px 8px;
    border: 1px solid #e8e0cc;
    border-radius: 5px;
    font-size: 13px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s ease;
}

.motto-list-item input[type="text"]:focus,
.motto-list-item textarea:focus {
    outline: none;
    border-color: #8B6914;
}

.motto-list-item input.motto-input-text {
    flex: 1;
}

.motto-list-item input.motto-input-author {
    width: 100px;
}

.motto-list-item select.motto-input-category {
    width: 90px;
    padding: 5px 6px;
    border: 1px solid #e8e0cc;
    border-radius: 5px;
    font-size: 12px;
    color: #666;
    background: #fff;
}

.motto-list-item textarea {
    width: 100%;
    resize: vertical;
    min-height: 32px;
    font-size: 13px;
}

.motto-list-item .motto-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
}

.motto-list-item .motto-item-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: color 0.2s ease, background 0.2s ease;
}

.motto-list-item .motto-item-action-btn:hover {
    background: rgba(0,0,0,0.04);
}

.motto-list-item .motto-item-action-btn.motto-btn-edit:hover {
    color: #8B6914;
}

.motto-list-item .motto-item-action-btn.motto-btn-delete:hover {
    color: #e74c3c;
}

/* ---- 添加家训按钮 ---- */
.motto-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px;
    border: 1px dashed #d4c4a1;
    border-radius: 8px;
    background: transparent;
    color: #8B6914;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease, border-color 0.2s ease;
    margin-top: 4px;
}

.motto-add-btn:hover {
    background: rgba(139, 105, 20, 0.06);
    border-color: #8B6914;
}

/* ---- 模态框底部 ---- */
.motto-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f0e6d2;
    background: #fefcf8;
    border-radius: 0 0 12px 12px;
}

.motto-modal-footer .btn-save-motto {
    padding: 7px 20px;
    background: #8B6914;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.motto-modal-footer .btn-save-motto:hover {
    background: #6e5210;
}

.motto-modal-footer .btn-cancel-motto {
    padding: 7px 16px;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.motto-modal-footer .btn-cancel-motto:hover {
    background: #f5f5f5;
}

/* ---- 空状态 ---- */
.motto-empty-state {
    text-align: center;
    padding: 24px 0;
    color: #bbb;
    font-size: 13px;
}

.motto-empty-state i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
    color: #d4c4a1;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .motto-banner .motto-scroll-area {
        padding: 0 50px;
    }

    .motto-banner .motto-dots {
        left: 10px;
    }

    .motto-banner .motto-actions {
        right: 8px;
    }

    .motto-modal {
        width: 95vw;
        max-height: 90vh;
    }

    .motto-list-item .motto-field-row {
        flex-direction: column;
        align-items: stretch;
    }

    .motto-list-item input.motto-input-author,
    .motto-list-item select.motto-input-category {
        width: 100%;
    }
}

/* ---- 折叠状态记忆提示 ---- */
.motto-collapsed-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(90, 69, 22, 0.92);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 10000;
    animation: mottoToastIn 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.motto-collapsed-toast:hover {
    background: rgba(90, 69, 22, 1);
}

@keyframes mottoToastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
