/* Shared component styles */

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    animation: spin 1s linear infinite;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
}

.loading-spinner-sm {
    width: 1rem;
    height: 1rem;
}

.dark .loading-spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: transparent;
    color: #93c5fd;
    cursor: help;
    margin-left: 0.25rem;
    vertical-align: middle;
    transition: color 0.15s, background-color 0.15s;
}

.info-icon:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.info-icon svg {
    width: 16px;
    height: 16px;
}

.dark .info-icon {
    color: #60a5fa;
}

.dark .info-icon:hover {
    color: #93c5fd;
    background-color: rgba(96, 165, 250, 0.15);
}

/* Tooltip */
.tooltip-wrap,
.offer-tooltip-wrap {
    position: relative;
}

.tooltip,
.offer-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    z-index: 50;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 340px;
    max-width: calc(100vw - 2rem);
    font-size: 0.75rem;
    line-height: 1.6;
    font-weight: normal;
    text-align: left;
    color: #374151;
    white-space: normal;
    overflow-wrap: break-word;
}

.tooltip-wrap:hover .tooltip,
.offer-tooltip-wrap:hover .offer-tooltip {
    display: block;
}

.dark .tooltip,
.dark .offer-tooltip {
    background: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
}

/* JS-positioned tooltips (info icons) */
.info-icon + .tooltip {
    position: fixed;
}

/* HTMX indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Trend badges */
.trend-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}
.trend-up { color: #16a34a; }
.trend-down { color: #dc2626; }
.trend-flat { color: #6b7280; }

/* Alpine cloak */
[x-cloak] { display: none !important; }

/* Print styles */
@media print {
    nav, .print-hide { display: none !important; }
    body { background: white !important; }
    .shadow { box-shadow: none !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
        border: 2px solid #9ca3af;
        border-top-color: #3b82f6;
    }
    .animate-spin {
        animation: none;
    }
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Offline indicator */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #f59e0b;
    color: #78350f;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.dark .offline-banner {
    background: #92400e;
    color: #fde68a;
}
