/**
 * Form Messages & Validation Styles für Villa Zina
 * Responsive, Accessible und Modern
 */

/* ==========================================================================
   Form Message Base Styles
   ========================================================================== */

.form-message {
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 8px;
    border: 1px solid;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.5;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.form-message::before {
    content: '';
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Success Messages */
.message-success {
    background: linear-gradient(135deg, #d4edda 0%, #c8e6c9 100%);
    color: #1b5e20;
    border-color: #4caf50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.message-success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%234caf50' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

/* Error Messages */
.message-error {
    background: linear-gradient(135deg, #f8d7da 0%, #ffcdd2 100%);
    color: #c62828;
    border-color: #f44336;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.15);
}

.message-error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23f44336' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
}

/* Warning Messages */
.message-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe0b2 100%);
    color: #e65100;
    border-color: #ff9800;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.15);
}

.message-warning::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23ff9800' viewBox='0 0 24 24'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E");
}

/* Info Messages */
.message-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #b3e5fc 100%);
    color: #01579b;
    border-color: #03a9f4;
    box-shadow: 0 2px 8px rgba(3, 169, 244, 0.15);
}

.message-info::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2303a9f4' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Field Validation Styles
   ========================================================================== */

.field-error {
    color: #c62828;
    font-size: 14px;
    font-weight: 500;
    margin: 8px 0 0 0;
    padding: 6px 12px;
    background: rgba(244, 67, 54, 0.05);
    border-left: 3px solid #f44336;
    border-radius: 0 4px 4px 0;
    display: block;
    animation: slideDown 0.3s ease-out;
}

.field-success {
    color: #1b5e20;
    font-size: 14px;
    font-weight: 500;
    margin: 8px 0 0 0;
    padding: 6px 12px;
    background: rgba(76, 175, 80, 0.05);
    border-left: 3px solid #4caf50;
    border-radius: 0 4px 4px 0;
    display: block;
    animation: slideDown 0.3s ease-out;
}

/* Form Field States */
.error, .invalid {
    border-color: #f44336 !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1) !important;
    background: rgba(244, 67, 54, 0.02);
}

.valid {
    border-color: #4caf50 !important;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1) !important;
    background: rgba(76, 175, 80, 0.02);
}

.warning {
    border-color: #ff9800 !important;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1) !important;
    background: rgba(255, 152, 0, 0.02);
}

/* Focus States mit besserer Accessibility */
input:focus.error,
textarea:focus.error,
select:focus.error {
    outline: 2px solid #f44336;
    outline-offset: 2px;
}

input:focus.valid,
textarea:focus.valid,
select:focus.valid {
    outline: 2px solid #4caf50;
    outline-offset: 2px;
}

/* ==========================================================================
   Form Submission States
   ========================================================================== */

.submitting {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.submitting::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #c4a484;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
}

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

/* ==========================================================================
   Enhanced Interactive Features
   ========================================================================== */

/* Hover Effects */
.form-message {
    cursor: default;
}

.form-message:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Close Button für Messages */
.form-message-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 4px;
    line-height: 1;
}

.form-message-close:hover {
    opacity: 1;
}

.message-success .form-message-close {
    color: #1b5e20;
}

.message-error .form-message-close {
    color: #c62828;
}

.message-warning .form-message-close {
    color: #e65100;
}

.message-info .form-message-close {
    color: #01579b;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .form-message {
        padding: 12px 16px;
        margin: 16px 0;
        font-size: 14px;
        flex-direction: column;
        gap: 8px;
    }
    
    .form-message::before {
        width: 18px;
        height: 18px;
        margin-top: 0;
        align-self: flex-start;
    }
    
    .field-error,
    .field-success {
        font-size: 13px;
        padding: 5px 10px;
        margin: 6px 0 0 0;
    }
    
    .form-message-close {
        top: 6px;
        right: 8px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .form-message {
        padding: 10px 12px;
        margin: 12px 0;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .form-message::before {
        width: 16px;
        height: 16px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .form-message {
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .message-success {
        background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
        color: #c8e6c9;
        border-color: #4caf50;
    }
    
    .message-error {
        background: linear-gradient(135deg, #c62828 0%, #d32f2f 100%);
        color: #ffcdd2;
        border-color: #f44336;
    }
    
    .message-warning {
        background: linear-gradient(135deg, #e65100 0%, #f57c00 100%);
        color: #ffe0b2;
        border-color: #ff9800;
    }
    
    .message-info {
        background: linear-gradient(135deg, #01579b 0%, #0277bd 100%);
        color: #b3e5fc;
        border-color: #03a9f4;
    }
    
    .field-error {
        background: rgba(244, 67, 54, 0.15);
        color: #ffcdd2;
    }
    
    .field-success {
        background: rgba(76, 175, 80, 0.15);
        color: #c8e6c9;
    }
}

/* ==========================================================================
   High Contrast Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .form-message {
        border-width: 2px;
        font-weight: 600;
    }
    
    .form-message::before {
        filter: contrast(2);
    }
    
    .message-success {
        background: #ffffff;
        color: #000000;
        border-color: #000000;
    }
    
    .message-error {
        background: #ffffff;
        color: #000000;
        border-color: #000000;
    }
    
    .message-warning {
        background: #ffffff;
        color: #000000;
        border-color: #000000;
    }
    
    .message-info {
        background: #ffffff;
        color: #000000;
        border-color: #000000;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .form-message {
        background: white !important;
        color: black !important;
        border: 2px solid black !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    
    .form-message::before {
        display: none;
    }
    
    .form-message-close {
        display: none;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Screen Reader Support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Management */
.form-message:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .form-message,
    .field-error,
    .field-success {
        animation: none;
        transition: none;
    }
    
    .form-message:hover {
        transform: none;
    }
    
    .submitting::after {
        animation: none;
    }
}
