/* Reset e base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #4a90e2;
    --success-color: #4caf50;
    --error-color: #f44336;
    --text-dark: #333333;
    --text-light: #666666;
    --background-light: #f5f5f5;
    --background-white: #ffffff;
    --border-color: #e0e0e0;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden; /* Previene scroll orizzontale */
    max-width: 100vw; /* Forza larghezza massima viewport */
}

/* Container principale */
.registration-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header section */
.header-section {
    margin-bottom: 24px;
}

.dongfeng-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 32px 24px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.dongfeng-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.dongfeng-header p {
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.95;
}

/* Form container */
.form-container {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    box-shadow: var(--shadow-hover);
}

.form-container h2 {
    color: var(--primary-color);
    font-size: 1.75rem;
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 1rem;
}

/* Form sections */
.form-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--background-light);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.form-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--secondary-color);
    margin-right: 12px;
    border-radius: 2px;
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 16px;
    font-style: italic;
}

/* Form groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--background-white);
    color: var(--text-dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-control::placeholder {
    color: #aaa;
}

/* Fix per date picker su iOS/iPhone */
input[type="date"],
input[type="datetime-local"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Previene overflow su mobile */
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value {
    text-align: left;
    width: 100%;
}

/* Checkbox group */
.checkbox-group {
    background: var(--background-light);
    padding: 16px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.checkbox-group label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 12px;
    margin-top: 3px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-group span {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Validation messages */
.validation-message {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 6px;
    display: block;
    font-weight: 500;
}

/* Buttons */
.form-actions {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 90, 160, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading spinner */
.loading-spinner {
    text-align: center;
    padding: 64px 20px;
}

.spinner {
    border: 4px solid var(--background-light);
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success message */
.success-message {
    text-align: center;
    padding: 64px 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 24px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-message h3 {
    color: var(--success-color);
    font-size: 1.75rem;
    margin-bottom: 12px;
}

.success-message p {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 1.1rem;
}

/* Error message */
.error-message {
    background: #ffebee;
    border: 2px solid var(--error-color);
    color: #c62828;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 640px) {
    .registration-container {
        padding: 12px;
    }

    .form-container {
        padding: 24px 16px;
    }

    .dongfeng-header h1 {
        font-size: 2rem;
    }

    .dongfeng-header p {
        font-size: 0.875rem;
    }

    .form-container h2 {
        font-size: 1.5rem;
    }

    .btn-primary {
        width: 100%;
        padding: 16px 32px;
    }
}

@media (max-width: 480px) {
    .dongfeng-header {
        padding: 24px 16px;
    }

    .dongfeng-header h1 {
        font-size: 1.75rem;
        letter-spacing: 2px;
    }

    .form-control {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Forza dimensioni corrette per date picker su schermi piccoli */
    input[type="date"],
    input[type="datetime-local"] {
        max-width: 100%;
        overflow: hidden;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .registration-container {
        max-width: 100%;
    }

    .btn-primary {
        display: none;
    }
}
