/* ============================================
   TK Share Buttons Popup - Main CSS
   Version: 1.1.0
   ============================================ */

/* Base Container */
.tk-share-container {
    position: relative;
    display: inline-block;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Share Trigger Button - SIMPLE VERSION */
.tk-share-trigger {
    color: #350082;
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    margin: 0;
    border: none;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    line-height: 1;
}

.tk-share-trigger span.dashicons {
    font-size: 16px;
    color: #350082;
    line-height: 1;
    width: 16px;
    height: 16px;
    margin: 0;
}

.tk-share-trigger .tk-share-label {
    font-size: 14px;
    color: #350082;
    font-weight: 500;
}

/* Popup Container - ALWAYS OPEN TO LEFT */
.tk-share-popup {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    min-width: 260px;
    width: max-content;
    position: absolute;
    z-index: 10000;
    top: 100%;
    right: 0; /* CHANGED FROM left: 0 TO right: 0 */
    margin-top: 12px;
    border-radius: 10px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    background-color: #ffffff;
    padding: 18px 20px;
    overflow: visible;
    border: 1px solid #e1e1e1;
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Popup Arrow/Triangle - MOVED TO RIGHT SIDE */
.tk-share-popup::before {
    content: '';
    position: absolute;
    top: -7px;
    right: 22px; /* CHANGED FROM left: 22px TO right: 22px */
    width: 14px;
    height: 14px;
    background: #ffffff;
    transform: rotate(45deg);
    border-left: 1px solid #e1e1e1;
    border-top: 1px solid #e1e1e1;
    z-index: -1;
}

/* Show Popup on Hover */
.tk-share-container:hover .tk-share-popup,
.tk-share-popup:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Active State for Mobile */
.tk-share-container.active .tk-share-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Individual Share Buttons */
.tk-share-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    color: #333333;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    cursor: pointer;
    text-align: left;
    line-height: 1.3;
    width: 100%;
    box-sizing: border-box;
    min-width: 110px;
}

.tk-share-btn img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.tk-share-btn span {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    flex-grow: 1;
    min-width: 0;
    padding-right: 5px;
}

/* NO HOVER EFFECTS on buttons */
.tk-share-btn:hover,
.tk-share-btn:focus {
    background-color: #ffffff;
    transform: none;
    text-decoration: none;
    border-color: #e8e8e8;
    box-shadow: none;
}

.tk-share-btn:hover img,
.tk-share-btn:focus img {
    transform: none;
}

/* All buttons look the same */
.tk-share-facebook,
.tk-share-twitter,
.tk-share-pinterest,
.tk-share-email {
    color: #333333;
    border-color: #e8e8e8;
}

/* ============================================
   LEFT SIDE POPUP ADJUSTMENT (When doesn't fit on right)
   ============================================ */

.tk-share-container.tk-popup-left .tk-share-popup {
    right: auto;
    left: 0; /* Move to left when right doesn't fit */
}

.tk-share-container.tk-popup-left .tk-share-popup::before {
    right: auto;
    left: 22px; /* Move arrow to left */
}

.tk-share-container.tk-popup-center .tk-share-popup {
    right: 50%;
    transform: translateX(50%) translateY(-10px); /* Changed for right alignment */
}

.tk-share-container.tk-popup-center .tk-share-popup::before {
    right: 50%;
    transform: translateX(50%) rotate(45deg);
}

.tk-share-container.tk-popup-center:hover .tk-share-popup,
.tk-share-container.tk-popup-center:focus-within .tk-share-popup,
.tk-share-container.tk-popup-center.active .tk-share-popup {
    transform: translateX(50%) translateY(0);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .tk-share-trigger {
        font-size: 15px;
        gap: 6px;
    }
    
    .tk-share-trigger span.dashicons {
        font-size: 18px;
        width: 18px;
        height: 18px;
    }
    
    .tk-share-trigger .tk-share-label {
        font-size: 15px;
    }
    
    .tk-share-popup {
        min-width: 240px;
        padding: 16px 18px;
        gap: 9px;
    }
    
    .tk-share-btn {
        padding: 11px 14px;
        font-size: 13.5px;
        gap: 11px;
        min-width: 105px;
    }
}

/* Mobile - Always Center on Mobile */
@media (max-width: 768px) {
    .tk-share-container {
        width: 100%;
        text-align: center;
    }
    
    .tk-share-popup {
        min-width: 220px;
        right: 50%;
        transform: translateX(50%) translateY(-10px);
        padding: 16px;
    }
    
    .tk-share-popup::before {
        right: 50%;
        transform: translateX(50%) rotate(45deg);
    }
    
    .tk-share-container:hover .tk-share-popup,
    .tk-share-container:focus-within .tk-share-popup,
    .tk-share-container.active .tk-share-popup {
        transform: translateX(50%) translateY(0);
    }
    
    .tk-share-btn {
        padding: 11px 13px;
        font-size: 13px;
        gap: 10px;
        min-width: 100px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .tk-share-popup {
        min-width: 200px;
        padding: 14px;
        grid-template-columns: 1fr;
        width: auto;
    }
    
    .tk-share-btn {
        padding: 12px 15px;
        font-size: 13px;
        gap: 12px;
        justify-content: flex-start;
        min-width: 0;
    }
    
    .tk-share-btn img {
        width: 22px;
        height: 22px;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .tk-share-popup {
        min-width: 180px;
        padding: 12px;
    }
    
    .tk-share-btn {
        padding: 10px 12px;
        font-size: 12px;
        gap: 10px;
    }
    
    .tk-share-btn img {
        width: 20px;
        height: 20px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.tk-share-trigger:focus-visible {
    outline: 2px solid #350082;
    outline-offset: 2px;
    border-radius: 3px;
}

.tk-share-btn:focus-visible {
    outline: 2px solid #350082;
    outline-offset: 2px;
}

/* ============================================
   TOUCH DEVICE SUPPORT
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .tk-share-btn {
        padding: 14px 15px;
        min-height: 50px;
    }
    
    .tk-share-container:hover .tk-share-popup:not(.active) {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        pointer-events: none;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes tkShareFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tk-share-popup {
    animation: tkShareFadeIn 0.3s ease forwards;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .tk-share-container {
        display: none !important;
    }
}