/* ============================================
   钟蓝救援管理系统 - 自定义控件样式
   包括：弹窗、选择框、日期选择器、时间选择器
   ============================================ */

/* ========== 自定义弹窗 Modal ========== */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.custom-modal-overlay.active .custom-modal {
    transform: scale(1) translateY(0);
}

.custom-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.custom-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.custom-modal-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.custom-modal-body {
    padding: 20px 24px;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
    max-height: 50vh;
    overflow-y: auto;
}

.custom-modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
}

.custom-modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-modal-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
}

.custom-modal-btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
}

.custom-modal-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.custom-modal-btn-secondary:hover {
    background: #e2e8f0;
}

.custom-modal-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.custom-modal-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.custom-modal-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.custom-modal-btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

/* ========== 自定义选择框 Custom Select ========== */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: all 0.2s;
}

.custom-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-select:hover {
    border-color: #cbd5e1;
}

.custom-select option {
    padding: 10px;
    background: #fff;
    color: #1e293b;
}

/* 自定义下拉面板样式 */
.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.custom-select-dropdown.active {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.9rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: #f8fafc;
}

.custom-select-option.selected {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

/* ========== 自定义日期选择器 Custom Date Picker ========== */
.custom-date-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: all 0.2s;
}

.custom-date-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-date-input:hover {
    border-color: #cbd5e1;
}

/* 日期选择器弹窗 */
.custom-date-picker {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 16px;
    width: 280px;
    display: none;
}

.custom-date-picker.active {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

.custom-date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.custom-date-nav {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    transition: all 0.2s;
}

.custom-date-nav:hover {
    background: #e2e8f0;
}

.custom-date-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.custom-date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.custom-date-weekday {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 8px 0;
    font-weight: 600;
}

.custom-date-day {
    text-align: center;
    padding: 8px 0;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    color: #475569;
}

.custom-date-day:hover {
    background: #f1f5f9;
}

.custom-date-day.other-month {
    color: #cbd5e1;
}

.custom-date-day.today {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.custom-date-day.selected {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 600;
}

/* ========== 自定义时间选择器 Custom Time Picker ========== */
.custom-time-input {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9rem;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: all 0.2s;
}

.custom-time-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-time-input:hover {
    border-color: #cbd5e1;
}

/* 时间选择器弹窗 */
.custom-time-picker {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 16px;
    width: 200px;
    display: none;
}

.custom-time-picker.active {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

.custom-time-columns {
    display: flex;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.custom-time-column {
    flex: 1;
    text-align: center;
}

.custom-time-column-title {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.custom-time-option {
    padding: 8px;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    color: #475569;
}

.custom-time-option:hover {
    background: #f1f5f9;
}

.custom-time-option.selected {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 600;
}

/* ========== Toast 提示 ========== */
.custom-toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.custom-toast {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastSlideIn 0.3s ease;
    max-width: 90vw;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-toast.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.custom-toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.custom-toast.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.custom-toast.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .custom-modal {
        width: 95%;
        max-width: 95%;
    }
    
    .custom-modal-header {
        padding: 16px 20px 12px;
    }
    
    .custom-modal-body {
        padding: 16px 20px;
    }
    
    .custom-modal-footer {
        padding: 12px 20px 16px;
    }
    
    .custom-date-picker {
        width: calc(100vw - 40px);
        max-width: 280px;
    }
}
