/**
 * ANIEF Contatti - Frontend Material Design
 *
 * Design basato su Material Design Google
 * Colori: Primary #1565c0 (Blue), Background white/gray
 *
 * @file    frontend.css
 * @version 1.0.0
 * @author  Andrea Parenti
 * @link    https://www.drepar.com
 * @email   drepar68@gmail.com
 */

/* ==========================================================================
   SVG ICONS - Material Design
   ========================================================================== */

.anief-svg-icon {
    display: inline-block;
    vertical-align: middle;
    color: currentColor;
}

/* ==========================================================================
   CONTAINER PRINCIPALE
   ========================================================================== */

.anief-contatti-frontend {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #ffffff;
}

/* ==========================================================================
   TITOLI - Material Design
   ========================================================================== */

.anief-form-title {
    font-size: 28px;
    font-weight: 400;
    color: #1565c0;
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid #1565c0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   CONTAINER FORM
   ========================================================================== */

.anief-contact-form-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
}

/* ==========================================================================
   MATERIAL FORM
   ========================================================================== */

.anief-material-form .form-group {
    margin-bottom: 12px;
}

/* Form Row - per campi sulla stessa riga */
.anief-material-form .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.anief-material-form .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Responsive: mobile */
@media (max-width: 768px) {
    .anief-material-form .form-row {
        flex-direction: column;
        gap: 0;
    }

    .anief-material-form .form-row .form-group {
        margin-bottom: 12px;
    }
}

.anief-material-form label {
    display: block;
    margin-bottom: 8px;
    color: #1565c0;
    font-weight: 500;
    font-size: 14px;
}

.anief-material-form input[type="text"],
.anief-material-form input[type="email"],
.anief-material-form input[type="url"],
.anief-material-form input[type="tel"],
.anief-material-form select,
.anief-material-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.42);
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.anief-material-form input:focus,
.anief-material-form select:focus,
.anief-material-form textarea:focus {
    border-color: #1565c0;
    outline: none;
    box-shadow: 0 0 0 2px rgba(21,101,192,0.2);
}

.anief-material-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231565c0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.anief-material-form textarea {
    min-height: 120px;
    resize: vertical;
}

.anief-material-form small {
    display: block;
    margin-top: 4px;
    color: rgba(0,0,0,0.6);
    font-size: 12px;
}

/* Checkbox Privacy */
.anief-material-form .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.anief-material-form .checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 4px 0 0 0;
    cursor: pointer;
}

.anief-material-form .checkbox-label span {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.anief-material-form .checkbox-label a {
    color: #1565c0;
    text-decoration: none;
}

.anief-material-form .checkbox-label a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   PULSANTI ACTIONS - Material Design
   ========================================================================== */

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.anief-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    font-family: inherit;
}

.anief-btn-primary {
    background-color: #1565c0;
    color: white;
}

.anief-btn-primary:hover {
    background-color: #0d47a1;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

.anief-btn-primary:active {
    background-color: #002171;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    transform: translateY(0);
}

.anief-btn:disabled {
    background-color: #9e9e9e;
    color: #ffffff;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-loading,
.anief-btn.loading .btn-text {
    display: none;
}

.anief-btn.loading .btn-loading {
    display: inline;
}

/* ==========================================================================
   LOADING OVERLAY
   ========================================================================== */

.anief-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1565c0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */

.anief-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.anief-toast {
    background: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid #1565c0;
}

.anief-toast.success {
    border-left-color: #4caf50;
}

.anief-toast.error {
    border-left-color: #f44336;
}

.anief-toast.warning {
    border-left-color: #ff9800;
}

.anief-toast-content {
    flex: 1;
}

.anief-toast-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    font-size: 14px;
}

.anief-toast-message {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.anief-toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s;
}

.anief-toast-close:hover {
    color: #333;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ==========================================================================
   VALIDATION STATES
   ========================================================================== */

.anief-material-form input:invalid:not(:placeholder-shown),
.anief-material-form select:invalid:not(:placeholder-shown),
.anief-material-form textarea:invalid:not(:placeholder-shown) {
    border-color: #f44336;
}

.anief-material-form input:valid:not(:placeholder-shown),
.anief-material-form select:valid:not(:placeholder-shown),
.anief-material-form textarea:valid:not(:placeholder-shown) {
    border-color: #4caf50;
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.anief-material-form a:focus,
.anief-btn:focus,
.anief-material-form input:focus,
.anief-material-form select:focus,
.anief-material-form textarea:focus {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

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