/* Reset e base styles */
* {
    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: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.form-wrapper {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 100%;
}

/* Company Header */
.company-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    padding: 2px 5px;
    background: linear-gradient(135deg, #111111 0%, #333333 100%);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.company-logo {
    width: 200px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(255, 255, 255, 0.1));
    transition: transform 0.3s ease;
}

.company-logo:hover {
    transform: scale(1.05);
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 2.2rem;
    font-weight: 600;
}

/* Company Footer */
.company-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e1e8ed;
    text-align: center;
}

.company-footer .company-info h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 700;
}

.company-footer .company-details {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
}

.company-footer .company-details a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.company-footer .company-details a:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.recaptcha-notice {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e1e8ed;
    text-align: center;
}

.recaptcha-notice small {
    color: #888;
    font-size: 0.8rem;
}

.recaptcha-notice a {
    color: #667eea;
    text-decoration: none;
}

.recaptcha-notice a:hover {
    text-decoration: underline;
}

.form-description {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
    font-size: 1.1rem;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Form styles */
.form-group {
    margin-bottom: 8px;
}

label {
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

label.required::after {
    content: " *";
    color: #e74c3c;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
    width: 100%;
    padding: 8px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' 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 15px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select option {
    padding: 8px 12px;
    font-size: 1rem;
    color: #333;
    background-color: white;
}

select option:first-child {
    color: #999;
    font-style: italic;
}

select:invalid {
    color: #999;
}

select:valid {
    color: #2c3e50;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

input[type="text"].error,
input[type="email"].error,
input[type="tel"].error,
select.error {
    border-color: #e74c3c;
    background-color: #fff5f5;
}

.help-text {
    display: block;
    margin-top: 2px;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.error-message {
    display: block;
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 2px;
    font-weight: 500;
    min-height: 18px;
}

/* Checkbox styles */
.checkbox-group {
    margin-bottom: 8px;
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal;
    line-height: 1.5;
    margin-bottom: 0;
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 12px;
    margin-top: 2px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-container:hover .checkmark {
    border-color: #667eea;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    color: #555;
    font-size: 0.95rem;
}

.checkbox-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

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

/* Submit button */
.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

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

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff3d;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

.required-note {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalAppear 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.privacy-content h3 {
    color: #2c3e50;
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.privacy-content p,
.privacy-content ul {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
}

.privacy-content ul {
    padding-left: 20px;
}

.privacy-content li {
    margin-bottom: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .form-wrapper {
        padding: 20px;
    }
    
    .company-header {
        padding: 1px 4px;
        margin-bottom: 25px;
    }
    
    .company-logo {
        width: 180px;
        height: 180px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .company-footer .company-info h3 {
        font-size: 1.2rem;
    }
    
    .company-footer .company-details {
        font-size: 0.9rem;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 3px;
    }
    
    .form-wrapper {
        padding: 15px;
    }
    
    .company-header {
        padding: 1px 3px;
        margin-bottom: 20px;
    }
    
    .company-logo {
        width: 160px;
        height: 160px;
    }
    
    h1 {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }
    
    .form-description {
        font-size: 1rem;
        margin-bottom: 25px;
    }
    
    .company-footer {
        margin-top: 30px;
        padding-top: 25px;
    }
    
    .company-footer .company-info h3 {
        font-size: 1.1rem;
    }
    
    .company-footer .company-details {
        font-size: 0.85rem;
    }
    
    .checkbox-container {
        font-size: 0.9rem;
    }
    
    .submit-btn {
        padding: 15px 25px;
        font-size: 1.1rem;
        margin-top: 10px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    label {
        font-size: 1rem;
        margin-bottom: 10px;
    }
}

/* Per schermi molto piccoli (iPhone SE, etc.) */
@media (max-width: 320px) {
    .company-logo {
        width: 140px;
        height: 140px;
    }
    
    .company-header {
        padding: 1px 2px;
    }
    
    h1 {
        font-size: 1.4rem;
    }
    
    .form-wrapper {
        padding: 12px;
    }
}