/**
 * ATS Iscrizione Ordinari - Stylesheet
 * Versione: 1.0.0
 */

/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* Container principale */
.ats-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Header */
.ats-form-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    border-radius: 15px;
}

.ats-form-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
}

.ats-form-header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Indicatori step */
.ats-step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.ats-step {
    display: flex;
    align-items: center;
    margin: 0 15px 10px 15px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.ats-step.active {
    opacity: 1;
}

.ats-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.ats-step.active .ats-step-number {
    background: #3498db;
    color: white;
    transform: scale(1.1);
}

.ats-step-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Sezioni form */
.ats-form-section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.ats-form-section.active {
    display: block;
}

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

/* Titoli sezioni */
.ats-section-title {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #3498db;
    position: relative;
}

.ats-section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: #e74c3c;
    border-radius: 2px;
}

/* Grid layout form */
.ats-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.ats-form-grid.two-columns {
    grid-template-columns: repeat(2, 1fr);
}

.ats-form-grid.three-columns {
    grid-template-columns: repeat(3, 1fr);
}

/* Gruppi form */
.ats-form-group {
    position: relative;
    margin-bottom: 20px;
}

.ats-form-group.full-width {
    grid-column: 1 / -1;
}

.ats-form-group.half-width {
    grid-column: span 1;
}

/* Input fields */
.ats-form-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-family: inherit;
}

.ats-form-input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.ats-form-input:valid {
    border-color: #27ae60;
}

.ats-form-input.error {
    border-color: #e74c3c;
    background: #fdf2f2;
}

/* Labels flottanti */
.ats-form-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 16px;
    pointer-events: none;
    transition: all 0.3s ease;
    background: white;
    padding: 0 5px;
    z-index: 2;
}

.ats-form-input:focus + .ats-form-label,
.ats-form-input:valid + .ats-form-label,
.ats-form-input:not(:placeholder-shown) + .ats-form-label {
    top: 0;
    font-size: 12px;
    color: #3498db;
    font-weight: 600;
}

/* Select fields */
.ats-form-select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.ats-form-select:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.ats-form-select:valid {
    border-color: #27ae60;
}

/* Textarea */
.ats-form-textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    background: #f8f9fa;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.ats-form-textarea:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Checkbox groups */
.ats-checkbox-group {
    display: flex;
    align-items: flex-start;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.ats-checkbox-group:hover {
    background: #e3f2fd;
    border-color: #3498db;
}

.ats-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.ats-checkbox-group label {
    cursor: pointer;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    flex: 1;
}

.ats-checkbox-group.required {
    border-color: #e74c3c;
}

.ats-checkbox-group.required label {
    color: #c0392b;
}

/* Elementi required */
.ats-required {
    color: #e74c3c;
    font-weight: bold;
    margin-left: 2px;
}

/* Messaggi di errore */
.ats-error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    padding: 10px;
    background: #fadbd8;
    border-radius: 5px;
    border: 1px solid #f1c0c0;
    display: none;
    animation: slideDown 0.3s ease;
}

.ats-error-message.show {
    display: block;
}

/* Messaggi di successo */
.ats-success-message {
    color: #27ae60;
    font-size: 16px;
    padding: 20px;
    background: #d5f4e6;
    border-radius: 10px;
    border: 1px solid #a9dfbf;
    margin-bottom: 20px;
    display: none;
    animation: slideDown 0.3s ease;
}

.ats-success-message.show {
    display: block;
}

/* Loading indicator */
.ats-loading {
    display: none;
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 20px 0;
}

.ats-loading.show {
    display: block;
}

.ats-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

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

/* Sezioni collassabili */
.ats-collapsible-section {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    animation: slideDown 0.3s ease;
}

.ats-collapsible-section.show {
    display: block;
}

/* Buttons */
.ats-button-group {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    gap: 20px;
    flex-wrap: wrap;
}

.ats-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 150px;
    font-family: inherit;
}

.ats-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.ats-btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.ats-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.ats-btn-secondary {
    background: #95a5a6;
    color: white;
}

.ats-btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.ats-btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #16a085 100%);
    color: white;
}

.ats-btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3);
}

.ats-btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.ats-btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}

/* Riepilogo importi */
.ats-summary-box {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid #e0e0e0;
}

.ats-summary-title {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
    text-align: center;
}

.ats-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ats-summary-item {
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    text-align: center;
    transition: all 0.3s ease;
}

.ats-summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.ats-summary-total {
    padding: 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

/* Link personalizzati */
.ats-link {
    color: #3498db;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.ats-link:hover {
    color: #2980b9;
}

/* Info box */
.ats-info-box {
    background: #e8f5e8;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid #27ae60;
}

.ats-info-box h4 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.ats-info-box p {
    margin: 0;
    color: #2d5a2d;
    line-height: 1.6;
}

.ats-warning-box {
    background: #fff3cd;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid #ffc107;
}

.ats-warning-box h4 {
    color: #856404;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.ats-warning-box p {
    margin: 0;
    color: #856404;
    line-height: 1.6;
}

/* Responsive design */
@media (max-width: 768px) {
    .ats-form-container {
        margin: 10px;
        padding: 15px;
        border-radius: 10px;
    }
    
    .ats-form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ats-form-grid.two-columns,
    .ats-form-grid.three-columns {
        grid-template-columns: 1fr;
    }
    
    .ats-step-indicator {
        flex-direction: column;
        gap: 10px;
    }
    
    .ats-step {
        margin: 5px 0;
        font-size: 14px;
    }
    
    .ats-step-number {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .ats-button-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .ats-btn {
        width: 100%;
        min-width: auto;
    }
    
    .ats-form-header h1 {
        font-size: 2em;
    }
    
    .ats-section-title {
        font-size: 1.5em;
    }
    
    .ats-summary-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ats-form-input,
    .ats-form-select,
    .ats-form-textarea {
        font-size: 16px; /* Previene zoom su iOS */
    }
}

@media (max-width: 480px) {
    .ats-form-container {
        margin: 5px;
        padding: 10px;
    }
    
    .ats-form-header {
        padding: 20px 0;
    }
    
    .ats-form-header h1 {
        font-size: 1.8em;
    }
    
    .ats-form-input,
    .ats-form-select,
    .ats-form-textarea {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .ats-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .ats-checkbox-group {
        padding: 15px;
    }
    
    .ats-summary-box {
        padding: 20px;
    }
}

/* Animazioni aggiuntive */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.ats-btn-primary:active {
    animation: pulse 0.3s ease;
}

/* Accessibilità */
.ats-form-input:focus-visible,
.ats-form-select:focus-visible,
.ats-form-textarea:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

.ats-btn:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .ats-button-group,
    .ats-step-indicator {
        display: none;
    }
    
    .ats-form-section {
        display: block !important;
    }
    
    .ats-form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}