/**
 * Content Publicity Plugin - Frontend Styles
 * Enhanced version with Super Suggest and Floating Share Bar
 * FIXED: Red heart button with white/black floating bar design
 * 
 * @package Content Publicity
 * @version 1.1.1
 */

/* ==========================================================================
   Main Share/Embed Button Styles
   ========================================================================== */

.cp-button-wrap { 
    margin: 20px 0; 
    clear: both; 
    text-align: left; 
}

.cp-share-embed-button, 
a.cp-share-embed-button {
    display: inline-block;
    padding: 10px 18px;
    background-color: #000000 !important; 
    color: #FFFFFF !important; 
    text-decoration: none !important;
    border: 1px solid #FFFFFF !important; 
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px; 
    font-weight: 700; 
    line-height: 1.5;
    transition: opacity 0.2s ease-in-out;
    box-sizing: border-box;
    vertical-align: middle; 
}

.cp-share-embed-button:hover,
.cp-share-embed-button:focus,
a.cp-share-embed-button:hover,
a.cp-share-embed-button:focus {
    background-color: #000000 !important; 
    color: #FFFFFF !important; 
    border-color: #FFFFFF !important; 
    opacity: 0.85; 
    outline: none;
    text-decoration: none !important;
}

.cp-share-embed-button .dashicons, 
a.cp-share-embed-button .dashicons {
    font-size: 1.2em; 
    line-height: inherit; 
    vertical-align: -2px; 
    margin-right: 0.5em; 
    color: #FFFFFF !important; 
}

.cp-share-embed-button.cp-icon-only .cp-button-text, 
a.cp-share-embed-button.cp-icon-only .cp-button-text {
    position: absolute;
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.cp-share-embed-button.cp-icon-only .dashicons, 
a.cp-share-embed-button.cp-icon-only .dashicons {
    margin-right: 0;
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.cp-modal { 
    display: none; 
    position: fixed; 
    z-index: 100001; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    overflow-y: auto; 
    background-color: rgba(0,0,0,0.7); 
    -webkit-overflow-scrolling: touch; 
}

.cp-modal-content { 
    background-color: #ffffff; 
    margin: 5% auto; 
    padding: 20px; 
    border: none; 
    width: 90%; 
    max-width: 500px; 
    border-radius: 6px; 
    position: relative; 
    box-shadow: 0 5px 25px rgba(0,0,0,.35); 
    text-align: left; 
    box-sizing: border-box;
    overflow-x: hidden; 
}

.cp-close-button { 
    color: #999; 
    position: absolute; 
    right: 15px; 
    top: 10px; 
    font-size: 30px; 
    font-weight: bold; 
    line-height: 1; 
    cursor: pointer; 
    text-decoration: none; 
}

.cp-close-button:hover, 
.cp-close-button:focus { 
    color: #333; 
    text-decoration: none; 
}

.cp-modal h3 { 
    margin-top: 0; 
    font-size: 20px; 
    margin-bottom: 15px; 
    color: #333; 
    overflow-wrap: break-word; 
    word-wrap: break-word; 
}

.cp-modal h4 { 
    font-size: 16px; 
    margin-top: 20px; 
    margin-bottom: 10px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 5px; 
    color: #444; 
    overflow-wrap: break-word; 
    word-wrap: break-word;
}

/* ==========================================================================
   Super Suggest Styles (MODAL VERSION)
   ========================================================================== */

.cp-super-suggest { 
    margin-bottom: 25px; 
    padding: 15px; 
    border: 2px solid #dc143c; 
    border-radius: 6px; 
    background-color: #fef7f7; 
}

.cp-super-suggest h4 { 
    margin-top: 0; 
    margin-bottom: 8px; 
    color: #dc143c; 
    border: none; 
    padding: 0; 
    font-size: 16px; 
}

.cp-super-suggest p { 
    margin: 8px 0; 
    font-size: 14px; 
    color: #555; 
    line-height: 1.4; 
}

.cp-super-suggest-btn { 
    display: inline-block; 
    padding: 10px 20px; 
    background-color: #dc143c; 
    color: white; 
    text-decoration: none; 
    border-radius: 4px; 
    font-weight: 600; 
    transition: background-color 0.2s ease; 
}

.cp-super-suggest-btn:hover, 
.cp-super-suggest-btn:focus { 
    background-color: #b8122e; 
    color: white; 
    text-decoration: none; 
}

/* ==========================================================================
   Social Icons Container - Default (Desktop/Tablet)
   ========================================================================== */

.cp-social-icons { 
    margin-bottom: 20px; 
    display: flex; 
    flex-direction: row; 
    flex-wrap: wrap; 
    gap: 8px; 
}

.cp-social-icons a { 
    text-decoration: none; 
    display: flex;
    align-items: center; 
    justify-content: center; 
    padding: 8px 10px; 
    border-radius:4px; 
    color: #333; 
    background-color: #f0f0f0; 
    transition: background-color 0.2s ease;
    flex-grow: 1; 
    flex-shrink: 1; 
    flex-basis: calc(50% - 4px);
    min-width: 100px;
    box-sizing: border-box;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-social-icons a .dashicons { 
    font-size: 20px; 
    width: 20px; 
    height: 20px; 
    margin-right: 6px; 
    vertical-align: middle; 
    flex-shrink: 0;
}

.cp-social-icons a span:not(.dashicons) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
}

.cp-social-icons a:hover { 
    background-color: #e0e0e0; 
}

/* ==========================================================================
   Email Section Styles (REPOSITIONED FEATURE)
   ========================================================================== */

.cp-email-section { 
    border-top: 1px solid #eee; 
    padding-top: 15px; 
    margin-top: 20px; 
}

.cp-email-section h4 { 
    margin-top: 0; 
    margin-bottom: 10px; 
    border: none; 
    padding: 0; 
}

.cp-email-btn { 
    display: inline-block; 
    padding: 8px 15px; 
    background-color: #0073aa; 
    color: white; 
    text-decoration: none; 
    border-radius: 3px; 
    transition: background-color 0.2s ease; 
}

.cp-email-btn:hover, 
.cp-email-btn:focus { 
    background-color: #005a87; 
    color: white; 
    text-decoration: none; 
}

.cp-email-btn .dashicons { 
    margin-right: 5px; 
    vertical-align: middle; 
}

/* ==========================================================================
   Embed Code Styles
   ========================================================================== */

.cp-embed-code-area { 
    width: 100%; 
    min-height: 120px; 
    margin-top: 10px; 
    font-family: Consolas, Monaco, monospace; 
    font-size: 13px; 
    padding: 10px; 
    box-sizing: border-box; 
    border: 1px solid #ccc; 
    border-radius: 3px; 
    background-color: #f9f9f9; 
    color: #333; 
}

.cp-copy-button { 
    margin-top: 10px; 
    padding: 8px 15px; 
    background-color: #0073aa; 
    color: white; 
    border: none; 
    border-radius: 3px; 
    cursor: pointer; 
    font-size: 14px; 
    transition: background-color 0.2s ease; 
}

.cp-copy-button:hover { 
    background-color: #005a87; 
}

.cp-modal-credit { 
    font-size: 0.85em; 
    color: #777; 
    margin-top: 20px; 
    text-align: right; 
}

.cp-modal-credit a { 
    color: #555; 
    text-decoration: none; 
}

.cp-modal-credit a:hover { 
    text-decoration: underline; 
}

/* ==========================================================================
   Floating Share Bar Styles (FIXED VERSION - White/Black with Shine)
   ========================================================================== */

.cp-floating-share-bar {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #ffffff 100%);
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 3px 10px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.cp-floating-share-bar::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.2) 100%);
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.cp-floating-share-bar a {
    display: block;
    width: 48px;
    height: 48px;
    text-align: center;
    line-height: 48px;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    margin: 0 4px;
}

.cp-floating-share-bar a:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cp-floating-share-bar a .dashicons {
    font-size: 20px;
    line-height: 48px;
}

/* ==========================================================================
   FIXED: Red Heart Super Suggest Button (FLOATING BAR) - No Blue Background!
   ========================================================================== */

.cp-floating-share-bar .cp-super-suggest-float {
    background: #ffffff;
    color: #dc143c;
    font-weight: bold;
    font-size: 20px;
    line-height: 48px;
    text-align: center;
    border-radius: 8px;
    border: 2px solid #dc143c;
    box-shadow: 
        0 2px 8px rgba(220, 20, 60, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.cp-floating-share-bar .cp-super-suggest-float::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(220, 20, 60, 0.1), transparent);
    transition: left 0.5s ease;
}

.cp-floating-share-bar .cp-super-suggest-float:hover {
    background: #ffffff;
    color: #dc143c;
    transform: translateX(4px) scale(1.05);
    box-shadow: 
        0 4px 12px rgba(220, 20, 60, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: #dc143c;
}

.cp-floating-share-bar .cp-super-suggest-float:hover::before {
    left: 100%;
}

.cp-floating-share-bar .cp-super-suggest-float:active {
    transform: translateX(2px) scale(0.98);
    box-shadow: 0 2px 6px rgba(220, 20, 60, 0.2);
}

/* ==========================================================================
   Tooltip Styles (ENHANCED VERSION - Single Message)
   ========================================================================== */

.cp-floating-share-bar a[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cp-floating-share-bar a[title]:hover::before {
    content: '';
    position: absolute;
    left: 52px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    pointer-events: none;
}

/* ==========================================================================
   Animation Enhancements
   ========================================================================== */

@keyframes cp-float-in {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.cp-floating-share-bar {
    animation: cp-float-in 0.4s ease-out 0.5s both;
}

@keyframes cp-pulse-heart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.cp-floating-share-bar .cp-super-suggest-float:hover {
    animation: cp-pulse-heart 1s ease-in-out infinite;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */

@media screen and (max-width: 768px) {
    .cp-floating-share-bar {
        display: none; /* Hide floating bar on mobile */
    }
}

@media screen and (max-width: 600px) {
    .cp-modal-content {
        width: auto;
        margin-left: 10px;
        margin-right: 10px;
        max-width: 100%;
        padding: 15px; 
    }
    
    .cp-social-icons {
        flex-direction: column;
        gap: 10px; 
    }
    
    .cp-social-icons a {
        flex-basis: auto;
        width: 100%;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
        padding: 12px 8px;
    }
    
    .cp-social-icons a span:not(.dashicons) {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    .cp-super-suggest {
        padding: 12px;
        margin-bottom: 20px;
    }

    .cp-super-suggest h4 {
        font-size: 15px;
    }

    .cp-super-suggest p {
        font-size: 13px;
    }

    .cp-super-suggest-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* ==========================================================================
   High DPI / Retina Display Support
   ========================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .cp-floating-share-bar {
        background-size: 200% 200%;
    }
}

/* ==========================================================================
   Print Styles (Hide floating elements)
   ========================================================================== */

@media print {
    .cp-floating-share-bar,
    .cp-modal {
        display: none !important;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .cp-floating-share-bar,
    .cp-floating-share-bar a,
    .cp-super-suggest-float {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus styles for keyboard navigation */
.cp-floating-share-bar a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.cp-floating-share-bar .cp-super-suggest-float:focus {
    outline: 2px solid #dc143c;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .cp-floating-share-bar {
        background: #ffffff;
        border: 3px solid #000000;
    }
    
    .cp-floating-share-bar .cp-super-suggest-float {
        background: #ffffff;
        color: #dc143c;
        border: 3px solid #dc143c;
    }
}

/* ==========================================================================
   1.2.0 additions — SVG brand icons, share counter badge, copy-link flash
   ========================================================================== */

/* Bundled inline SVG icons (WhatsApp, Pinterest, Bluesky, Threads, Mastodon, etc.) */
.cp-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
    flex-shrink: 0;
}

.cp-floating-share-bar .cp-icon {
    width: 20px;
    height: 20px;
    color: #666;
    transition: color 0.2s ease;
}

.cp-floating-share-bar a:hover .cp-icon,
.cp-floating-share-bar a:focus .cp-icon {
    color: #1d2327;
}

/* Modal share link with icon + label + optional count */
.cp-social-icons .cp-share-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 4px;
    color: #333;
    background-color: #f0f0f0;
    border: 0;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: background-color 0.2s ease;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: calc(50% - 4px);
    min-width: 100px;
    box-sizing: border-box;
    text-align: center;
}

.cp-social-icons .cp-share-link:hover,
.cp-social-icons .cp-share-link:focus {
    background-color: #e0e0e0;
    color: #1d2327;
    text-decoration: none;
    outline: none;
}

.cp-social-icons .cp-share-link .cp-icon,
.cp-social-icons .cp-share-link .dashicons {
    margin-right: 6px;
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.cp-social-icons .cp-share-link__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
}

/* Optional share-count badge */
.cp-share-count {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    background: #fff;
    color: #50575e;
    border: 1px solid #dcdcde;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1.4;
}

/* Brief affordance after Copy Link succeeds */
.cp-share-link--flash {
    background-color: #dc143c !important;
    color: #ffffff !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cp-share-link--flash .cp-icon,
.cp-share-link--flash .dashicons {
    color: #ffffff !important;
}

/* Mobile: stack the modal share buttons vertically (already covered by
   .cp-social-icons rules above, but the new .cp-share-link element needs
   the same treatment at the narrow breakpoint). */
@media screen and (max-width: 600px) {
    .cp-social-icons .cp-share-link {
        flex-basis: auto;
        width: 100%;
        min-width: 0;
        padding: 12px 8px;
    }
}