/* SyncForm Bootstrap 5 Styles */
.syncform-container {
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
}

.syncform-form {
    width: 100%;
}

/* Bootstrap form-floating 增强 */
.syncform-form .form-floating > label {
    color: #6c757d;
    font-weight: 500;
}

.syncform-form .form-control {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    color: #6c757d;
    height: calc(3.5rem + 2px);
    padding: 1rem 0.75rem 0.25rem;
}

/* 调整floating label的位置 */
.syncform-form .form-floating > label {
    padding: 1rem 0.75rem;
}

/* textarea特殊处理 */
.syncform-form textarea.form-control {
    height: auto;
    min-height: calc(3.5rem + 2px);
}

.syncform-form .form-control:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
    background-color: #fff;
}

/* 移除Bootstrap默认的valid/invalid样式，保持统一灰色 */
.syncform-form .form-control:valid {
    border-color: #dee2e6;
    background-image: none;
}

.syncform-form .form-control:invalid {
    border-color: #dee2e6;
    background-image: none;
}

/* 验证码区域样式 */
.syncform-captcha-wrapper {
    position: relative;
    display: inline-block;
}

.syncform-captcha-canvas {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.syncform-captcha-canvas:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #ffc107;
}

.syncform-captcha-tip {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: #495057;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.syncform-captcha-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #495057;
}

.syncform-captcha-wrapper:hover .syncform-captcha-tip {
    opacity: 1;
}

.syncform-form #syncform-captcha {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    height: 40px;
    padding: 0.375rem 0.75rem;
}

.syncform-form #syncform-captcha:focus {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
    background-color: #fff;
}

/* 提交按钮样式 */
.syncform-form .btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.syncform-form .btn-warning:hover {
    background: linear-gradient(135deg, #ffb300 0%, #ff8f00 100%);
    transform: translateY(-2px);
}

.syncform-form .btn-warning:active {
    transform: translateY(0);
}

.syncform-form .btn-warning:disabled {
    background: #6c757d;
    transform: none;
    cursor: not-allowed;
}

/* 消息提示样式 */
.syncform-form .alert,
.syncform-form .syncform-message {
    border-radius: 8px;
    border: none;
    font-weight: 500;
    box-shadow: none;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    display: block !important;
    opacity: 1 !important;
}

.syncform-form .alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.syncform-form .alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* 兼容旧的class名 */
.syncform-form .alert.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid #28a745;
}

.syncform-form .alert.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* 加载动画 */
.syncform-loading {
    position: relative;
    pointer-events: none;
}

.syncform-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 193, 7, 0.3);
    border-top: 3px solid #ffc107;
    border-radius: 50%;
    animation: syncform-spin 1s linear infinite;
}

#syncform-form button {color: #fff;}

@keyframes syncform-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .syncform-container {
        margin: 1rem;
        padding: 1.5rem;
        border-radius: 10px;
    }
    
    .syncform-form .form-control {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

@media (max-width: 576px) {
    .syncform-container {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .syncform-captcha-wrapper {
        margin-bottom: 1rem;
    }
    
    .syncform-form .row.g-3 {
        --bs-gutter-x: 1rem;
    }
}

/* 字段验证状态 - 保持灰色不变 */
.syncform-form .form-control.is-valid {
    border-color: #dee2e6;
    background-image: none;
}

.syncform-form .form-control.is-invalid {
    border-color: #dee2e6;
    background-image: none;
}

/* 自定义滚动条 */
.syncform-form textarea::-webkit-scrollbar {
    width: 8px;
}

.syncform-form textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.syncform-form textarea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.syncform-form textarea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}