/**
 * Vape OS Button Fixes
 * Comprehensive button styling for all button elements
 * Version: 1.0.0
 */

/* ============================================
   GLOBAL BUTTON RESET & BASE STYLES
   ============================================ */

/* Apply to ALL button-like elements */
button,
.button,
.btn,
[type="button"],
[type="submit"],
[type="reset"],
a.button,
a.btn,
input[type="button"],
input[type="submit"] {
    /* Reset */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    margin: 0;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
    user-select: none;
    
    /* Base styling */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    
    /* Default glass style */
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    /* Minimum touch target */
    min-height: 44px;
    min-width: 44px;
}

/* Hover state for all buttons */
button:hover,
.button:hover,
.btn:hover,
[type="button"]:hover,
[type="submit"]:hover,
[type="reset"]:hover,
a.button:hover,
a.btn:hover,
input[type="button"]:hover,
input[type="submit"]:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Active state */
button:active,
.button:active,
.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   BUTTON VARIANTS
   ============================================ */

/* Primary buttons */
.btn-primary,
.button-primary,
button.primary,
[type="submit"],
.wp-block-button__link,
.visit-store {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover,
.button-primary:hover,
button.primary:hover,
[type="submit"]:hover,
.wp-block-button__link:hover,
.visit-store:hover {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
    transform: translateY(-3px);
}

/* Success/Green buttons */
.btn-success,
.button-success,
button.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-success:hover,
.button-success:hover,
button.success:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5);
}

/* Secondary/Glass buttons */
.btn-secondary,
.button-secondary,
button.secondary,
.filter-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-secondary:hover,
.button-secondary:hover,
button.secondary:hover,
.filter-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #a78bfa;
    color: #a78bfa;
}

/* Ghost buttons */
.btn-ghost,
.button-ghost,
button.ghost,
.view-terms {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.btn-ghost:hover,
.button-ghost:hover,
button.ghost:hover,
.view-terms:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* ============================================
   SPECIFIC BUTTON STYLES
   ============================================ */

/* Copy code button */
.copy-code {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
    border-radius: 8px;
}

.copy-code:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.copy-code.copied {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* View terms button */
.view-terms {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: normal;
    min-height: 36px;
}

/* Close button (X) */
.close-terms,
.modal-close,
button.close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.close-terms:hover,
.modal-close:hover,
button.close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: rotate(90deg);
}

/* Filter buttons */
.filter-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.875rem;
}

.filter-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border-color: #8b5cf6;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

/* Icon buttons */
.btn-icon,
.button-icon,
button.icon-only {
    width: 44px;
    height: 44px;
    padding: 0;
    min-width: 44px;
}

/* ============================================
   BUTTON SIZES
   ============================================ */

/* Small */
.btn-sm,
.button-sm,
button.small {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    min-height: 36px;
}

/* Large */
.btn-lg,
.button-lg,
button.large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-height: 56px;
}

/* Block (full width) */
.btn-block,
.button-block,
button.block {
    width: 100%;
    display: flex;
}

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

/* Disabled */
button:disabled,
.button:disabled,
.btn:disabled,
button.disabled,
.button.disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading */
button.loading,
.button.loading,
.btn.loading {
    color: transparent;
    pointer-events: none;
}

button.loading::after,
.button.loading::after,
.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Focus */
button:focus-visible,
.button:focus-visible,
.btn:focus-visible {
    outline: 2px solid #a78bfa;
    outline-offset: 2px;
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

/* Ripple effect */
button::before,
.button::before,
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before,
.button:hover::before,
.btn:hover::before {
    width: 300px;
    height: 300px;
}

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

@media (max-width: 768px) {
    button,
    .button,
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
    
    .btn-lg,
    .button-lg,
    button.large {
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }
}

/* ============================================
   FIXES FOR SPECIFIC ELEMENTS
   ============================================ */

/* WordPress block buttons */
.wp-block-button .wp-block-button__link {
    text-decoration: none;
}

/* Menu items should not be styled as buttons */
.dashboard-menu a,
.menu-item a,
nav a {
    all: revert;
    /* Re-apply their specific styles */
}

/* Form submit buttons */
.wpcf7-submit,
.wpforms-submit,
.gform_button {
    font-family: inherit;
}

/* Navigation buttons in forms */
.nav-buttons .btn {
    min-width: 120px;
}

/* ============================================
   UTILITIES
   ============================================ */

/* Remove all button styling */
.btn-unstyled,
.button-unstyled,
button.unstyled {
    all: unset;
    cursor: pointer;
}

/* Button groups */
.btn-group {
    display: inline-flex;
    gap: 0;
}

.btn-group > * {
    border-radius: 0;
}

.btn-group > *:first-child {
    border-radius: 12px 0 0 12px;
}

.btn-group > *:last-child {
    border-radius: 0 12px 12px 0;
}

/* Floating action button */
.btn-fab,
.button-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}