/* Fancy Modern Tooltip System for i-Food.gr
 * Modern glassmorphism design with smooth animations
 * Supports HTML content and iframes
 */

/* Trigger link styling */
.ifood-tooltip-trigger {
    cursor: help;
    border-bottom: 2px dotted #2ecc71;
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.ifood-tooltip-trigger:hover {
    border-bottom-color: #27ae60;
    color: #27ae60;
    background: linear-gradient(to bottom, transparent 60%, rgba(46, 204, 113, 0.15) 60%);
}

/* Tooltip container */
.ifood-tooltip {
    position: fixed;
    z-index: 99999;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-width: 90vw;
}

.ifood-tooltip.visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Tooltip content wrapper - Glassmorphism effect */
.ifood-tooltip-content {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.9));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 10px 30px -5px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    position: relative;
}

/* Subtle gradient overlay */
.ifood-tooltip-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #27ae60, #2ecc71, #58d68d, #2ecc71, #27ae60);
    background-size: 200% 100%;
    animation: gradientFlow 3s ease infinite;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Header area */
.ifood-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(46, 204, 113, 0.08), transparent);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ifood-tooltip-title {
    font-family: 'iOpenSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ifood-tooltip-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

/* Close button */
.ifood-tooltip-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #7f8c8d;
    font-size: 18px;
    line-height: 1;
}

.ifood-tooltip-close:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    transform: rotate(90deg);
}

/* Body content */
.ifood-tooltip-body {
    padding: 16px;
    font-family: 'iOpenSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
    max-height: 60vh;
    overflow-y: auto;
}

/* Scrollbar styling */
.ifood-tooltip-body::-webkit-scrollbar {
    width: 6px;
}

.ifood-tooltip-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 3px;
}

.ifood-tooltip-body::-webkit-scrollbar-thumb {
    background: rgba(46, 204, 113, 0.3);
    border-radius: 3px;
}

.ifood-tooltip-body::-webkit-scrollbar-thumb:hover {
    background: rgba(46, 204, 113, 0.5);
}

/* iFrame container */
.ifood-tooltip-iframe-wrapper {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.ifood-tooltip-iframe-wrapper iframe {
    display: block;
    width: 100%;
    height: auto;
    min-height: 280px;
    border: none;
    border-radius: 8px;
}

/* Loading state for iframe */
.ifood-tooltip-iframe-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(46, 204, 113, 0.2);
    border-top-color: #2ecc71;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Arrow/Pointer */
.ifood-tooltip-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 250, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.7);
    transform: rotate(45deg);
    box-shadow: -3px -3px 10px rgba(0, 0, 0, 0.05);
}

.ifood-tooltip.arrow-top .ifood-tooltip-arrow {
    bottom: -9px;
    border-top: none;
    border-left: none;
}

.ifood-tooltip.arrow-bottom .ifood-tooltip-arrow {
    top: -9px;
    border-bottom: none;
    border-right: none;
}

/* Simple text tooltip (without header for small explanations) */
.ifood-tooltip.simple .ifood-tooltip-content {
    padding: 12px 16px;
}

.ifood-tooltip.simple .ifood-tooltip-header {
    display: none;
}

.ifood-tooltip.simple .ifood-tooltip-body {
    padding: 0;
    max-height: none;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .ifood-tooltip-content {
        background: linear-gradient(145deg, rgba(45, 55, 72, 0.95), rgba(26, 32, 44, 0.9));
        border-color: rgba(255, 255, 255, 0.1);
    }

    .ifood-tooltip-body {
        color: #e2e8f0;
    }

    .ifood-tooltip-title {
        color: #f7fafc;
    }

    .ifood-tooltip-arrow {
        background: linear-gradient(145deg, rgba(45, 55, 72, 0.95), rgba(26, 32, 44, 0.9));
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .ifood-tooltip {
        left: 10px !important;
        right: 10px !important;
        max-width: calc(100vw - 20px);
    }

    .ifood-tooltip-content {
        border-radius: 12px;
    }

    .ifood-tooltip-arrow {
        display: none;
    }

    .ifood-tooltip-body {
        max-height: 50vh;
    }

    .ifood-tooltip-iframe-wrapper iframe {
        min-height: 250px;
    }
}

/* Print styles */
@media print {
    .ifood-tooltip {
        display: none !important;
    }

    .ifood-tooltip-trigger {
        border-bottom: none;
    }
}
