/**
 * PinnerPress Image Analytics Overlay Styles
 *
 * @package    PinnerPress
 * @subpackage PinnerPress/public
 * @since      1.1.0
 */

/* Admin bar toggle styling */
#wp-admin-bar-pinnerpress-image-analytics .ab-icon {
    position: relative;
    float: left;
    width: 26px;
    height: 30px;
    margin-right: 6px;
    padding: 0;
    line-height: 30px;
    text-align: center;
}

#wp-admin-bar-pinnerpress-image-analytics .ab-icon:before {
    font-size: 20px;
    color: #a0a5aa;
    transition: color 0.2s ease;
}

#wp-admin-bar-pinnerpress-image-analytics.enabled .ab-icon:before {
    color: #46b450;
}

#wp-admin-bar-pinnerpress-image-analytics:hover .ab-icon:before {
    color: #00a0d2;
}

/* Image wrapper for analytics overlay */
.pinnerpress-analytics-image-wrapper {
    position: relative;
    display: inline-block;
}

/* Analytics badge */
.pinnerpress-analytics-badge {
    position: absolute;
    background: rgba(230, 0, 35, 0.9); /* Pinterest red */
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    pointer-events: auto;
}

/* Default position (top-right) */
.pinnerpress-analytics-badge {
    top: 10px;
    right: 10px;
}

/* Position variants */
.pinnerpress-analytics-badge.top-left {
    top: 10px;
    left: 10px;
    right: auto;
}

.pinnerpress-analytics-badge.top-right {
    top: 10px;
    right: 10px;
    left: auto;
}

.pinnerpress-analytics-badge.bottom-left {
    bottom: 10px;
    left: 10px;
    top: auto;
    right: auto;
}

.pinnerpress-analytics-badge.bottom-right {
    bottom: 10px;
    right: 10px;
    top: auto;
    left: auto;
}

.pinnerpress-analytics-badge:hover {
    background: rgba(230, 0, 35, 1);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Analytics details popup */
.pinnerpress-analytics-details {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Default positioning for details popup (top-right badge) */
.pinnerpress-analytics-details {
    top: 100%;
    right: 0;
    margin-top: 5px;
    transform: translateY(-10px);
}

/* Position details popup based on badge position */
.pinnerpress-analytics-badge.top-left + .pinnerpress-analytics-details {
    top: 100%;
    left: 0;
    right: auto;
    margin-top: 5px;
    transform: translateY(-10px);
}

.pinnerpress-analytics-badge.top-right + .pinnerpress-analytics-details {
    top: 100%;
    right: 0;
    left: auto;
    margin-top: 5px;
    transform: translateY(-10px);
}

.pinnerpress-analytics-badge.bottom-left + .pinnerpress-analytics-details {
    bottom: 100%;
    left: 0;
    right: auto;
    top: auto;
    margin-top: 0;
    margin-bottom: 5px;
    transform: translateY(10px);
}

.pinnerpress-analytics-badge.bottom-right + .pinnerpress-analytics-details {
    bottom: 100%;
    right: 0;
    left: auto;
    top: auto;
    margin-top: 0;
    margin-bottom: 5px;
    transform: translateY(10px);
}

.pinnerpress-analytics-badge:hover + .pinnerpress-analytics-details,
.pinnerpress-analytics-details:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Analytics details content */
.pinnerpress-analytics-details h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
    font-weight: 600;
    border-bottom: 2px solid #E60023;
    padding-bottom: 5px;
}

.pinnerpress-analytics-details .pinnerpress-analytics-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    font-size: 13px;
    color: #555;
}

.pinnerpress-analytics-details .pinnerpress-analytics-stat-label {
    font-weight: 500;
}

.pinnerpress-analytics-details .pinnerpress-analytics-stat-value {
    font-weight: 700;
    color: #E60023;
}

/* Loading state */
.pinnerpress-analytics-loading {
    display: inline-block;
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(230, 0, 35, 0.3);
    border-radius: 50%;
    border-top-color: #E60023;
    animation: pinnerpress-spin 1s ease-in-out infinite;
}

/* Default loading position */
.pinnerpress-analytics-loading {
    top: 10px;
    right: 10px;
}

/* Loading position variants */
.pinnerpress-analytics-loading.top-left {
    top: 10px;
    left: 10px;
    right: auto;
}

.pinnerpress-analytics-loading.top-right {
    top: 10px;
    right: 10px;
    left: auto;
}

.pinnerpress-analytics-loading.bottom-left {
    bottom: 10px;
    left: 10px;
    top: auto;
    right: auto;
}

.pinnerpress-analytics-loading.bottom-right {
    bottom: 10px;
    right: 10px;
    top: auto;
    left: auto;
}

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

/* No data state */
.pinnerpress-analytics-no-data {
    position: absolute;
    background: rgba(128, 128, 128, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-style: italic;
}

/* Default no-data position */
.pinnerpress-analytics-no-data {
    top: 10px;
    right: 10px;
}

/* No-data position variants */
.pinnerpress-analytics-no-data.top-left {
    top: 10px;
    left: 10px;
    right: auto;
}

.pinnerpress-analytics-no-data.top-right {
    top: 10px;
    right: 10px;
    left: auto;
}

.pinnerpress-analytics-no-data.bottom-left {
    bottom: 10px;
    left: 10px;
    top: auto;
    right: auto;
}

.pinnerpress-analytics-no-data.bottom-right {
    bottom: 10px;
    right: 10px;
    top: auto;
    left: auto;
}

/* Error state */
.pinnerpress-analytics-error {
    position: absolute;
    background: rgba(220, 50, 47, 0.9);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Default error position */
.pinnerpress-analytics-error {
    top: 10px;
    right: 10px;
}

/* Error position variants */
.pinnerpress-analytics-error.top-left {
    top: 10px;
    left: 10px;
    right: auto;
}

.pinnerpress-analytics-error.top-right {
    top: 10px;
    right: 10px;
    left: auto;
}

.pinnerpress-analytics-error.bottom-left {
    bottom: 10px;
    left: 10px;
    top: auto;
    right: auto;
}

.pinnerpress-analytics-error.bottom-right {
    bottom: 10px;
    right: 10px;
    top: auto;
    left: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .pinnerpress-analytics-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .pinnerpress-analytics-details {
        min-width: 180px;
        padding: 12px;
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(-10px);
    }
    
    .pinnerpress-analytics-badge:hover + .pinnerpress-analytics-details,
    .pinnerpress-analytics-details:hover {
        transform: translateX(-50%) translateY(0);
    }
}

/* Hover effect for wrapped images */
.pinnerpress-analytics-image-wrapper img {
    transition: opacity 0.3s ease;
}

.pinnerpress-analytics-image-wrapper:hover img {
    opacity: 0.95;
}

/* Analytics Modal Styles */
.pinnerpress-analytics-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.pinnerpress-analytics-modal.show {
    opacity: 1;
    visibility: visible;
}

.pinnerpress-analytics-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: -1;
}

.pinnerpress-analytics-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.pinnerpress-analytics-modal.show .pinnerpress-analytics-modal-content {
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.pinnerpress-analytics-modal-header {
    padding: 20px 25px 15px;
    border-bottom: 2px solid #E60023;
    background: linear-gradient(135deg, #E60023 0%, #bd081c 100%);
    color: white;
    position: relative;
}

.pinnerpress-analytics-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.pinnerpress-analytics-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 5px;
    border-radius: 50%;
}

.pinnerpress-analytics-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Modal Body */
.pinnerpress-analytics-modal-body {
    padding: 25px;
}

.pinnerpress-analytics-modal-stat-grid {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: space-between;
}

.pinnerpress-analytics-modal-stat-card {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 18px 12px;
    text-align: center;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    min-width: 0;
}

.pinnerpress-analytics-modal-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    background: #f0f0f0;
}

.pinnerpress-analytics-modal-stat-card.total {
    background: #f8f8f8;
    border-color: #d0d0d0;
}

.pinnerpress-analytics-modal-stat-card.pin {
    background: #f8f8f8;
    border-color: #d0d0d0;
}

.pinnerpress-analytics-modal-stat-card.banner {
    background: #f8f8f8;
    border-color: #d0d0d0;
}

.pinnerpress-analytics-modal-stat-card .stat-number {
    font-size: 28px;
    font-weight: 700;
    color: #555;
    margin-bottom: 5px;
    line-height: 1;
}

.pinnerpress-analytics-modal-stat-card.total .stat-number {
    color: #333;
}

.pinnerpress-analytics-modal-stat-card.pin .stat-number {
    color: #555;
}

.pinnerpress-analytics-modal-stat-card.banner .stat-number {
    color: #555;
}

.pinnerpress-analytics-modal-stat-card .stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin-bottom: 5px;
}

.pinnerpress-analytics-modal-stat-card .stat-percentage {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    background: rgba(255, 255, 255, 0.6);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 5px;
}

/* Timeline Section */
.pinnerpress-analytics-modal-timeline {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #E60023;
}

.pinnerpress-analytics-modal-timeline h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.pinnerpress-analytics-modal-timeline p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.pinnerpress-analytics-modal-timeline strong {
    color: #E60023;
    font-weight: 600;
}

/* Modal Footer */
.pinnerpress-analytics-modal-footer {
    padding: 15px 25px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.pinnerpress-analytics-modal-footer small {
    color: #999;
    font-size: 12px;
}

/* Responsive Design */
@media (max-width: 600px) {
    .pinnerpress-analytics-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .pinnerpress-analytics-modal-header {
        padding: 15px 20px 10px;
    }
    
    .pinnerpress-analytics-modal-header h3 {
        font-size: 16px;
    }
    
    .pinnerpress-analytics-modal-body {
        padding: 20px;
    }
    
    .pinnerpress-analytics-modal-stat-grid {
        flex-direction: column;
        gap: 12px;
    }
    
    .pinnerpress-analytics-modal-stat-card {
        padding: 15px 10px;
    }
    
    .pinnerpress-analytics-modal-stat-card .stat-number {
        font-size: 24px;
    }
} 