/* Contextual Help Tooltips with Jewelry Styling Tips - CSS */

/* Tooltip Container */
.jewelry-tooltip-container {
    position: fixed;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-width: 400px;
    width: auto;
    min-width: 280px;
}

.jewelry-tooltip-container.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Tooltip Content */
.jewelry-tooltip-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04),
                0 0 0 1px rgba(5, 150, 105, 0.1);
    overflow: hidden;
    backdrop-filter: blur(8px);
    position: relative;
}

.jewelry-tooltip-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #059669, #10b981, #34d399);
}

/* Tooltip Header */
.jewelry-tooltip-header {
    padding: 16px 20px 12px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfdf5 100%);
    border-bottom: 1px solid #d1fae5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.jewelry-tooltip-title {
    font-weight: 600;
    font-size: 14px;
    color: #064e3b;
    display: flex;
    align-items: center;
}

.jewelry-tooltip-title::before {
    content: '💎';
    margin-right: 8px;
    font-size: 16px;
}

.jewelry-tooltip-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.jewelry-tooltip-close:hover {
    background: #f3f4f6;
    color: #374151;
    transform: scale(1.1);
}

.jewelry-tooltip-close:focus {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

/* Tooltip Body */
.jewelry-tooltip-body {
    padding: 16px 20px;
    color: #374151;
    line-height: 1.6;
    font-size: 13px;
}

.jewelry-tooltip-body p {
    margin: 0 0 12px 0;
}

.jewelry-tooltip-body p:last-child {
    margin-bottom: 0;
}

.jewelry-tooltip-body ul {
    margin: 8px 0;
    padding-left: 0;
}

.jewelry-tooltip-body li {
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
}

.jewelry-tooltip-body .grid {
    gap: 8px;
}

.jewelry-tooltip-body .space-y-1 > * + * {
    margin-top: 4px;
}

.jewelry-tooltip-body .space-y-2 > * + * {
    margin-top: 8px;
}

.jewelry-tooltip-body .space-y-3 > * + * {
    margin-top: 12px;
}

/* Color-coded sections */
.jewelry-tooltip-body .bg-blue-50 {
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
}

.jewelry-tooltip-body .bg-green-50 {
    background-color: #f0fdf4;
    border: 1px solid #dcfce7;
}

.jewelry-tooltip-body .bg-yellow-50 {
    background-color: #fefce8;
    border: 1px solid #fef3c7;
}

.jewelry-tooltip-body .bg-purple-50 {
    background-color: #faf5ff;
    border: 1px solid #e9d5ff;
}

.jewelry-tooltip-body .bg-pink-50 {
    background-color: #fdf2f8;
    border: 1px solid #fce7f3;
}

.jewelry-tooltip-body .bg-orange-50 {
    background-color: #fff7ed;
    border: 1px solid #fed7aa;
}

.jewelry-tooltip-body .bg-emerald-50 {
    background-color: #ecfdf5;
    border: 1px solid #d1fae5;
}

.jewelry-tooltip-body .bg-gray-50 {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
}

.jewelry-tooltip-body .text-blue-700 { color: #1d4ed8; }
.jewelry-tooltip-body .text-blue-800 { color: #1e40af; }
.jewelry-tooltip-body .text-green-700 { color: #15803d; }
.jewelry-tooltip-body .text-green-800 { color: #166534; }
.jewelry-tooltip-body .text-yellow-700 { color: #a16207; }
.jewelry-tooltip-body .text-yellow-800 { color: #92400e; }
.jewelry-tooltip-body .text-purple-700 { color: #7c3aed; }
.jewelry-tooltip-body .text-purple-800 { color: #6b21a8; }
.jewelry-tooltip-body .text-pink-700 { color: #be185d; }
.jewelry-tooltip-body .text-orange-700 { color: #c2410c; }
.jewelry-tooltip-body .text-emerald-700 { color: #047857; }
.jewelry-tooltip-body .text-emerald-800 { color: #065f46; }

/* Gradient backgrounds */
.jewelry-tooltip-body .bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}

.jewelry-tooltip-body .from-yellow-50 { --tw-gradient-from: #fefce8; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(254, 252, 232, 0)); }
.jewelry-tooltip-body .to-yellow-100 { --tw-gradient-to: #fef3c7; }
.jewelry-tooltip-body .from-purple-50 { --tw-gradient-from: #faf5ff; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(250, 245, 255, 0)); }
.jewelry-tooltip-body .to-purple-100 { --tw-gradient-to: #e9d5ff; }
.jewelry-tooltip-body .from-emerald-50 { --tw-gradient-from: #ecfdf5; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(236, 253, 245, 0)); }
.jewelry-tooltip-body .to-emerald-100 { --tw-gradient-to: #d1fae5; }

/* Tooltip Footer */
.jewelry-tooltip-footer {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.jewelry-tooltip-footer small {
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
}

/* Arrow indicators */
.jewelry-tooltip-container::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

.jewelry-tooltip-container.tooltip-above::after {
    top: auto;
    bottom: -8px;
    border-bottom: none;
    border-top: 8px solid #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Responsive Design */
@media (max-width: 640px) {
    .jewelry-tooltip-container {
        max-width: calc(100vw - 40px);
        min-width: 280px;
        left: 20px !important;
        right: 20px;
        width: auto;
    }
    
    .jewelry-tooltip-header {
        padding: 12px 16px 8px;
    }
    
    .jewelry-tooltip-body {
        padding: 12px 16px;
        font-size: 12px;
    }
    
    .jewelry-tooltip-footer {
        padding: 8px 16px;
    }
    
    .jewelry-tooltip-container::after {
        left: 40px;
        transform: none;
    }
}

/* Hover states for tooltip triggers */
[data-jewelry-tooltip]:hover,
[data-tooltip]:hover {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* Focus states for accessibility */
[data-jewelry-tooltip]:focus,
[data-tooltip]:focus {
    outline: 2px solid #059669;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Animation for help icons */
@keyframes tooltip-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.tooltip-help-icon {
    animation: tooltip-pulse 2s infinite;
    color: #059669;
    font-size: 14px;
    margin-left: 6px;
    vertical-align: middle;
}

.tooltip-help-icon:hover {
    animation: none;
    color: #047857;
}

/* Special styling for jewelry tooltips on product cards */
.product-card [data-jewelry-tooltip] {
    position: relative;
    display: inline-block;
}

.product-card [data-jewelry-tooltip]::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background: #059669;
    border-radius: 50%;
    opacity: 0.8;
    animation: tooltip-pulse 2s infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .jewelry-tooltip-content {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
        color: #f9fafb;
    }
    
    .jewelry-tooltip-header {
        background: linear-gradient(135deg, #065f46 0%, #047857 100%);
        border-bottom-color: #059669;
    }
    
    .jewelry-tooltip-title {
        color: #ecfdf5;
    }
    
    .jewelry-tooltip-close {
        color: #d1d5db;
    }
    
    .jewelry-tooltip-close:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .jewelry-tooltip-footer {
        background: #374151;
        border-top-color: #4b5563;
    }
    
    .jewelry-tooltip-footer small {
        color: #9ca3af;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .jewelry-tooltip-content {
        border: 3px solid;
        box-shadow: none;
    }
    
    .jewelry-tooltip-header {
        background: Canvas;
        color: CanvasText;
        border-bottom: 2px solid;
    }
    
    .jewelry-tooltip-body {
        background: Canvas;
        color: CanvasText;
    }
    
    .jewelry-tooltip-close {
        border: 1px solid;
        background: ButtonFace;
        color: ButtonText;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .jewelry-tooltip-container {
        transition: opacity 0.1s linear;
        transform: none;
    }
    
    .jewelry-tooltip-container.show {
        transform: none;
    }
    
    @keyframes tooltip-pulse {
        0%, 100% { opacity: 1; }
    }
    
    [data-jewelry-tooltip]:hover,
    [data-tooltip]:hover {
        transform: none;
    }
}