/* CartoMania Management System Public Styles */
.cartomania-consent-form-wrapper {
    max-width: 800px;
    margin: 30px auto;
    padding: 25px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
}

.cartomania-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.cartomania-form h2 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
}

.cartomania-form h3 {
    color: #444;
    margin: 25px 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
    font-size: 18px;
}

.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

.minor-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.minor-add-button,
.minor-remove-button {
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.minor-add-button {
    background: #2a6a2a;
}

.minor-remove-button {
    background: #dc3232;
    font-size: 20px;
}

.minor-entry {
    margin-top: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
}

.minor-entry-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.minor-entry-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
}

.minor-entry .form-row > label {
    margin-bottom: 10px;
}

.minor-entry input[type="date"] {
    margin-bottom: 8px;
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="number"],
.form-row input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-row input[type="text"]:focus,
.form-row input[type="email"]:focus,
.form-row input[type="tel"]:focus,
.form-row input[type="number"]:focus,
.form-row input[type="date"]:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0,115,170,0.2);
}

/* Required fields styling */
.cartomania-form input[type="text"]:required,
.cartomania-form input[type="email"]:required,
.cartomania-form input[type="tel"]:required,
.cartomania-form input[type="number"]:required,
.cartomania-form input[type="date"]:required {
    border-color: #f47920;
}

.cartomania-form input[type="radio"]:required,
.cartomania-form input[type="checkbox"]:required {
    outline: 2px solid #f47920;
    border-radius: 50%;
}

.cartomania-form .required-field > label {
    position: relative;
    padding-right: 10px;
}

.cartomania-form .required-field > label::after {
    content: '*';
    color: #f47920;
    position: absolute;
    right: 0;
    top: 0;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.4;
}

.rodo-info {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
}

.rodo-info h4 {
    color: #333;
    margin-bottom: 10px;
}

.rodo-info ol {
    padding-left: 20px;
}

.rodo-info li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.submit-row {
    margin-top: 30px;
    text-align: center;
}

.cartomania-submit-button {
    background: #f47920;
    color: #ffffff;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.cartomania-submit-button:hover {
    background: #000000 !important;
    color: #ffffff !important;
}

/* Signing date section */
.signing-date {
    background: #f8f8f8;
    padding: 15px 20px;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
}

.signing-info {
    margin: 0;
    color: #333;
    font-size: 16px;
    line-height: 1.4;
}

.signing-info strong {
    color: #0073aa;
    font-weight: 600;
}

/* Error messages */
.cartomania-error {
    color: #dc3232;
    padding: 10px;
    margin: 10px 0;
    background: #ffeaea;
    border-left: 4px solid #dc3232;
}

/* Success messages */
.cartomania-success {
    color: #46b450;
    padding: 10px;
    margin: 10px 0;
    background: #ecf7ed;
    border-left: 4px solid #46b450;
}

/* GDPR section styling */
.gdpr-info {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.gdpr-info small {
    display: block;
    color: #666;
    line-height: 1.4;
    font-size: 12px;
}

.checkbox-text {
    display: inline-block;
    margin-left: 8px;
    line-height: 1.4;
}

/* Form validation styles */
.field-error input,
.field-error select,
.field-error textarea {
    border-color: #dc3232 !important;
}

.field-error .checkbox-group {
    padding: 10px;
    background-color: #fff6f6;
    border: 1px solid #dc3232;
    border-radius: 4px;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

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

/* Required field indicator */
.required-field > label::after {
    content: ' *';
    color: #f47920;
    margin-left: 4px;
}

/* Mobile and tablet-friendly input styles */
@media screen and (max-width: 768px) {
    .minor-section-header {
        align-items: flex-start;
    }

    .minor-add-button,
    .minor-remove-button {
        width: 40px;
        height: 40px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .radio-group label,
    .checkbox-group label {
        padding: 15px;
        background: #f8f9fa;
        border-radius: 6px;
        border: 1px solid #ddd;
        min-height: 50px; /* Ensure touch-friendly target size */
        align-items: flex-start;
    }

    /* Enhanced checkbox styling for mobile/tablet */
    .checkbox-group label::before {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        border-width: 2px;
        top: 0; /* Align with top of text on mobile */
    }

    .checkbox-group input[type="checkbox"]:checked + label::after {
        left: 19px;
        top: 17px;
        font-size: 16px;
    }

    .radio-group label::before {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
    }

    .radio-group input[type="radio"]:checked + label::after {
        left: 19px;
        width: 10px;
        height: 10px;
    }

    .checkbox-text {
        font-size: 16px; /* Larger text for better readability on mobile */
        line-height: 1.6;
    }

    /* GDPR checkbox specific styling for mobile */
    .form-section:has(#gdpr_consent) .checkbox-group label {
        padding: 20px;
        line-height: 1.6;
        gap: 15px;
    }
}

/* Specific styles for Android Chrome tablets */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .checkbox-group label {
        gap: 15px;
        padding: 15px;
        min-height: 60px;
    }

    .checkbox-group label::before {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        top: 1px;
    }

    .checkbox-group input[type="checkbox"]:checked + label::after {
        left: 18px;
        top: 16px;
        font-size: 15px;
    }

    /* Enhanced GDPR section for tablets */
    .form-section:has(#gdpr_consent) .checkbox-group label {
        background: #fff;
        border: 2px solid #ddd;
        border-radius: 8px;
        padding: 20px;
        font-size: 16px;
        line-height: 1.7;
        gap: 18px;
    }

    .form-section:has(#gdpr_consent) .checkbox-group label:hover {
        border-color: #f47920;
        background-color: rgba(244, 121, 32, 0.02);
    }
}

/* Tooltip styles for guardian info */
.guardian-info {
    position: relative;
    cursor: pointer;
}

.guardian-info-tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 200px;
    margin-top: 5px;
}

.guardian-info:hover .guardian-info-tooltip,
.guardian-info:focus .guardian-info-tooltip {
    display: block;
}

.guardian-info-tooltip dl {
    margin: 0;
}

.guardian-info-tooltip dt {
    font-weight: bold;
    margin-bottom: 2px;
}

.guardian-info-tooltip dd {
    margin: 0 0 8px 0;
    color: #666;
}

/* RODO footer text styles */
.rodo-footer {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
}

.rodo-footer small {
    color: #666;
    font-size: 11px;
    line-height: 1.4;
}

/* Name fields styling */
.name-fields {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

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

@media screen and (max-width: 768px) {
    .name-fields {
        flex-direction: column;
        gap: 0;
    }
    
    .form-field-half:first-child {
        margin-right: 0;
        margin-bottom: 15px;
    }
}

/* Error field styling */
.error-field {
    border-color: #dc3232 !important;
    box-shadow: 0 0 2px rgba(220, 50, 50, 0.5) !important;
}

/* Enhanced checkbox and radio button styling for cross-browser compatibility */
.checkbox-group,
.radio-group {
    position: relative;
}

/* Hide native checkbox/radio inputs */
.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom checkbox container */
.checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.5;
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.checkbox-group label:hover {
    background-color: rgba(244, 121, 32, 0.05);
}

/* Custom checkbox */
.checkbox-group label::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    min-width: 20px; /* Prevent shrinking */
    min-height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    position: relative;
    top: 2px; /* Align with first line of text */
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* Checkbox checked state */
.checkbox-group input[type="checkbox"]:checked + label::before {
    background-color: #f47920;
    border-color: #f47920;
}

/* Checkbox checkmark */
.checkbox-group input[type="checkbox"]:checked + label::after {
    content: '✓';
    position: absolute;
    left: 14px;
    top: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

/* Required checkbox styling */
.checkbox-group.required-field input[type="checkbox"]:not(:checked) + label::before {
    border-color: #f47920;
    box-shadow: 0 0 0 1px rgba(244, 121, 32, 0.3);
}

/* Focus styles for accessibility */
.checkbox-group input[type="checkbox"]:focus + label::before {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Radio button styling */
.radio-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    margin-bottom: 5px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.radio-group label:hover {
    background-color: rgba(244, 121, 32, 0.05);
}

/* Custom radio button */
.radio-group label::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background-color: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* Radio button checked state */
.radio-group input[type="radio"]:checked + label::before {
    border-color: #f47920;
    background-color: #fff;
}

/* Radio button inner dot */
.radio-group input[type="radio"]:checked + label::after {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f47920;
}

/* Required radio styling */
.radio-group input[type="radio"]:required:not(:checked) + label::before {
    border-color: #f47920;
    box-shadow: 0 0 0 1px rgba(244, 121, 32, 0.3);
}

/* Focus styles for radio buttons */
.radio-group input[type="radio"]:focus + label::before {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Enhanced cross-browser compatibility for Android Chrome */
.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    /* Ensure inputs are completely hidden but still accessible */
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Improve touch targets for mobile devices */
.checkbox-group label,
.radio-group label {
    /* Ensure minimum touch target size (44px for iOS, 48px for Android) */
    min-height: 48px;
    display: flex;
    align-items: flex-start;
    touch-action: manipulation; /* Optimize for touch */
    -webkit-tap-highlight-color: rgba(244, 121, 32, 0.1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.radio-group label {
    align-items: center;
}

/* Minor section fine-tuning */
.minor-entry .consent-duration {
    margin-top: 6px;
}

.form-section .consent-duration {
    margin-top: 6px;
}

.form-section .consent-duration input[type="radio"]:checked + label::after {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.form-section .consent-duration input[type="radio"]:required:not(:checked) + label::before {
    border-color: #ddd;
    box-shadow: none;
}

.minor-entry .consent-duration input[type="radio"]:checked + label::after {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

/* Keep unselected options neutral; required applies to group validation, not first option styling */
.minor-entry .consent-duration input[type="radio"]:required:not(:checked) + label::before {
    border-color: #ddd;
    box-shadow: none;
}

@media screen and (max-width: 768px) {
    .minor-entry-top {
        margin-bottom: 14px;
    }

    .minor-entry .consent-duration {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .minor-entry .consent-duration label {
        flex: 0 0 calc(50% - 5px);
        box-sizing: border-box;
        margin-bottom: 0;
        align-items: center;
    }

    .minor-entry .consent-duration input[type="radio"]:checked + label::after {
        left: 18px;
        top: 50%;
        transform: translateY(-50%);
    }
}

/* Ensure proper layout on Android Chrome */
.checkbox-group,
.radio-group {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Additional Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    .checkbox-group label::before,
    .radio-group label::before {
        /* Force hardware acceleration for smoother rendering */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: background-color, border-color;
    }
    
    .checkbox-group input[type="checkbox"]:checked + label::after {
        /* Improve checkmark rendering on high-DPI displays */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Fallback for browsers that don't support :has() selector */
.checkbox-group.gdpr-consent label {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.7;
    gap: 18px;
}

.checkbox-group.gdpr-consent label:hover {
    border-color: #f47920;
    background-color: rgba(244, 121, 32, 0.02);
}

/* Select all button styling */
.cartomania-select-all-button {
    display: inline-block;
    padding: 8px 15px;
    background: #f47920 !important;
    color: white !important;
    border: 1px solid #f47920 !important;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.cartomania-select-all-button:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    color: white !important;
}

.cartomania-select-all-button:focus {
    outline: 2px solid #f47920;
    outline-offset: 2px;
}

/* RODO toggle icon styling */
#rodo-toggle-icon {
    color: #f47920 !important;
    font-weight: bold;
}

/* Postal code field styling */
.form-field-half input[type="text"] {
    width: 100%;
}

/* Address field required styling */
#adult_address:required {
    border-color: #f47920;
}

#adult_postal_code:required {
    border-color: #f47920;
}
