/* Click Button Styles */
.click-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 16px;
    font-size: 16px;
    line-height: 1.5;
    cursor: pointer;
    border: 2px solid currentColor;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    transition: all 0.2s ease;
    font-family: inherit;
}

.click-button:hover:not([aria-disabled="true"]) {
    background: currentColor;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.click-button:active:not([aria-disabled="true"]) {
    transform: translateY(0);
}

.click-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.click-button[aria-disabled="true"] {
    cursor: default;
    opacity: 0.7;
}

.click-button .icon {
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.click-button .counter {
    font-weight: 600;
    min-width: 20px;
    text-align: left;
}



/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .click-button {
        border-color: #888;
        color: #ff8e2d;
    }
    
    .click-button:hover:not([aria-disabled="true"]) {
        background: #444;
        color: white;
        border-color: #666;
    }
}

/* Accessibility: Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .click-button,
    .click-button .icon {
        transition: none;
        animation: none;
    }
    
    .click-button:hover:not([aria-disabled="true"]) {
        transform: none;
    }
}

/* Loading state */
.click-button.click-loading {
    position: relative;
    pointer-events: none;
}

.click-button.click-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Feedback messages */
.click-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
    max-width: 280px;
}

.click-feedback-success {
    background: red;
    color: #ff8e2d;
    border: 1px solid #c3e6cb;
}

.click-feedback-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.click-feedback-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dark mode feedback */
@media (prefers-color-scheme: dark) {
    .click-feedback-success {
        background: rgba(40, 167, 69, 0.1);
        color: #ff8e2d;
        border-color: rgba(40, 167, 69, 0.3);
    }
    
    .click-feedback-error {
        background: rgba(220, 53, 69, 0.1);
        color: #ff8e2d;
        border-color: rgba(220, 53, 69, 0.3);
    }
    
    .click-feedback-info {
        background: rgba(23, 162, 184, 0.1);
        color: #ff8e2d;
        border-color: rgba(23, 162, 184, 0.3);
    }
}


.click-button:not([aria-disabled="true"]) {
    position: relative;
    overflow: hidden;
}

.click-button:not([aria-disabled="true"])::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.click-button:active:not([aria-disabled="true"])::before {
    width: 300px;
    height: 300px;
}

.click-button.clicked {
    animation: click-success 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.click-button.clicked .icon {
    animation: icon-bounce 0.6s ease;
}

@keyframes click-success {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.95);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes icon-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-4px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Particle effect on click (optional enhancement) */
.click-particles {
    position: absolute;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.click-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.8;
    animation: particle-float 0.8s ease-out forwards;
}

@keyframes particle-float {
    0% {
        opacity: 0.8;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.5);
    }
}


        min-height: 44px; /* iOS recommended minimum touch target */
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .click-button:active:not([aria-disabled="true"]) {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Improve touch feedback on mobile */
    .click-button:not([aria-disabled="true"]) {
        transition: all 0.15s ease;
    }
    
    .click-button:not([aria-disabled="true"]):active {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(0.96);
    }
    
    /* Prevent text selection on buttons */
    .click-button {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Touch device specific styles */
@media (hover: none) and (pointer: coarse) {
    .click-button {
        /* Larger touch targets for touch devices */
        padding: 16px 24px;
        margin: 4px;
    }
    
    .click-button:hover:not([aria-disabled="true"]) {
        /* Remove hover effects on touch devices */
        background: transparent;
        transform: none;
        box-shadow: none;
    }
    
    .click-button:focus {
        /* Enhanced focus for keyboard navigation on touch devices */
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .click-button {
        border-width: 1px; /* Thinner borders on high DPI */
    }
    
    .click-feedback {
        border-width: 0.5px;
    }
}

/* iOS specific optimizations */
@supports (-webkit-touch-callout: none) {
    .click-button {
        /* iOS momentum scrolling can interfere with buttons */
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent iOS bounce scrolling on button containers */
    .demo-item {
        -webkit-overflow-scrolling: touch;
    }
}

/* Touch active state for mobile */
.click-button.touch-active:not([aria-disabled="true"]) {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
    transition: all 0.1s ease;
}

@media (prefers-color-scheme: dark) {
    .click-button.touch-active:not([aria-disabled="true"]) {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .click-feedback {
        max-width: 240px;
        font-size: 13px;
        padding: 6px 10px;
    }

    .click-button {
        min-height: 44px; /* iOS recommended minimum touch target */
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    .click-button:active:not([aria-disabled="true"]) {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Improve touch feedback on mobile */
    .click-button:not([aria-disabled="true"]) {
        transition: all 0.15s ease;
    }

    .click-button:not([aria-disabled="true"]):active {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(0.96);
    }

    /* Prevent text selection on buttons */
    .click-button {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}
-e 
/* Custom theme colors */
.click-button {
    border-color: #ff8e2d;
    color: #ff8e2d;
}
.click-button:hover:not([aria-disabled="true"]) {
    background: #ff8e2d;
    color: white;
}
-e 
/* Fix button layout issues */
.click-button {
    flex: 1;
    min-width: 100px;
    text-align: center;
}
-e 
/* Fix feedback message positioning */
.click-button {
    position: relative;
}

.click-feedback {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    white-space: nowrap;
}
-e 
/* Clicked button styling */
.click-button.clicked {
    background: #ff8e2d;
    color: white;
}
-e 
.click-button.clicked:hover:not([aria-disabled="true"]) {
    background: #ff8e2d;
    color: white;
}
