/**
 * 记录模态框美化样式
 * 提供更简洁、美观的记录添加/编辑界面
 */

/* 模态框整体样式 */
#recordModal .modal-dialog {
    max-width: 450px;
    margin: 1.75rem auto;
}

#recordModal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

#recordModal .modal-header {
    background: linear-gradient(135deg, #3a8ffe 0%, #0d6efd 100%);
    color: white;
    border-bottom: none;
    padding: 15px 20px;
}

#recordModal .modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

#recordModal .modal-title::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z'/%3E%3Cpath d='M3 5.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM3 8a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 8zm0 2.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    margin-right: 8px;
}

#recordModal .btn-close {
    color: white;
    opacity: 0.8;
    filter: brightness(5);
}

#recordModal .btn-close:hover {
    opacity: 1;
}

#recordModal .modal-body {
    padding: 20px;
    background-color: #f8f9fa;
}

#recordModal .modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 20px;
}

/* 表单样式 */
#recordForm .form-row {
    margin-bottom: 12px;
    position: relative;
    display: flex;
    align-items: center;
}

#recordForm .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0;
    font-size: 0.9rem;
    width: 80px;
    flex-shrink: 0;
    text-align: left;
    padding-right: 10px;
    border: none;
}

#recordForm .form-control,
#recordForm .form-select,
#recordForm .amount-input-group {
    flex: 1;
    border-radius: 4px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
    background-color: white;
}

#recordForm .form-control:focus,
#recordForm .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

#recordForm .form-control:disabled,
#recordForm .form-select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* 表单分组 */
.form-section {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 按钮样式 */
#recordModal .btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#recordModal .btn-primary {
    background: linear-gradient(135deg, #3a8ffe 0%, #0d6efd 100%);
    border: none;
    box-shadow: 0 3px 8px rgba(13, 110, 253, 0.3);
}

#recordModal .btn-primary:hover {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

#recordModal .btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(13, 110, 253, 0.4);
}

#recordModal .btn-secondary {
    background-color: #6c757d;
    border: none;
    box-shadow: 0 3px 8px rgba(108, 117, 125, 0.3);
}

#recordModal .btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

/* 加载指示器样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(13, 110, 253, 0.2);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    position: absolute;
    margin-top: 60px;
    color: #0d6efd;
    font-weight: 500;
    font-size: 0.9rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 金额输入框特殊样式 */
.amount-input-group {
    position: relative;
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
}

.amount-input-group .form-control {
    width: 100%;
    padding-left: 25px;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: none;
    background-color: white;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.amount-input-group .currency-symbol {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: #495057;
    z-index: 5;
    pointer-events: none;
}

/* 内容描述文本框样式调整 */
#recordForm .form-row:last-child {
    align-items: flex-start;
}

#recordForm .form-row:last-child .form-label {
    padding-top: 8px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #recordModal .modal-dialog {
        max-width: 95%;
        margin: 1rem auto;
    }
    
    #recordModal .modal-body {
        padding: 15px;
    }
    
    .form-section {
        padding: 12px;
    }
    
    #recordForm .form-row {
        margin-bottom: 10px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    #recordForm .form-label {
        width: 100%;
        text-align: left;
        padding-right: 0;
        margin-bottom: 5px;
        font-size: 0.85rem;
    }
    
    #recordForm .form-control,
    #recordForm .form-select {
        width: 100%;
    }
    
    /* 确保移动端金额输入框样式一致 */
    #recordForm .amount-input-group {
        width: 100%;
        background: transparent;
        border: none;
        outline: none;
    }
    
    #recordForm .amount-input-group .form-control {
        width: 100%;
        padding-left: 25px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        background-color: white;
    }
    
    #recordForm .invalid-feedback {
        margin-left: 0;
    }
    
    #recordForm .form-row:last-child .form-label {
        padding-top: 0;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#recordModal .modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* 表单验证样式 */
#recordForm .form-control.is-invalid,
#recordForm .form-select.is-invalid {
    border-color: #dc3545;
    background-image: none;
}

#recordForm .form-control.is-invalid:focus,
#recordForm .form-select.is-invalid:focus {
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

#recordForm .invalid-feedback {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 4px;
    margin-left: 80px;
}

/* 下拉选择器样式增强 */
#recordForm .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230d6efd' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
}

/* 日期选择器样式增强 */
#recordForm input[type="date"] {
    position: relative;
}

#recordForm input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230d6efd' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
    cursor: pointer;
}

/* 加载中状态的选择器 */
#recordForm .form-select.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z'/%3E%3Cpath d='M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    animation: spin 1s linear infinite;
} 