/* Newsletter Optin Plugin - Native WooCommerce Styles */

/* Base container - matches WooCommerce checkbox structure */
.newsletter-optin-container {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    font-style: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    line-height: 1;
    margin-top: 1em;
    text-decoration: inherit;
    text-transform: inherit;
}

/* Validated checkbox control structure */
.newsletter-optin-container.wc-block-components-validated-checkbox-control label {
    display: grid;
    grid-template-columns: auto 1fr;
}

.newsletter-optin-container.wc-block-components-validated-checkbox-control label .wc-block-components-validation-error {
    grid-column: 1/-1;
}

/* Label structure - exact match of WooCommerce */
.newsletter-optin-container label {
    align-items: flex-start;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.875em;
    margin-bottom: 0 !important;
    position: relative;
}

.newsletter-optin-container label input[type=checkbox] {
    cursor: inherit;
}

/* Checkbox input - EXACT MATCH of WooCommerce native styles */
.newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox],
.newsletter-optin-container input[type=checkbox] {
    appearance: none;
    background-color: #fff;
    border: 1px solid rgba(25, 23, 17, 0.48);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    height: 1.5em;
    margin: 0 1em 0 0;
    min-height: 1.5em;
    min-width: 1.5em;
    overflow: hidden;
    position: static;
    vertical-align: middle;
    width: 1.5em;
}

.newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:checked,
.newsletter-optin-container input[type=checkbox]:checked {
    background: #fff;
}

.newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:focus,
.newsletter-optin-container input[type=checkbox]:focus {
    outline: 1.5px solid hsla(0, 0%, 7%, 0.8);
    outline-offset: 1.5px;
}

.newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:after,
.newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:before,
.newsletter-optin-container input[type=checkbox]:after,
.newsletter-optin-container input[type=checkbox]:before {
    content: "";
}

.newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:not(:checked) + .wc-block-components-checkbox__mark,
.newsletter-optin-container input[type=checkbox]:not(:checked) + .newsletter-optin-mark {
    display: none;
}

/* Dark theme support - exact match */
.has-dark-controls .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox],
.has-dark-controls .newsletter-optin-container input[type=checkbox] {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: hsla(0, 0%, 100%, 0.4);
    color: #fff;
}

.has-dark-controls .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:checked,
.has-dark-controls .newsletter-optin-container input[type=checkbox]:checked {
    background: rgba(0, 0, 0, 0.1);
    border-color: currentColor;
}

.has-dark-controls .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:focus,
.has-dark-controls .newsletter-optin-container input[type=checkbox]:focus {
    outline: 1.5px solid currentColor;
    outline-offset: 1.5px;
}

/* Checkbox mark - exact WooCommerce style */
.newsletter-optin-container .wc-block-components-checkbox__mark,
.newsletter-optin-container .newsletter-optin-mark {
    fill: #000;
    height: 1.125em;
    margin-left: .1875em;
    margin-top: .0625em;
    pointer-events: none;
    position: absolute;
    width: 1.125em;    
}

.has-dark-controls .newsletter-optin-container .wc-block-components-checkbox__mark,
.has-dark-controls .newsletter-optin-container .newsletter-optin-mark {
    fill: #fff;
}

/* Label text styling - exact WooCommerce match */
.newsletter-optin-container .wc-block-components-checkbox__label,
.newsletter-optin-container .newsletter-optin-label,
.newsletter-optin-container > span {
    line-height: 1.5em;
    vertical-align: middle;
}

/* Error state styling */
.newsletter-optin-container.has-error,
.newsletter-optin-container.has-error a {
    color: #cc1818;
}

.newsletter-optin-container.has-error .wc-block-components-checkbox__input,
.newsletter-optin-container.has-error .wc-block-components-checkbox__input:active,
.newsletter-optin-container.has-error .wc-block-components-checkbox__input:focus,
.newsletter-optin-container.has-error .wc-block-components-checkbox__input:hover,
.newsletter-optin-container.has-error input[type=checkbox],
.newsletter-optin-container.has-error input[type=checkbox]:active,
.newsletter-optin-container.has-error input[type=checkbox]:focus,
.newsletter-optin-container.has-error input[type=checkbox]:hover {
    border-color: #cc1818;
}

.newsletter-optin-container.has-error .wc-block-components-checkbox__input:focus,
.newsletter-optin-container.has-error input[type=checkbox]:focus {
    outline: 2px solid #cc1818;
    outline-offset: 2px;
}

/* Integration with address forms */
.wc-block-components-address-form .newsletter-optin-container {
    margin-top: 16px;
}

/* Integration with checkout add note section */
.wc-block-checkout__add-note .newsletter-optin-container {
    line-height: 1;
    margin-bottom: -3px;
    margin-top: 0;
}

/* Block checkout integration */
.wc-block-components-checkbox .newsletter-optin-container {
    margin-top: 1em;
}

/* Specific integration for contact information blocks */
.wp-block-woocommerce-checkout-contact-information-block .newsletter-optin-container,
.wc-block-checkout__contact-information .newsletter-optin-container {
    margin-top: 16px;
}

/* WooCommerce classic checkout integration */
.woocommerce-checkout .newsletter-optin-container {
    margin: 15px 0 !important;
    clear: both !important;
}

.woocommerce p.newsletter-optin-woocommerce-field,
.woocommerce .newsletter-optin-woocommerce-field {
    margin: 15px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    clear: both !important;
}

/* My Account registration form */
.newsletter-optin-woocommerce-register {
    margin: 1em 0;
    padding: 0;
}

.newsletter-optin-woocommerce-register label {
    display: flex !important;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 !important;
}

/* WooCommerce My Account page - Registration form specific styles */
.woocommerce-account .newsletter-optin-container,
.woocommerce form.register .newsletter-optin-container,
.woocommerce .woocommerce-form-register .newsletter-optin-container {
    margin: 1em 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    clear: both !important;
}

.woocommerce-account .newsletter-optin-container label,
.woocommerce form.register .newsletter-optin-container label,
.woocommerce .woocommerce-form-register .newsletter-optin-container label {
    display: inline-flex !important;
    align-items: flex-start !important;
    cursor: pointer !important;
    font-size: 0.875em !important;
    margin-bottom: 0 !important;
    position: relative !important;
    width: 100% !important;
}

/* WooCommerce form specific checkbox styles */
.woocommerce .newsletter-optin-container .wc-block-components-checkbox__input,
.woocommerce .newsletter-optin-container input[type=checkbox] {
    appearance: none !important;
    background-color: #fff !important;
    border: 1px solid rgba(25, 23, 17, 0.48) !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    font-size: 1em !important;
    height: 1.5em !important;
    margin: 0 1em 0 0 !important;
    min-height: 1.5em !important;
    min-width: 1.5em !important;
    overflow: hidden !important;
    position: static !important;
    vertical-align: middle !important;
    width: 1.5em !important;
    float: none !important;
}

.woocommerce .newsletter-optin-container .wc-block-components-checkbox__input:checked,
.woocommerce .newsletter-optin-container input[type=checkbox]:checked {
    background: #fff !important;
}

.woocommerce .newsletter-optin-container .wc-block-components-checkbox__input:focus,
.woocommerce .newsletter-optin-container input[type=checkbox]:focus {
    outline: 1.5px solid hsla(0, 0%, 7%, 0.8) !important;
    outline-offset: 1.5px !important;
}

/* WooCommerce checkmark */
.woocommerce .newsletter-optin-container .wc-block-components-checkbox__mark {
    fill: #000 !important;
    height: 1.125em !important;
    margin-left: .1875em !important;
    margin-top: .0625em !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 1.125em !important;
}

.woocommerce .newsletter-optin-container .wc-block-components-checkbox__input:not(:checked) + .wc-block-components-checkbox__mark {
    display: none !important;
}

/* Label text styling */
.woocommerce .newsletter-optin-container .wc-block-components-checkbox__label,
.woocommerce .newsletter-optin-container .newsletter-optin-label {
    line-height: 1.5em !important;
    vertical-align: middle !important;
    margin-left: 0 !important;
    flex: 1 !important;
}

/* Edit account form */
.newsletter-optin-edit-account {
    margin: 2em 0;
    padding: 1.5em;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.newsletter-optin-edit-account legend {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    margin-bottom: 1em;
    padding: 0 10px;
    background: #f8f9fa;
}

/* Theme compatibility - Twenty Twenty One */
.theme-twentytwentyone .has-dark-controls .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox],
.theme-twentytwentyone .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox],
.theme-twentytwentyone .has-dark-controls .newsletter-optin-container input[type=checkbox],
.theme-twentytwentyone .newsletter-optin-container input[type=checkbox] {
    background-color: #fff;
    border-color: var(--form--border-color, rgba(25, 23, 17, 0.48));
    position: relative;
}

.theme-twentytwentyone .has-dark-controls .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:checked,
.theme-twentytwentyone .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:checked,
.theme-twentytwentyone .has-dark-controls .newsletter-optin-container input[type=checkbox]:checked,
.theme-twentytwentyone .newsletter-optin-container input[type=checkbox]:checked {
    background-color: #fff;
    border-color: var(--form--border-color, rgba(25, 23, 17, 0.48));
}

.theme-twentytwentyone .newsletter-optin-container .wc-block-components-checkbox__mark,
.theme-twentytwentyone .newsletter-optin-container .newsletter-optin-mark {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .newsletter-optin-container {
        margin: 0.8em 0;
    }
    
    .newsletter-optin-container label {
        font-size: 0.8125em; /* 13px */
    }
}

/* Editor styles */
.wp-block-editor .newsletter-optin-container {
    position: relative;
}

.wp-block-editor .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox] {
    appearance: none !important;
    background-color: #fff !important;
    border: 1px solid rgba(25, 23, 17, 0.48) !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    font-size: 1em !important;
    height: 1.5em !important;
    margin: 0 1em 0 0 !important;
    min-height: 1.5em !important;
    min-width: 1.5em !important;
    overflow: hidden !important;
    position: static !important;
    vertical-align: middle !important;
    width: 1.5em !important;
}

.wp-block-editor .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:checked {
    background: #fff !important;
}

.wp-block-editor .newsletter-optin-container .wc-block-components-checkbox__input[type=checkbox]:focus {
    outline: 1.5px solid hsla(0, 0%, 7%, 0.8) !important;
    outline-offset: 1.5px !important;
}

/* Editor block containers */
.newsletter-optin-checkout-block-editor,
.newsletter-optin-inner-block-editor {
    border: 1px dashed #ccc !important;
    border-radius: 4px !important;
    background-color: #f9f9f9 !important;
    padding: 12px !important;
}

/* Ensure visibility */
#newsletter_optin_woocommerce,
.newsletter-optin-checkbox-input {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* =============================================================================
   ADMIN PANEL STYLES - Newsletter & GetResponse Integration v2.0
   ============================================================================= */

/* Main menu icon enhancement */
.wp-menu-image.dashicons-email-alt2::before {
    font-size: 20px;
}

/* Admin header styling */
.newsletter-getresponse-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.newsletter-getresponse-header h1 {
    color: white;
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.newsletter-getresponse-header .description {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
}

/* Statistics cards */
.stats-cards {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.stats-card {
    background: white;
    padding: 20px;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    min-width: 200px;
    flex: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stats-card h3 {
    margin-top: 0;
    color: #1d2327;
    font-size: 16px;
    font-weight: 600;
}

.stats-number {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
    line-height: 1;
}

.stats-number.primary {
    color: #135e96;
}

.stats-number.success {
    color: #00a32a;
}

.stats-number.warning {
    color: #dba617;
}

/* Enhanced form sections */
.newsletter-section {
    background: white;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.newsletter-section-header {
    background: #f6f7f7;
    padding: 15px 20px;
    border-bottom: 1px solid #c3c4c7;
    margin: 0;
}

.newsletter-section-header h2 {
    margin: 0;
    color: #1d2327;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.newsletter-section-content {
    padding: 20px;
}

/* GetResponse integration highlight */
.getresponse-integration {
    border-left: 4px solid #0073aa;
}

.getresponse-integration .newsletter-section-header {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
}

/* Quick actions buttons */
.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.button-enhanced {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.button-enhanced:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Subscribers table enhancement */
.subscribers-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wp-list-table.subscribers {
    margin: 0;
}

.wp-list-table.subscribers th {
    background: #f6f7f7;
    color: #1d2327;
    font-weight: 600;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-indicator.active {
    background: #d7eddd;
    color: #00a32a;
}

.status-indicator.synced {
    background: #cce7ff;
    color: #0073aa;
}

.status-indicator.pending {
    background: #fcf2cd;
    color: #dba617;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-cards {
        flex-direction: column;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .button-enhanced {
        justify-content: center;
    }
    
    .newsletter-getresponse-header h1 {
        font-size: 24px;
    }
}