/* Conversion Analyzer - Main Styles */
/* Framework delle 9 Domande */

:root {
    --ca-green: #22c55e;
    --ca-yellow: #eab308;
    --ca-red: #ef4444;
    --ca-dark: #1e293b;
    --ca-light: #f8fafc;
    --ca-gray: #64748b;
    --ca-blue: #3b82f6;
}

.ca-wrapper {
    background: #fff;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.08);
    margin: 30px 0;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ca-wrapper:hover {
    box-shadow: 0 8px 40px rgba(30, 41, 59, 0.12);
}

/* Header con griglia 9 numeri */
.ca-header {
    background: linear-gradient(135deg, var(--ca-dark) 0%, #334155 100%);
    padding: 30px;
    text-align: center;
    position: relative;
}

.ca-icon-grid {
    display: inline-grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    margin-bottom: 20px;
}

.ca-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    transition: all 0.3s ease;
}

.ca-icon-highlight {
    background: var(--ca-green);
    color: white;
    transform: scale(1.1);
}

.ca-wrapper:hover .ca-icon:nth-child(1) { background: var(--ca-green); color: white; }
.ca-wrapper:hover .ca-icon:nth-child(2) { background: var(--ca-green); color: white; transition-delay: 0.05s; }
.ca-wrapper:hover .ca-icon:nth-child(3) { background: var(--ca-yellow); color: white; transition-delay: 0.1s; }
.ca-wrapper:hover .ca-icon:nth-child(4) { background: var(--ca-green); color: white; transition-delay: 0.15s; }
.ca-wrapper:hover .ca-icon:nth-child(5) { background: var(--ca-red); color: white; transition-delay: 0.2s; }
.ca-wrapper:hover .ca-icon:nth-child(6) { background: var(--ca-green); color: white; transition-delay: 0.25s; }
.ca-wrapper:hover .ca-icon:nth-child(7) { background: var(--ca-yellow); color: white; transition-delay: 0.3s; }
.ca-wrapper:hover .ca-icon:nth-child(8) { background: var(--ca-green); color: white; transition-delay: 0.35s; }
.ca-wrapper:hover .ca-icon:nth-child(9) { background: var(--ca-green); color: white; transition-delay: 0.4s; }

.ca-title {
    margin: 0;
    font-size: 26px;
    color: white;
    font-weight: 700;
}

.ca-subtitle {
    margin: 8px 0 0 0;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

/* Claim Section */
.ca-claim {
    padding: 25px 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-bottom: 1px solid #e2e8f0;
}

.ca-claim-main {
    margin-bottom: 20px;
}

.ca-claim-main p {
    margin: 0 0 12px 0;
    color: var(--ca-dark);
    font-size: 15px;
    line-height: 1.6;
}

.ca-claim-main p:last-child {
    margin-bottom: 0;
}

.ca-claim-main strong {
    color: var(--ca-dark);
}

.ca-stats-preview {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.ca-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ca-stat-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.ca-stat-green {
    background: #dcfce7;
    color: var(--ca-green);
}

.ca-stat-yellow {
    background: #fef9c3;
    color: #a16207;
}

.ca-stat-red {
    background: #fee2e2;
    color: var(--ca-red);
}

.ca-stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ca-gray);
}

/* Form Styles */
.ca-form {
    padding: 30px;
}

.ca-form-section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e2e8f0;
}

.ca-form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
    padding-bottom: 0;
}

.ca-form-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ca-dark);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ca-form-section-optional {
    background: #fafafa;
    margin-left: -30px;
    margin-right: -30px;
    padding: 25px 30px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.ca-optional-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--ca-gray);
    background: #e2e8f0;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-group-half {
    flex: 1;
}

.ca-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--ca-dark);
    font-size: 14px;
}

.ca-form input[type="email"],
.ca-form input[type="url"],
.ca-form input[type="text"],
.ca-form select,
.ca-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
    background: white;
}

.ca-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='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.ca-form textarea {
    resize: vertical;
    min-height: 80px;
}

.ca-form input:focus,
.ca-form select:focus,
.ca-form textarea:focus {
    outline: none;
    border-color: var(--ca-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.ca-form input::placeholder,
.ca-form textarea::placeholder {
    color: #94a3b8;
}

.ca-field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--ca-gray);
}

/* Checkbox */
.ca-checkbox {
    display: flex !important;
    align-items: flex-start;
    font-weight: normal !important;
    cursor: pointer;
    gap: 10px;
}

.ca-checkbox input[type="checkbox"] {
    margin: 3px 0 0 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--ca-green);
}

.ca-checkbox span {
    font-size: 14px;
    color: var(--ca-gray);
}

.ca-checkbox a {
    color: var(--ca-blue);
    text-decoration: none;
    font-weight: 500;
}

.ca-checkbox a:hover {
    text-decoration: underline;
}

/* Submit Button */
.ca-submit {
    background: linear-gradient(135deg, var(--ca-green) 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
    font-family: inherit;
    margin-top: 20px;
}

.ca-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4);
}

.ca-submit:active {
    transform: translateY(0);
}

.ca-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.ca-submit-icon {
    font-size: 20px;
}

/* Message */
.ca-message {
    margin-top: 20px;
    padding: 15px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    animation: caSlideDown 0.3s ease;
}

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

.ca-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.ca-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Footer Note */
.ca-footer-note {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.ca-footer-note p {
    margin: 0;
    font-size: 12px;
    color: var(--ca-gray);
}

/* Loading State */
.ca-form.loading .ca-submit {
    position: relative;
    color: transparent;
}

.ca-form.loading .ca-submit::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    top: 50%;
    left: 50%;
    margin-left: -11px;
    margin-top: -11px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: caSpinner 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .ca-wrapper {
        margin: 20px 0;
    }
    
    .ca-header {
        padding: 25px 20px;
    }
    
    .ca-icon-grid {
        gap: 4px;
    }
    
    .ca-icon {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .ca-title {
        font-size: 22px;
    }
    
    .ca-claim {
        padding: 20px;
    }
    
    .ca-stats-preview {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .ca-form {
        padding: 20px;
    }
    
    .ca-form-section-optional {
        margin-left: -20px;
        margin-right: -20px;
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group-half {
        margin-bottom: 18px;
    }
    
    .ca-submit {
        padding: 14px 28px;
        font-size: 15px;
    }
}

/* Compact Mode (Widget) */
.ca-wrapper.ca-compact {
    margin: 0;
    border-radius: 12px;
}

.ca-compact .ca-header {
    padding: 20px;
}

.ca-compact .ca-icon-grid {
    gap: 3px;
    margin-bottom: 15px;
}

.ca-compact .ca-icon {
    width: 20px;
    height: 20px;
    font-size: 10px;
    border-radius: 4px;
}

.ca-compact .ca-title {
    font-size: 18px;
}

.ca-compact .ca-subtitle {
    font-size: 12px;
}

.ca-compact .ca-claim {
    padding: 15px;
}

.ca-compact .ca-claim-main p {
    font-size: 13px;
}

.ca-compact .ca-stats-preview {
    padding: 10px;
    gap: 15px;
}

.ca-compact .ca-stat-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
}

.ca-compact .ca-stat-label {
    font-size: 11px;
}

.ca-compact .ca-form {
    padding: 20px;
}

.ca-compact .ca-form-section {
    margin-bottom: 18px;
    padding-bottom: 18px;
}

.ca-compact .ca-form-section-title {
    font-size: 13px;
    margin-bottom: 12px;
}

.ca-compact .ca-form label {
    font-size: 13px;
    margin-bottom: 6px;
}

.ca-compact .ca-form input,
.ca-compact .ca-form select,
.ca-compact .ca-form textarea {
    padding: 10px 12px;
    font-size: 13px;
}

.ca-compact .ca-submit {
    padding: 12px 20px;
    font-size: 14px;
}

.ca-compact .ca-footer-note p {
    font-size: 11px;
}

/* Widget Sidebar specific */
.widget .ca-wrapper {
    box-shadow: none;
    border: 1px solid #e2e8f0;
}

/* Accessibility */
.ca-form input:focus-visible,
.ca-form select:focus-visible,
.ca-form textarea:focus-visible,
.ca-form button:focus-visible {
    outline: 3px solid var(--ca-blue);
    outline-offset: 2px;
}

.ca-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--ca-blue);
    outline-offset: 2px;
}

/* Validation States */
.ca-form input.error,
.ca-form select.error,
.ca-form textarea.error {
    border-color: var(--ca-red);
}

.ca-form input.valid,
.ca-form select.valid {
    border-color: var(--ca-green);
}
