/* 留言表单样式 */

.message-form-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.form-header {
    margin-bottom: 2rem;
    text-align: center;
}

.form-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-header p {
    color: #6c757d;
    font-size: 1rem;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group label .required {
    color: #dc3545;
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
    font-family: inherit;
}

.form-group.has-error .form-control {
    border-color: #dc3545;
}

.form-group.has-error .form-control:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.char-counter.text-warning {
    color: #ffc107;
}

.char-counter.text-danger {
    color: #dc3545;
    font-weight: 500;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.form-col {
    flex: 1 0 0%;
    padding: 0 0.75rem;
    min-width: 250px;
}

@media (max-width: 768px) {
    .form-col {
        flex: 0 0 100%;
        margin-bottom: 1rem;
    }
    
    .form-col:last-child {
        margin-bottom: 0;
    }
}

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.submit-btn:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.loading-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    display: none;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.form-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
}

.form-footer a {
    color: #007bff;
    text-decoration: none;
}

.form-footer a:hover {
    text-decoration: underline;
}

.privacy-note {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 4px 4px 0;
}

.privacy-note p {
    margin: 0;
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 响应式调整 */
@media (max-width: 576px) {
    .message-form-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
    
    .submit-btn {
        width: 100%;
    }
}

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

.message-form-container {
    animation: fadeIn 0.5s ease-out;
}

/* 表单字段焦点效果增强 */
.form-control:focus {
    background-color: #f8f9fa;
}

/* 可选字段样式 */
.optional-field {
    opacity: 0.9;
}

.optional-field label::after {
    content: "（可选）";
    color: #6c757d;
    font-size: 0.85em;
    margin-left: 0.25rem;
    font-weight: normal;
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 0.25rem;
    color: #6c757d;
    cursor: help;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    line-height: 1.4;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* 表单成功状态 */
.form-success {
    text-align: center;
    padding: 2rem;
}

.form-success-icon {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 1rem;
}

.form-success h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.form-success p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* 加载覆盖层 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
    display: none;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s linear infinite;
}