/* Dynamic Contact Form Styles */
.contact-form {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

/* Form Messages */
.form-messages {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    text-align: center;
}

.form-messages.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-messages.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.form-messages.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

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

.form-group label::after {
    content: "";
    color: #e74c3c;
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-control::placeholder {
    color: #8e9aaf;
    font-weight: 400;
}

/* Textarea Specific */
textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Validation States */
.form-control.valid {
    border-color: #28a745;
    background-color: #f8fff9;
}

.form-control.invalid,
.form-control.error {
    border-color: #e74c3c;
    background-color: #fff8f8;
}

.form-control.valid,
.form-control.success {
    border-color: #28a745;
    background-color: #f8fff8;
}

/* Error Messages */
.error-message {
    display: none;
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
    padding-left: 0.5rem;
}

.error-message.show {
    display: block;
}

/* Character Counter */
.char-counter {
    font-size: 0.8rem;
    color: #8e9aaf;
    margin-top: 0.25rem;
    text-align: right;
}

.char-counter.valid {
    color: #28a745;
}

.char-counter.invalid,
.char-counter.text-danger {
    color: #e74c3c;
}

.char-counter.text-success {
    color: #28a745;
}

/* Dynamic Field Sets */
#dynamic-fields-container {
    position: relative;
}

.field-set {
    border: 2px dashed #e1e8ed;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    background-color: #fafbfc;
    transition: all 0.3s ease;
}

.field-set:first-child {
    border: none;
    background-color: transparent;
    padding: 0;
}

.field-set.removing {
    opacity: 0.5;
    transform: translateX(-10px);
}

.field-set-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e1e8ed;
}

.field-set-title {
    font-weight: 600;
    color: #495057;
    margin: 0;
    font-size: 1rem;
}

.remove-field-set {
    background: #e74c3c;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.remove-field-set:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Form Controls Section */
.form-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.form-controls .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline-secondary {
    color: #6c757d;
    border: 2px solid #6c757d;
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
}

.btn-outline-danger {
    color: #e74c3c;
    border: 2px solid #e74c3c;
    background: transparent;
}

.btn-outline-danger:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-2px);
}

/* Submit Section */
.form-submit {
    text-align: center;
    margin-top: 2rem;
}

.submitBtn {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
    color: white;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submitBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

.submitBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-loader {
    display: none;
}

.submitBtn.loading .submit-text {
    display: none;
}

.submitBtn.loading .submit-loader {
    display: inline-block;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.field-set.new {
    animation: slideIn 0.5s ease;
}

.field-set.removing {
    animation: slideOut 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .contact-form {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .form-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .form-controls .btn {
        width: 100%;
        max-width: 250px;
    }
    
    .submitBtn {
        width: 100%;
        max-width: 250px;
        padding: 1rem 2rem;
    }
}

@media (max-width: 480px) {
    .contact-form {
        padding: 1rem;
    }
    
    .field-set {
        padding: 1rem;
    }
    
    .form-control {
        padding: 0.75rem;
    }
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Success Animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-checkmark {
    animation: checkmark 0.6s ease;
}

/* Focus Trap for Accessibility */
.form-control:focus-visible {
    outline: 3px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }
    
    .form-control:focus {
        border-width: 4px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}