/**
 * 模态框组件样式表
 * 
 * @file components/modals.css
 * @description 统一的模态框组件样式，包括预约模态框、批量删除模态框等
 * @author CodeBuddy
 * @created 2025-01-13
 * @version 2.0.0
 * 
 * 功能模块：
 * - 模态框基础样式
 * - 预约表单模态框
 * - 批量删除模态框
 * - 动画效果
 * - 响应式设计
 */

/* ========================================
   模态框基础样式 - 毛玻璃效果
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    animation: modalBackdropFadeIn 0.3s ease-out;
    color: #333333 !important; /* 确保模态框默认文字颜色为深色 */
}

/* 全局模态框文字颜色修复 - 确保所有模态框文字都是深色 */
.modal *,
.modal p,
.modal span,
.modal div:not(.close),
.modal label,
.modal h1, .modal h2, .modal h3, .modal h4, .modal h5, .modal h6,
.modal-content *,
.modal-header *,
.modal-body *,
.modal-footer * {
    color: #333333 !important;
}

/* 状态标签颜色修复 - 确保在模态框中状态标签保持正确的颜色 */
.modal .status-success,
.modal .status-active,
.modal .status-completed {
    color: #28a745 !important;
    background: rgba(46, 204, 113, 0.15) !important;
}

.modal .status-error,
.modal .status-danger,
.modal .status-failed,
.modal .status-stopped {
    color: #dc3545 !important;
    background: rgba(231, 76, 60, 0.15) !important;
}

.modal .status-warning,
.modal .status-pending,
.modal .status-waiting {
    color: #ffc107 !important;
    background: rgba(243, 156, 18, 0.15) !important;
}

.modal .status-info,
.modal .status-running {
    color: #17a2b8 !important;
    background: rgba(23, 162, 184, 0.15) !important;
}

.modal .status-expired,
.modal .status-inactive {
    color: #6c757d !important;
    background: rgba(108, 117, 125, 0.15) !important;
}

.modal .status-normal {
    color: #c0392b !important;
    background: rgba(192, 57, 43, 0.15) !important;
}

.modal .status-auto {
    color: #f39c12 !important;
    background-color: rgba(243, 156, 18, 0.2) !important;
}



/* 特殊处理表单元素 */
.modal input,
.modal select,
.modal textarea {
    color: #333333 !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
}

.modal input::placeholder,
.modal textarea::placeholder {
    color: #666666 !important;
}

/* 强制在 JS 将 aria-hidden 设置为 false 时以 flex 居中显示，避免被其他样式或脚本覆盖 */
#appointmentFormModal[aria-hidden="false"],
.modal[aria-hidden="false"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 25px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 15px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(255, 255, 255, 0.5);
    width: 100%;
    max-width: 800px;
    overflow: hidden;
    animation: modalContentFadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

/* 预约表单模态框特殊样式 */
#appointmentFormModal .modal-content,
.appointment-modal .modal-content {
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

/* 新增预约模态 - 垂直布局与适中间距，仅作用于预约模态 */
#appointmentFormModal .modal-body {
    padding: 28px 24px; /* 适度内边距 */
}

#appointmentFormModal .modal-body form {
    display: flex;
    flex-direction: column; /* 垂直布局 */
    gap: 12px; /* 适中项间距 */
}

#appointmentFormModal .form-row {
    display: flex;
    flex-direction: column; /* 将可能并排的行改为垂直 */
    gap: 12px;
}

#appointmentFormModal .form-group {
    margin-bottom: 12px; /* 适中下间距 */
}

#appointmentFormModal .form-actions {
    margin-top: 8px;
    padding-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px; /* 按钮间距 */
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* 新增账号模态框特殊样式 */
#addAccountModal .modal-content {
    width: 100%;
    max-width: 600px;
    height: 400px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.2),
        0 20px 40px rgba(0, 0, 0, 0.15),
        inset 0 2px 0 rgba(255, 255, 255, 0.9);
}

#addAccountModal .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: #333333 !important;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 25px;
    overflow-y: auto;
}

/* 确保新增账号模态框内所有文本都是深色 */
#addAccountModal .modal-body *,
#addAccountModal .modal-body p,
#addAccountModal .modal-body span,
#addAccountModal .modal-body div,
#addAccountModal .modal-body label,
#addAccountModal .modal-body input,
#addAccountModal .modal-body select,
#addAccountModal .modal-body textarea {
    color: #333333 !important;
}

#addAccountModal .modal-body input::placeholder,
#addAccountModal .modal-body textarea::placeholder {
    color: #666666 !important;
}

#addAccountModal .modal-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: auto;
}



.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.modal-header h2 {
    margin: 0;
    color: #ff9900 !important;
    font-size: 22px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 25px;
    max-height: 700px;
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: #333333 !important; /* 强制设置文字颜色为深色 */
}

/* 确保模态框内所有文本元素都是深色 */
.modal-body *,
.modal-body p,
.modal-body span,
.modal-body div,
.modal-body label,
.modal-body input,
.modal-body select,
.modal-body textarea {
    color: #333333 !important;
}

/* 特殊处理占位符文本 */
.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: #666666 !important;
}

.modal-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

/* 通用模态框底部样式 - 按钮容器 */
.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
}

/* 确保模态框底部按钮文字颜色正确 */
.modal-footer .btn {
    color: #333333 !important;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #ff9900, #ff7700);
    color: white !important;
    border: none;
}

.modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #ff7700, #ff5500);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 153, 0, 0.3);
}

.modal-footer .btn-outline {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #333333 !important;
}

.modal-footer .btn-outline:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

/* 关闭按钮样式 */
.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.close:hover {
    color: #ff4444;
    transform: scale(1.1);
    text-shadow: 0 2px 4px rgba(255, 68, 68, 0.3);
}

/* 显示模态框时的样式 */
.modal.show {
    display: flex;
}

/* ========================================
   批量删除模态框样式
   ======================================== */
.batch-delete-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.batch-delete-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* 批量删除标题样式 */
.batch-delete-title {
    color: var(--danger);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.batch-delete-title i {
    font-size: 28px;
}

/* 消息文本样式 */
.batch-delete-message {
    color: var(--dark);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 25px;
}

.batch-delete-message strong {
    color: var(--danger);
    font-weight: 700;
}

/* 选中项目列表样式 */
.selected-items-list {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.selected-item {
    padding: 8px 12px;
    margin: 5px 0;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    border-left: 4px solid var(--danger);
    font-size: 14px;
    color: var(--dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 按钮容器 */
.batch-delete-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   动画效果
   ======================================== */
@keyframes modalBackdropFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

@keyframes modalContentFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 传统动画保持兼容性 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    .batch-delete-content {
        margin: 20px;
        padding: 20px;
    }
    
    .batch-delete-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        width: 98%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* ========================================
   加载状态
   ======================================== */
.batch-delete-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #dc3545;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   美化滚动条样式
   ======================================== */
.modal-body::-webkit-scrollbar,
.selected-items-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.modal-body::-webkit-scrollbar-track,
.selected-items-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb,
.selected-items-list::-webkit-scrollbar-thumb {
    background: rgba(255, 153, 0, 0.3);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.modal-body::-webkit-scrollbar-thumb:hover,
.selected-items-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 153, 0, 0.5);
}