/**
 * WalletUp Pro Universal Button System
 * Reusable button styles for all admin pages
 * 
 * @version 1.0.0
 * @since 4.2.3
 */

/* ========================================
   REUSABLE BUTTON SYSTEM
   All buttons share the same base styling
   Colors are preserved per button type
   ======================================== */

/* Base button styling - applies to ALL buttons */
.wallet-up-translations .button,
.wallet-up-translations .button-primary,
.wallet-up-translations .button-secondary,
.wallet-up-translations .button-link-delete,
#wallet-up-translation-app .button,
#wallet-up-translation-app .button-primary,
#wallet-up-translation-app .button-secondary,
#wallet-up-translation-app .button-link-delete,
#wallet-up-translation-settings .button,
#wallet-up-translation-settings .button-primary,
#wallet-up-translation-settings .button-secondary,
#wallet-up-translation-settings .button-link-delete,
.wallet-up-translation-wrapper .button,
.wallet-up-translation-wrapper .button-primary,
.wallet-up-translation-wrapper .button-secondary,
.wallet-up-translation-wrapper .button-link-delete,
.translation-help-center .button,
.translation-help-center .button-primary,
.translation-help-center .button-secondary {
    /* Layout */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    
    /* Dimensions */
    padding: 10px 16px !important;
    min-height: 40px !important;
    
    /* Typography */
    font-size: 13px !important;
    font-weight: 450 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: 0.02em !important;
    
    /* Appearance */
    border-radius: 8px !important;
    border-width: 2px !important;
    border-style: solid !important;
    
    /* Effects */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: visible !important;
    
    /* Prevent text selection */
    user-select: none !important;
    -webkit-user-select: none !important;
    
    /* Box model for responsiveness */
    box-sizing: border-box !important;
    width: auto !important;
    min-width: fit-content !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* Icon styling inside buttons */
.wallet-up-translations .button .dashicons,
.wallet-up-translations .button-primary .dashicons,
.wallet-up-translations .button-secondary .dashicons,
#wallet-up-translation-app .button .dashicons,
#wallet-up-translation-app .button-primary .dashicons,
#wallet-up-translation-app .button-secondary .dashicons,
#wallet-up-translation-settings .button .dashicons,
#wallet-up-translation-settings .button-primary .dashicons,
#wallet-up-translation-settings .button-secondary .dashicons,
.wallet-up-translation-wrapper .button .dashicons,
.wallet-up-translation-wrapper .button-primary .dashicons,
.wallet-up-translation-wrapper .button-secondary .dashicons,
.translation-help-center .button .dashicons,
.translation-help-center .button-primary .dashicons,
.translation-help-center .button-secondary .dashicons {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

/* Hover state for all buttons */
.wallet-up-translations .button:hover,
.wallet-up-translations .button-primary:hover,
.wallet-up-translations .button-secondary:hover,
.wallet-up-translations .button-link-delete:hover,
#wallet-up-translation-app .button:hover,
#wallet-up-translation-app .button-primary:hover,
#wallet-up-translation-app .button-secondary:hover,
#wallet-up-translation-app .button-link-delete:hover,
#wallet-up-translation-settings .button:hover,
#wallet-up-translation-settings .button-primary:hover,
#wallet-up-translation-settings .button-secondary:hover,
#wallet-up-translation-settings .button-link-delete:hover,
.wallet-up-translation-wrapper .button:hover,
.wallet-up-translation-wrapper .button-primary:hover,
.wallet-up-translation-wrapper .button-secondary:hover,
.wallet-up-translation-wrapper .button-link-delete:hover,
.translation-help-center .button:hover,
.translation-help-center .button-primary:hover,
.translation-help-center .button-secondary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

/* Active/pressed state for all buttons */
.wallet-up-translations .button:active,
.wallet-up-translations .button-primary:active,
.wallet-up-translations .button-secondary:active,
#wallet-up-translation-app .button:active,
#wallet-up-translation-app .button-primary:active,
#wallet-up-translation-app .button-secondary:active,
#wallet-up-translation-settings .button:active,
#wallet-up-translation-settings .button-primary:active,
#wallet-up-translation-settings .button-secondary:active,
.wallet-up-translation-wrapper .button:active,
.wallet-up-translation-wrapper .button-primary:active,
.wallet-up-translation-wrapper .button-secondary:active,
.translation-help-center .button:active,
.translation-help-center .button-primary:active,
.translation-help-center .button-secondary:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

/* Focus state for accessibility */
.wallet-up-translations .button:focus,
.wallet-up-translations .button-primary:focus,
.wallet-up-translations .button-secondary:focus,
#wallet-up-translation-app .button:focus,
#wallet-up-translation-app .button-primary:focus,
#wallet-up-translation-app .button-secondary:focus,
#wallet-up-translation-settings .button:focus,
#wallet-up-translation-settings .button-primary:focus,
#wallet-up-translation-settings .button-secondary:focus,
.wallet-up-translation-wrapper .button:focus,
.wallet-up-translation-wrapper .button-primary:focus,
.wallet-up-translation-wrapper .button-secondary:focus,
.translation-help-center .button:focus,
.translation-help-center .button-primary:focus,
.translation-help-center .button-secondary:focus {
    outline: 2px solid rgba(103, 79, 191, 0.4) !important;
    outline-offset: 2px !important;
}

/* Disabled state */
.wallet-up-translations .button:disabled,
.wallet-up-translations .button-primary:disabled,
.wallet-up-translations .button-secondary:disabled,
#wallet-up-translation-app .button:disabled,
#wallet-up-translation-app .button-primary:disabled,
#wallet-up-translation-app .button-secondary:disabled,
#wallet-up-translation-settings .button:disabled,
#wallet-up-translation-settings .button-primary:disabled,
#wallet-up-translation-settings .button-secondary:disabled,
.wallet-up-translation-wrapper .button:disabled,
.wallet-up-translation-wrapper .button-primary:disabled,
.wallet-up-translation-wrapper .button-secondary:disabled,
.translation-help-center .button:disabled,
.translation-help-center .button-primary:disabled,
.translation-help-center .button-secondary:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ========================================
   BUTTON COLOR VARIANTS
   Each preserves its unique color scheme
   ======================================== */

/* Default button */
.wallet-up-translations .button,
#wallet-up-translation-app .button,
#wallet-up-translation-settings .button,
.wallet-up-translation-wrapper .button,
.translation-help-center .button {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

.wallet-up-translations .button:hover,
#wallet-up-translation-app .button:hover,
#wallet-up-translation-settings .button:hover,
.wallet-up-translation-wrapper .button:hover,
.translation-help-center .button:hover {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

/* Primary button */
.wallet-up-translations .button-primary,
#wallet-up-translation-app .button-primary,
#wallet-up-translation-settings .button-primary,
.wallet-up-translation-wrapper .button-primary,
.translation-help-center .button-primary {
    background: linear-gradient(135deg, #674FBF 0%, #5a449f 100%) !important;
    border-color: #674FBF !important;
    color: white !important;
}

.wallet-up-translations .button-primary:hover,
#wallet-up-translation-app .button-primary:hover,
#wallet-up-translation-settings .button-primary:hover,
.wallet-up-translation-wrapper .button-primary:hover,
.translation-help-center .button-primary:hover {
    background: linear-gradient(135deg, #5a449f 0%, #4d3a85 100%) !important;
    border-color: #5a449f !important;
    color: white !important;
}

/* Secondary button */
.wallet-up-translations .button-secondary,
#wallet-up-translation-app .button-secondary,
#wallet-up-translation-settings .button-secondary,
.wallet-up-translation-wrapper .button-secondary,
.translation-help-center .button-secondary {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

.wallet-up-translations .button-secondary:hover,
#wallet-up-translation-app .button-secondary:hover,
#wallet-up-translation-settings .button-secondary:hover,
.wallet-up-translation-wrapper .button-secondary:hover,
.translation-help-center .button-secondary:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

/* Delete/danger button */
.wallet-up-translations .button-link-delete,
#wallet-up-translation-app .button-link-delete,
#wallet-up-translation-settings .button-link-delete,
.wallet-up-translation-wrapper .button-link-delete {
    background: #fff5f5 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

.wallet-up-translations .button-link-delete:hover,
#wallet-up-translation-app .button-link-delete:hover,
#wallet-up-translation-settings .button-link-delete:hover,
.wallet-up-translation-wrapper .button-link-delete:hover {
    background: #fef2f2 !important;
    border-color: #f87171 !important;
    color: #b91c1c !important;
}

/* ========================================
   BUTTON SIZE MODIFIERS
   ======================================== */

.button-large,
.button-primary.button-large,
.button-secondary.button-large {
    padding: 14px 32px !important;
    font-size: 16px !important;
    min-height: 48px !important;
}

.button-large .dashicons {
    font-size: 20px !important;
    width: 20px !important;
    height: 20px !important;
}

.button-small,
.button-primary.button-small,
.button-secondary.button-small {
    padding: 8px 16px !important;
    font-size: 13px !important;
    min-height: 32px !important;
}

.button-small .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}

/* ========================================
   SPECIAL BUTTON STATES
   ======================================== */

/* Success state */
.button-primary.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-color: #10b981 !important;
}

.button-primary.success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    border-color: #059669 !important;
}

/* Warning state */
.button.warning,
.button-secondary.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border-color: #f59e0b !important;
    color: white !important;
}

.button.warning:hover,
.button-secondary.warning:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    border-color: #d97706 !important;
    color: white !important;
}

/* Info state */
.button.info,
.button-secondary.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border-color: #3b82f6 !important;
    color: white !important;
}

.button.info:hover,
.button-secondary.info:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    border-color: #2563eb !important;
    color: white !important;
}

/* Loading state */
.button.loading,
.button-primary.loading,
.button-secondary.loading {
    pointer-events: none !important;
    opacity: 0.7 !important;
    position: relative !important;
}

.button.loading::after,
.button-primary.loading::after,
.button-secondary.loading::after {
    content: "" !important;
    position: absolute !important;
    width: 16px !important;
    height: 16px !important;
    top: 50% !important;
    left: 50% !important;
    margin-left: -8px !important;
    margin-top: -8px !important;
    border: 2px solid transparent !important;
    border-radius: 50% !important;
    border-top-color: currentColor !important;
    animation: button-spin 0.6s linear infinite !important;
}

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

/* ========================================
   SPECIAL BUTTON TYPES
   ======================================== */

/* Icon-only buttons */
.button.icon-only,
.button-primary.icon-only,
.button-secondary.icon-only {
    padding: 8px !important;
    min-width: 40px !important;
    gap: 0 !important;
}

.button.icon-only .dashicons,
.button-primary.icon-only .dashicons,
.button-secondary.icon-only .dashicons {
    margin: 0 !important;
}

/* Button groups */
.button-group {
    display: inline-flex !important;
    gap: 8px !important;
    align-items: center !important;
}

.button-group.connected {
    gap: 0 !important;
}

.button-group.connected .button {
    border-radius: 0 !important;
}

.button-group.connected .button:first-child {
    border-radius: 8px 0 0 8px !important;
}

.button-group.connected .button:last-child {
    border-radius: 0 8px 8px 0 !important;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Large screens - optimal spacing */
@media (max-width: 1400px) {
    .button-group {
        flex-wrap: wrap !important;
        row-gap: 8px !important;
    }
    
    .button-group.connected {
        flex-wrap: nowrap !important;
    }
}

/* Medium-large screens */
@media (max-width: 1200px) {
    .wallet-up-translations .button,
    .wallet-up-translations .button-primary,
    .wallet-up-translations .button-secondary,
    #wallet-up-translation-app .button,
    #wallet-up-translation-app .button-primary,
    #wallet-up-translation-app .button-secondary {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }
    
    .button-group {
        gap: 6px !important;
    }
}

/* Tablets - portrait */
@media (max-width: 992px) {
    .button,
    .button-primary,
    .button-secondary {
        padding: 10px 14px !important;
        font-size: 13px !important;
        min-height: 38px !important;
    }
    
    .button-large {
        padding: 12px 20px !important;
        font-size: 15px !important;
        min-height: 46px !important;
    }
    
    /* Make button groups stack on smaller tablets */
    .button-group:not(.connected) {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    
    .button-group:not(.connected) .button {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    .button,
    .button-primary,
    .button-secondary,
    .button-link-delete {
        padding: 12px 16px !important;
        font-size: 14px !important;
        min-height: 44px !important; /* Touch-friendly size */
        width: 100% !important;
        max-width: none !important;
    }
    
    .button-large {
        padding: 14px 20px !important;
        font-size: 15px !important;
        min-height: 48px !important;
    }
    
    .button-small {
        padding: 10px 14px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }
    
    .button .dashicons {
        font-size: 18px !important;
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Stack all button groups on mobile */
    .button-group,
    .button-group.connected {
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
    }
    
    .button-group .button,
    .button-group.connected .button {
        width: 100% !important;
        border-radius: 8px !important;
    }
    
    /* Icon-only buttons should remain smaller */
    .button.icon-only,
    .button-primary.icon-only,
    .button-secondary.icon-only {
        width: 44px !important;
        min-width: 44px !important;
        padding: 10px !important;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .button,
    .button-primary,
    .button-secondary,
    .button-link-delete {
        font-size: 15px !important; /* Slightly larger for readability */
        min-height: 46px !important;
        padding: 12px 14px !important;
        letter-spacing: 0 !important; /* Save horizontal space */
    }
    
    /* Reduce gap between buttons to save space */
    .button-group {
        gap: 8px !important;
    }
    
    /* Ensure text doesn't wrap in buttons */
    .button,
    .button-primary,
    .button-secondary {
        white-space: normal !important;
        line-height: 1.3 !important;
        min-width: 0 !important;
    }
}

/* Very small devices (iPhone SE, etc.) */
@media (max-width: 375px) {
    .button,
    .button-primary,
    .button-secondary {
        font-size: 14px !important;
        padding: 10px 12px !important;
    }
    
    .button-large {
        font-size: 15px !important;
        padding: 12px 16px !important;
    }
}

/* ========================================
   OVERRIDE WORDPRESS DEFAULTS
   ======================================== */

/* Ensure our styles take precedence */
.wp-core-ui .button,
.wp-core-ui .button-primary,
.wp-core-ui .button-secondary,
.wp-core-ui .button-large,
.wp-core-ui .button-small {
    text-shadow: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}