/**
 * Coastal Pinterest Tools - Pin Button Styles
 * 
 * Mobile-first styling for hover pin buttons
 */

/* Pin Container Wrapper */
.cpt-pin-container {
    position: relative;
    display: inline-block;
    margin: 1.5em 0;
    max-width: 100%;
}

.cpt-pin-container img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Pin Button */
.cpt-pin-button {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: #E60023;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 24px;
    display: none;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(230, 0, 35, 0.4);
    transition: all 0.2s ease;
    z-index: 100;
    cursor: pointer;
}

.cpt-pin-button:hover {
    background-color: #AD081B;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(230, 0, 35, 0.6);
    color: #ffffff;
}

.cpt-pin-button:active {
    transform: scale(0.98);
}

.cpt-pin-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cpt-pin-button span {
    line-height: 1;
}

/* Show button on hover */
.cpt-pin-container:hover .cpt-pin-button {
    display: inline-flex;
}

/* Button Position Variations */
.cpt-pin-container[data-pin-position="top-left"] .cpt-pin-button {
    top: 12px;
    left: 12px;
}

.cpt-pin-container[data-pin-position="top-right"] .cpt-pin-button {
    top: 12px;
    right: 12px;
    left: auto;
}

.cpt-pin-container[data-pin-position="bottom-left"] .cpt-pin-button {
    bottom: 12px;
    left: 12px;
    top: auto;
}

.cpt-pin-container[data-pin-position="bottom-right"] .cpt-pin-button {
    bottom: 12px;
    right: 12px;
    top: auto;
    left: auto;
}

.cpt-pin-container[data-pin-position="center"] .cpt-pin-button {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.cpt-pin-container[data-pin-position="center"]:hover .cpt-pin-button {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Hidden Pinterest Image (invisible but pinnable) */
.cpt-hidden-pin-image {
    display: none !important;
    width: 1px !important;
    height: 1px !important;
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Mobile Optimization (touch devices) */
@media (max-width: 768px) {
    /* Slightly larger buttons on mobile for easier tapping */
    .cpt-pin-button {
        padding: 10px 16px;
        font-size: 15px;
        min-height: 44px; /* iOS minimum tap target */
    }
    
    .cpt-pin-button svg {
        width: 20px;
        height: 20px;
    }
    
    /* On mobile, show button always (no hover state) */
    body.cpt-mobile-enabled .cpt-pin-container .cpt-pin-button {
        display: inline-flex;
        opacity: 0.9;
    }
    
    /* Optional: Hide on mobile if setting enabled */
    body.cpt-mobile-disabled .cpt-pin-button {
        display: none !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .cpt-pin-button {
        padding: 9px 15px;
    }
}

/* Accessibility - Focus States */
.cpt-pin-button:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Loading State (when Pinterest SDK is loading) */
.cpt-pin-button.loading {
    opacity: 0.6;
    cursor: wait;
}

/* Animation for button appearance */
@keyframes cptFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cpt-pin-container:hover .cpt-pin-button {
    animation: cptFadeIn 0.2s ease;
}

/* Dark overlay on hover (optional enhancement) */
.cpt-pin-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
    pointer-events: none;
    border-radius: 4px;
}

.cpt-pin-container:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

/* Ensure button appears above overlay */
.cpt-pin-button {
    z-index: 101;
}

/* Print styles - hide pin buttons */
@media print {
    .cpt-pin-button,
    .cpt-hidden-pin-image {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cpt-pin-button {
        border: 2px solid #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .cpt-pin-button,
    .cpt-pin-container::after {
        transition: none;
    }
    
    .cpt-pin-container:hover .cpt-pin-button {
        animation: none;
    }
}
