/**
 * Modern Form Styles for AI Business Pro
 * File: frontend/css/modern-form-styles.css
 * 
 * Stili dedicati al nuovo form moderno [aibp_modern_form]
 * Non interferisce con gli stili esistenti di frontend-styles.css
 */

/* ===== RESET E BASE ===== */
.aibp-modern-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #1F2937;
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.aibp-modern-form *,
.aibp-modern-form *::before,
.aibp-modern-form *::after {
    box-sizing: border-box;
}

/* ===== CONTAINER PRINCIPALE ===== */
.aibp-modern-form-container {
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

/* ===== HEADER DEL FORM ===== */
.aibp-modern-form-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #F1F5F9;
}

.aibp-modern-form-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.aibp-modern-form-subtitle {
    font-size: 1rem;
    color: #64748B;
    margin: 0;
    font-weight: 400;
}

/* ===== PROGRESS BAR ===== */
.aibp-modern-progress-container {
    margin: 1.5rem 0 2rem 0;
    text-align: center;
}

.aibp-modern-progress-text {
    font-size: 0.875rem;
    color: #64748B;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.aibp-modern-progress-text .current-step {
    color: #2563EB;
    font-weight: 700;
}

.aibp-modern-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.aibp-modern-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563EB 0%, #3B82F6 50%, #1E40AF 100%);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.aibp-modern-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: aibp-progress-shine 2s infinite;
}

@keyframes aibp-progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== STEP CONTAINER ===== */
.aibp-modern-form-step {
    background: #FAFBFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.aibp-modern-form-step.active {
    border-color: #2563EB;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.aibp-modern-form-step.completed {
    border-color: #059669;
    background: #F0FDF4;
}

.aibp-modern-form-step.completed::before {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #059669;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* ===== CAMPI FORM ===== */
.aibp-modern-form-field {
    margin-bottom: 1.5rem;
    position: relative;
}

.aibp-modern-form-field.half-width {
    width: calc(50% - 0.5rem);
    display: inline-block;
    vertical-align: top;
}

.aibp-modern-form-field.half-width:nth-child(even) {
    margin-left: 1rem;
}

.aibp-modern-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
}

.aibp-modern-form-label.required::after {
    content: ' *';
    color: #DC2626;
    font-weight: 700;
}

.aibp-modern-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    background: #FFFFFF;
    transition: all 0.2s ease;
    appearance: none;
    outline: none;
}

.aibp-modern-form-input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.aibp-modern-form-input:valid {
    border-color: #059669;
}

.aibp-modern-form-input.error {
    border-color: #DC2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.aibp-modern-form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.aibp-modern-form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ===== HELP TEXT E VALIDAZIONE ===== */
.aibp-modern-form-help {
    font-size: 0.75rem;
    color: #6B7280;
    margin-top: 0.25rem;
    display: block;
    line-height: 1.4;
}

.aibp-modern-form-error {
    font-size: 0.75rem;
    color: #DC2626;
    margin-top: 0.25rem;
    display: block;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.aibp-modern-form-error.show {
    opacity: 1;
    transform: translateY(0);
}

.aibp-modern-form-success {
    font-size: 0.75rem;
    color: #059669;
    margin-top: 0.25rem;
    display: block;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.aibp-modern-form-success.show {
    opacity: 1;
    transform: translateY(0);
}

/* ===== NAVIGAZIONE ===== */
.aibp-modern-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E5E7EB;
}

.aibp-modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.aibp-modern-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.aibp-modern-btn-primary {
    background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.aibp-modern-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -1px rgba(37, 99, 235, 0.3);
}

.aibp-modern-btn-primary:active {
    transform: translateY(0);
}

.aibp-modern-btn-secondary {
    background: #F8FAFC;
    color: #64748B;
    border: 1px solid #E2E8F0;
}

.aibp-modern-btn-secondary:hover {
    background: #F1F5F9;
    color: #475569;
}

.aibp-modern-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== LOADING STATES ===== */
.aibp-modern-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    border-top-color: #2563EB;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .aibp-modern-form-container {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 12px;
    }
    
    .aibp-modern-form-title {
        font-size: 1.5rem;
    }
    
    .aibp-modern-form-field.half-width {
        width: 100%;
        display: block;
    }
    
    .aibp-modern-form-field.half-width:nth-child(even) {
        margin-left: 0;
    }
    
    .aibp-modern-form-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .aibp-modern-btn {
        width: 100%;
    }
}

/* ===== STATO DI SUCCESSO POST-SUBMIT ===== */
.aibp-modern-success-state {
    text-align: center;
    padding: 2rem;
    background: #F0FDF4;
    border: 2px solid #BBF7D0;
    border-radius: 16px;
    margin: 2rem 0;
}

.aibp-modern-success-icon {
    margin: 0 auto 1.5rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.aibp-modern-success-icon svg {
    drop-shadow: 0 4px 6px rgba(5, 150, 105, 0.2);
}

.aibp-modern-success-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #065F46;
    margin: 0 0 1rem 0;
}

.aibp-modern-success-description {
    font-size: 1rem;
    color: #047857;
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

.aibp-modern-reference-box {
    background: #FFFFFF;
    border: 1px solid #D1FAE5;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: left;
}

.aibp-modern-reference-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #065F46;
    margin-bottom: 0.5rem;
}

.aibp-modern-reference-id {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.aibp-modern-reference-id code {
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #1F2937;
    flex: 1;
    word-break: break-all;
}

.aibp-modern-copy-btn {
    background: #10B981;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.aibp-modern-copy-btn:hover {
    background: #059669;
}

.aibp-modern-reference-help {
    font-size: 0.75rem;
    color: #6B7280;
    font-style: italic;
}

.aibp-modern-success-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.aibp-modern-success-actions .aibp-modern-btn {
    min-width: 160px;
}

/* ===== ANIMAZIONI ===== */
.aibp-fade-in {
    animation: aibp-fadeIn 0.5s ease-out;
}

@keyframes aibp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aibp-slide-left {
    animation: aibp-slideLeft 0.3s ease-out;
}

@keyframes aibp-slideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.aibp-slide-right {
    animation: aibp-slideRight 0.3s ease-out;
}

@keyframes aibp-slideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== RESPONSIVE PER STATO SUCCESSO ===== */
@media (max-width: 768px) {
    .aibp-modern-success-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .aibp-modern-reference-id {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .aibp-modern-copy-btn {
        align-self: center;
        min-width: 120px;
    }
}