/**
 * Mariani CTA - Frontend Styles v3
 * Plugin per call-to-action con form appuntamenti e WhatsApp
 * Design minimalista in linea con massimilianomariani.it
 */

/* ==========================================
   CTA Container - Minimal Style
   ========================================== */
.mcta-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 25px 30px;
    margin: 30px 0;
    text-align: center;
}

.mcta-heading {
    font-size: 18px;
    font-weight: 400;
    color: #374151;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

/* ==========================================
   CTA Buttons - Minimal Outline Style
   ========================================== */
.mcta-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.mcta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border: 1.5px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: transparent;
}

.mcta-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.mcta-btn-appt {
    border-color: #2a9d8f;
    color: #2a9d8f;
}

.mcta-btn-appt:hover {
    background: #2a9d8f;
    color: #ffffff;
}

.mcta-btn-wa {
    border-color: #25d366;
    color: #25d366;
}

.mcta-btn-wa:hover {
    background: #25d366;
    color: #ffffff;
}

/* ==========================================
   Modal Overlay
   ========================================== */
.mcta-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 999999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.mcta-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   Modal Content
   ========================================== */
.mcta-popup {
    background: #ffffff;
    border-radius: 8px;
    padding: 28px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: mctaSlide 0.25s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.mcta-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mcta-close:hover {
    border-color: #2a9d8f;
    color: #2a9d8f;
}

.mcta-popup h2 {
    font-size: 20px;
    font-weight: 500;
    color: #2a9d8f;
    margin: 0 0 4px 0;
    padding-right: 40px;
}

.mcta-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 18px 0;
}

/* ==========================================
   Form Styles
   ========================================== */
.mcta-form {
    text-align: left;
}

.mcta-row {
    display: flex;
    gap: 12px;
    margin-bottom: 0;
}

.mcta-field {
    flex: 1;
    margin-bottom: 12px;
}

.mcta-field-full {
    width: 100%;
}

.mcta-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.mcta-field input[type="text"],
.mcta-field input[type="email"],
.mcta-field input[type="tel"],
.mcta-field input[type="date"],
.mcta-field select,
.mcta-field textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.mcta-field input:focus,
.mcta-field select:focus,
.mcta-field textarea:focus {
    outline: none;
    border-color: #2a9d8f;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.1);
}

.mcta-field input::placeholder,
.mcta-field textarea::placeholder {
    color: #94a3b8;
}

.mcta-field textarea {
    resize: vertical;
    min-height: 60px;
}

.mcta-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ==========================================
   Checkbox Privacy
   ========================================== */
.mcta-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.mcta-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: #2a9d8f;
    flex-shrink: 0;
}

.mcta-check a {
    color: #2a9d8f;
    text-decoration: underline;
}

.mcta-check a:hover {
    color: #257a6e;
}

/* ==========================================
   Submit Button
   ========================================== */
.mcta-submit {
    width: 100%;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    color: #2a9d8f;
    background: transparent;
    border: 1.5px solid #2a9d8f;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.mcta-submit:hover {
    background: #2a9d8f;
    color: #ffffff;
}

.mcta-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mcta-submit-wa {
    color: #25d366;
    border-color: #25d366;
}

.mcta-submit-wa:hover {
    background: #25d366;
    color: #ffffff;
}

/* ==========================================
   Form Messages
   ========================================== */
.mcta-msg {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
}

.mcta-msg.show {
    display: block;
}

.mcta-msg.ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.mcta-msg.err {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ==========================================
   Loading Spinner
   ========================================== */
.mcta-spin {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(42, 157, 143, 0.3);
    border-radius: 50%;
    border-top-color: #2a9d8f;
    animation: mctaSpin 0.8s ease-in-out infinite;
}

.mcta-submit:hover .mcta-spin {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
}

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

/* ==========================================
   Responsive Mobile
   ========================================== */
@media (max-width: 768px) {
    .mcta-box {
        padding: 18px 12px !important;
        margin: 20px 0 !important;
        border-radius: 10px !important;
    }
    
    .mcta-heading {
        font-size: 16px !important;
        margin-bottom: 15px !important;
    }
    
    .mcta-btns {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .mcta-btn {
        width: 100% !important;
        min-width: auto !important;
        padding: 12px 20px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
    }
    
    .mcta-overlay {
        padding: 5px !important;
        align-items: flex-start !important;
        padding-top: 5px !important;
    }
    
    .mcta-popup {
        padding: 12px !important;
        border-radius: 10px !important;
        max-height: calc(100vh - 10px) !important;
    }
    
    .mcta-popup h2 {
        font-size: 16px !important;
        margin-bottom: 2px !important;
        padding-right: 30px !important;
    }
    
    .mcta-subtitle {
        font-size: 10px !important;
        margin-bottom: 8px !important;
    }
    
    .mcta-row {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .mcta-field {
        margin-bottom: 6px !important;
    }
    
    .mcta-field label {
        font-size: 10px !important;
        margin-bottom: 1px !important;
    }
    
    .mcta-field input[type="text"],
    .mcta-field input[type="email"],
    .mcta-field input[type="tel"],
    .mcta-field input[type="date"],
    .mcta-field select,
    .mcta-field textarea {
        padding: 7px 8px !important;
        font-size: 16px !important;
        border-radius: 5px !important;
        border-width: 1px !important;
    }
    
    .mcta-field textarea {
        min-height: 35px !important;
    }
    
    .mcta-check {
        font-size: 9px !important;
        gap: 5px !important;
    }
    
    .mcta-check input[type="checkbox"] {
        width: 12px !important;
        height: 12px !important;
    }
    
    .mcta-submit {
        padding: 9px 12px !important;
        font-size: 13px !important;
        margin-top: 8px !important;
        border-radius: 5px !important;
    }
    
    .mcta-msg {
        margin-top: 6px !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    
    .mcta-close {
        width: 24px !important;
        height: 24px !important;
        font-size: 16px !important;
        top: 5px !important;
        right: 5px !important;
    }
}

/* ==========================================
   Standalone Form Styles
   ========================================== */
.mcta-form-standalone {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.mcta-form-title {
    font-size: 24px;
    font-weight: 500;
    color: #2a9d8f;
    margin: 0 0 8px 0;
    text-align: center;
}

.mcta-form-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 25px 0;
    text-align: center;
}

@media (max-width: 768px) {
    .mcta-form-standalone {
        padding: 20px;
        margin: 0 10px;
    }
    
    .mcta-form-standalone .mcta-row {
        flex-direction: column;
    }
    
    .mcta-form-standalone .mcta-row:nth-child(3) {
        flex-direction: row;
        gap: 10px;
    }
    
    .mcta-form-title {
        font-size: 20px;
    }
    
    .mcta-form-subtitle {
        font-size: 13px;
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .mcta-box,
    .mcta-overlay {
        display: none !important;
    }
}

/* ==========================================
   Contact Form Styles
   ========================================== */
.mcta-contact-form {
    max-width: 650px;
}

.mcta-contact-fields {
    margin-top: 15px;
}

.mcta-contact-message {
    margin-top: 5px;
}

.mcta-msg-required {
    color: #ef4444;
    font-weight: 600;
}

.mcta-contact-hint {
    display: none;
}

.mcta-hint-content {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 13px;
    color: #166534;
    margin: 10px 0 15px 0;
    line-height: 1.5;
}

.mcta-submit-contact {
    color: #2563eb;
    border-color: #2563eb;
}

.mcta-submit-contact:hover {
    background: #2563eb;
    color: #ffffff;
}

.mcta-submit-contact svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Request type selector highlight */
#contact-request-type {
    font-size: 15px;
    padding: 12px 40px 12px 15px;
    border-width: 2px;
}

#contact-request-type:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Error state */
.mcta-field input.error,
.mcta-field select.error,
.mcta-field textarea.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.mcta-field input.error:focus,
.mcta-field select.error:focus,
.mcta-field textarea.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

/* Animation for fields appearing */
.mcta-contact-fields,
.mcta-contact-message,
.mcta-contact-hint {
    transition: all 0.3s ease;
}

/* Mobile responsive for contact form */
@media (max-width: 768px) {
    .mcta-contact-form {
        padding: 15px !important;
    }
    
    #contact-request-type {
        font-size: 16px !important;
        padding: 10px 35px 10px 12px !important;
    }
    
    .mcta-hint-content {
        font-size: 12px !important;
        padding: 10px 12px !important;
    }
    
    .mcta-submit-contact {
        font-size: 14px !important;
    }
}
