/**
 * ActiveTrail Checkout Styles
 *
 * @package ActiveTrail_WooCommerce
 * @since 1.0.0
 */

/* Consent Field Styling */
.activetrail-consent-row {
    position: relative;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
}

/* Registration Consent Field Styling */
.woocommerce-form-row--wide .woocommerce-form__label-for-checkbox {
    display: flex;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    margin: 0;
    padding: 10px 0;
}

.woocommerce-form-row--wide .woocommerce-form__input-checkbox {
    margin: 4px 12px 0 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0073aa;
}

.woocommerce-form-row--wide .woocommerce-form__input-checkbox:checked {
    accent-color: #0073aa;
}

.woocommerce-form-row--wide .woocommerce-form__input-checkbox:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Custom checkbox styling for registration form */
.woocommerce-form-row--wide .checkmark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 12px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: #fff;
    transition: all 0.3s ease;
}

.woocommerce-form-row--wide input[type="checkbox"]:checked + .checkmark {
    background: #0073aa;
    border-color: #0073aa;
}

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

/* Registration consent field styling */
.woocommerce-form-row:not(.woocommerce-form-row--wide) .woocommerce-form__label-for-checkbox {
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    margin: 0;
    padding: 5px 0;
}

.woocommerce-form-row:not(.woocommerce-form-row--wide) .woocommerce-form__input-checkbox {
    margin: 0 8px 0 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0073aa;
}

.woocommerce-form-row:not(.woocommerce-form-row--wide) .woocommerce-form__input-checkbox:checked {
    accent-color: #0073aa;
}

.woocommerce-form-row:not(.woocommerce-form-row--wide) .woocommerce-form__input-checkbox:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.activetrail-consent-row.consented {
    background: #d4edda;
    border-color: #c3e6cb;
}

.activetrail-consent-row.not-consented {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.activetrail-consent-row label {
    display: flex;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
    margin: 0;
}

.activetrail-consent-row input[type="checkbox"] {
    margin: 4px 12px 0 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.activetrail-consent-row input[type="checkbox"]:checked {
    accent-color: #0073aa;
}

/* Privacy Notice */
.activetrail-privacy-notice {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.activetrail-privacy-notice small {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.4;
}

.activetrail-privacy-notice a {
    color: #0073aa;
    text-decoration: underline;
}

.activetrail-privacy-notice a:hover {
    color: #005a87;
}

/* Consent Reminder */
.activetrail-consent-reminder {
    margin: 20px 0;
    padding: 15px 20px;
    background: linear-gradient(135deg, #262e3e 0%, #262e3e 100%);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(38, 46, 62, 0.3);
    animation: slideInDown 0.5s ease-out;
}

.activetrail-consent-reminder p {
    margin: 0 0 15px 0;
    font-size: 15px;
    line-height: 1.5;
}

.activetrail-consent-reminder .button {
    margin: 0 10px 0 0;
    padding: 8px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.activetrail-consent-reminder .button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.activetrail-consent-reminder .button-primary {
    background: #fff;
    color: #262e3e;
    border-color: #fff;
}

.activetrail-consent-reminder .button-primary:hover {
    background: #f8f9fa;
    color: #262e3e;
}

/* Validation States */
.activetrail-consent-row.woocommerce-invalid {
    border-color: #dc3545;
    background: #f8d7da;
}

.activetrail-consent-row.woocommerce-invalid label {
    color: #721c24;
}

.activetrail-consent-row.woocommerce-validated {
    border-color: #28a745;
    background: #d4edda;
}

/* Loading State */
.activetrail-consent-row.loading {
    opacity: 0.7;
    pointer-events: none;
}

.activetrail-consent-row.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translateY(-50%);
}

/* Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Consent Benefits */
.activetrail-consent-benefits {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 115, 170, 0.05);
    border-radius: 4px;
    font-size: 12px;
    color: #495057;
}

.activetrail-consent-benefits ul {
    margin: 5px 0 0 15px;
    list-style: none;
    padding: 0;
}

.activetrail-consent-benefits li {
    margin: 3px 0;
    position: relative;
    padding-left: 15px;
}

.activetrail-consent-benefits li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .activetrail-consent-row {
        margin: 10px 0;
        padding: 15px;
    }

    .activetrail-consent-row label {
        font-size: 13px;
    }

    .activetrail-consent-reminder {
        margin: 10px 0;
        padding: 15px;
    }

    .activetrail-consent-reminder p {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .activetrail-consent-reminder .button {
        display: block;
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }

    .activetrail-privacy-notice {
        margin-top: 8px;
        padding-top: 8px;
    }

    /* Registration consent field mobile styling */
    .woocommerce-form-row:not(.woocommerce-form-row--wide) .woocommerce-form__label-for-checkbox {
        font-size: 13px;
        padding: 3px 0;
    }

    .woocommerce-form-row:not(.woocommerce-form-row--wide) .woocommerce-form__input-checkbox {
        width: 14px;
        height: 14px;
        margin: 0 6px 0 0;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .activetrail-consent-row {
        border-width: 2px;
        background: #fff;
    }
    
    .activetrail-consent-row.consented {
        background: #fff;
        border-color: #000;
    }
    
    .activetrail-consent-reminder {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .activetrail-consent-row,
    .activetrail-consent-reminder .button {
        transition: none;
    }
    
    .activetrail-consent-reminder {
        animation: none;
    }
    
    .activetrail-consent-row.loading::after {
        animation: pulse 2s infinite;
    }
}

/* Print Styles */
@media print {
    .activetrail-consent-reminder {
        display: none;
    }
    
    .activetrail-consent-row {
        background: transparent;
        border: 1px solid #000;
    }
    
    .activetrail-privacy-notice {
        border-top-color: #000;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .activetrail-consent-row {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .activetrail-consent-row.consented {
        background: #2f855a;
        border-color: #38a169;
    }
    
    .activetrail-consent-row.not-consented {
        background: #d69e2e;
        border-color: #ecc94b;
        color: #1a202c;
    }
    
    .activetrail-privacy-notice {
        border-top-color: #4a5568;
    }
    
    .activetrail-privacy-notice small {
        color: #a0aec0;
    }
    
    .activetrail-privacy-notice a {
        color: #63b3ed;
    }
    
    .activetrail-privacy-notice a:hover {
        color: #90cdf4;
    }
    
    .activetrail-consent-benefits {
        background: rgba(63, 179, 237, 0.1);
        color: #e2e8f0;
    }
}

/* Focus States for Accessibility */
.activetrail-consent-row input[type="checkbox"]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.activetrail-consent-reminder .button:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Custom Checkbox Styling (Optional Enhancement) */
.activetrail-consent-row.custom-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #0073aa;
    border-radius: 3px;
    background: #fff;
    position: relative;
    cursor: pointer;
}

.activetrail-consent-row.custom-checkbox input[type="checkbox"]:checked {
    background: #0073aa;
}

.activetrail-consent-row.custom-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.activetrail-consent-row.custom-checkbox input[type="checkbox"]:hover {
    border-color: #005a87;
}

.activetrail-consent-row.custom-checkbox input[type="checkbox"]:focus {
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}
