/**
 * Admin CSS for SubscriptionFlow Recurring Payments Plugin
 * 
 * WHERE USED:
 * - Product Edit Page (Simple & Variable Products)
 *   - Subscription tab styling
 *   - Discount option cards
 *   - Variation subscription fields
 * 
 * - SubscriptionFlow Settings Page
 *   - Settings form styling
 *   - Notice card styling
 *   - Loader overlay
 *   - Success message styling
 * 
 * ENQUEUED IN:
 * - admin/class-sfrp-subscription-admin.php (Product edit pages)
 * - admin/class-sfrp-subscriptionflow-settings.php (Settings page)
 */

/* ============================================
   PRODUCT EDIT PAGE STYLES
   ============================================ */

.subscription_period_interval_field .wrap {
    display: inline-block;
}
.subscription_period_interval_field label.subscription_period_interval_label {
    display: inline-block;
    margin: 0 5px;
    font-weight: normal;
}
.subscription_trial_length_field .wrap {
    display: inline-block;
}
.subscription_trial_length_field input,
.subscription_trial_length_field select {
    display: inline-block;
    vertical-align: middle;
}
.sf-subscription-variation-fields {
    clear: both;
}
.sf-subscription-variation-fields h4 {
    font-size: 14px;
    font-weight: 600;
}

/* Discount option card styles - WooCommerce compatible */
.sf-discount-option-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    margin: 0 0 12px 12px;
    position: relative;
    clear: both;
}

.sf-discount-card-header {
    margin: 0;
    padding: 9px 12px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.4em;
    position: relative;
}

.sf-discount-card-header strong {
    font-weight: 600;
}

.sf-discount-card-header .sf-remove-discount-option {
    float: right;
    margin: -4px 0 0 10px;
}

.sf-discount-card-content {
    padding: 12px;
}

.sf-discount-type-field {
    padding-right: 90px !important;
}

.sf-discount-type-field .sf-radio-label {
    display: block;
    margin: 0 0 8px 0;
    cursor: pointer;
    font-size: 13px;
}

.sf-discount-type-field .sf-radio-label input[type="radio"] {
    margin: 0 6px 0 0;
    vertical-align: middle;
}

.form-field-wide {
    width: 100%;
    clear: both;
}

.sf-hidden {
    display: none !important;
}

/* Variation discount options */
.sf-variation-discount-options-container .sf-discount-option-card {
    margin: 0 0 12px 0;
}

/* Hide specific subscription fields (can be unhidden later if needed) */
.subscription_period_interval_field,
._subscription_length_field,
._subscription_sign_up_fee_field,
.subscription_trial_length_field {
    display: none !important;
}

/* Hide variation subscription fields */
.sf-subscription-variation-fields p.form-row:has(select[name*="variable_subscription_period_interval"]),
.sf-subscription-variation-fields p.form-row:has(select[name*="variable_subscription_length"]),
.sf-subscription-variation-fields p.form-row:has(input[name*="variable_subscription_sign_up_fee"]),
.sf-subscription-variation-fields p.form-row:has(input[name*="variable_subscription_trial_length"]) {
    display: none !important;
}

/* Global discount type field styling - WooCommerce native */
._subscription_discount_type_field .woocommerce-input-wrapper {
    display: block;
    margin-top: 5px;
}

._subscription_discount_type_field .woocommerce-input-wrapper label {
    display: block;
    margin: 0 0 8px 0;
    padding: 0;
    cursor: pointer;
    font-weight: normal;
}

._subscription_discount_type_field .woocommerce-input-wrapper label input[type="radio"] {
    margin: 0 6px 0 0;
    vertical-align: middle;
    cursor: pointer;
}

._subscription_discount_type_field .woocommerce-input-wrapper label:last-child {
    margin-bottom: 0;
}

/* Variation discount type field styling */
.sf-subscription-variation-fields .form-row-full .woocommerce-input-wrapper {
    display: block;
    margin-top: 5px;
}

.sf-subscription-variation-fields .form-row-full .woocommerce-input-wrapper label {
    display: block;
    margin: 0 0 8px 0;
    padding: 0;
    cursor: pointer;
    font-weight: normal;
}

.sf-subscription-variation-fields .form-row-full .woocommerce-input-wrapper label input[type="radio"] {
    margin: 0 6px 0 0;
    vertical-align: middle;
    cursor: pointer;
}

.sf-subscription-variation-fields .form-row-full .woocommerce-input-wrapper label:last-child {
    margin-bottom: 0;
}

/* ============================================
   SETTINGS PAGE STYLES
   ============================================ */

.sf-subscriptionflow-settings {
    max-width: 900px;
}

.sf-subscriptionflow-notice-card {
    background: linear-gradient(135deg, #ff7849 0%, #ff9966 100%);
    border: none;
    border-radius: 8px;
    padding: 25px 30px;
    margin: 20px 0 30px 0;
    box-shadow: 0 4px 15px rgba(255, 120, 73, 0.3);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.sf-subscriptionflow-notice-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.sf-subscriptionflow-notice-card .notice-content {
    position: relative;
    z-index: 1;
}

.sf-subscriptionflow-notice-card .notice-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 15px;
    display: inline-block;
}

.sf-subscriptionflow-notice-card h3 {
    color: #fff;
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
}

.sf-subscriptionflow-notice-card p {
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 20px 0;
    font-size: 15px;
    line-height: 1.6;
}

.sf-subscriptionflow-notice-card .purchase-button {
    display: inline-block;
    background: #fff;
    color: #ff7849;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sf-subscriptionflow-notice-card .purchase-button:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #ff7849;
}

.sf-subscriptionflow-settings-form {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sf-subscriptionflow-settings-form .form-table {
    margin-top: 0;
}

.sf-subscriptionflow-settings-form .form-table th {
    padding: 20px 0 20px 0;
    font-weight: 600;
    color: #23282d;
    font-size: 14px;
    width: 200px;
}

.sf-subscriptionflow-settings-form .form-table td {
    padding: 20px 0;
}

.sf-subscriptionflow-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 500px;
}

.sf-subscriptionflow-input-wrapper .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8c8f94;
    font-size: 18px;
    z-index: 1;
    pointer-events: none;
}

.sf-subscriptionflow-input-wrapper input[type="url"],
.sf-subscriptionflow-input-wrapper input[type="text"],
.sf-subscriptionflow-input-wrapper input[type="password"] {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
    box-sizing: border-box;
}

.sf-subscriptionflow-input-wrapper input[type="url"]:focus,
.sf-subscriptionflow-input-wrapper input[type="text"]:focus,
.sf-subscriptionflow-input-wrapper input[type="password"]:focus {
    border-color: #ff7849;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 120, 73, 0.1);
}

.sf-subscriptionflow-input-wrapper input[type="url"]:hover,
.sf-subscriptionflow-input-wrapper input[type="text"]:hover,
.sf-subscriptionflow-input-wrapper input[type="password"]:hover {
    border-color: #999;
}

.sf-subscriptionflow-input-wrapper .description {
    margin-top: 8px;
    color: #646970;
    font-size: 13px;
    line-height: 1.5;
}

.sf-subscriptionflow-settings-form .submit {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.sf-subscriptionflow-settings-form .button-primary {
    background: #ff7849;
    border-color: #ff7849;
    color: #fff;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    height: auto;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.sf-subscriptionflow-settings-form .button-primary:hover {
    background: #ff6633;
    border-color: #ff6633;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 120, 73, 0.3);
}

.sf-subscriptionflow-settings-form .button-primary:active {
    transform: translateY(0);
}

@media (max-width: 782px) {
    .sf-subscriptionflow-settings-form .form-table th,
    .sf-subscriptionflow-settings-form .form-table td {
        display: block;
        width: 100%;
        padding: 15px 0;
    }
    
    .sf-subscriptionflow-settings-form .form-table th {
        padding-bottom: 8px;
    }
}

/* Loader Styles */
.sf-subscriptionflow-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.sf-subscriptionflow-loader-overlay.active {
    display: flex;
}

.sf-subscriptionflow-loader {
    background: #fff;
    border-radius: 12px;
    padding: 40px 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 300px;
}

.sf-subscriptionflow-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff7849;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: sf-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes sf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sf-subscriptionflow-loader-text {
    font-size: 16px;
    font-weight: 600;
    color: #23282d;
    margin: 0;
}

/* Success Message Styles */
.sf-subscriptionflow-success-message {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border: none;
    border-radius: 8px;
    padding: 20px 25px;
    margin: 20px 0;
    color: #fff;
    display: none;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
    animation: sf-slideDown 0.3s ease-out;
}

.sf-subscriptionflow-success-message.show {
    display: block;
}

.sf-subscriptionflow-success-message .message-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sf-subscriptionflow-success-message .success-icon {
    font-size: 32px;
    line-height: 1;
}

.sf-subscriptionflow-success-message .message-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    margin: 0;
}

.sf-subscriptionflow-success-message .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sf-subscriptionflow-success-message .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

@keyframes sf-slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
