/* KI-Newsletter Custom Styles */

/* Design System Variables */
:root {
    --color-core: #FFFFFF;
    --color-accent: #00CF8A;
    --color-primary: #0B0A0A;
    --color-secondary: #FFFFFF;
    --color-tertiary: #E5E7EB;
    --border-radius: 6px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html {
    overflow-x: clip;
    overflow-y: auto;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--color-primary);
    background-color: var(--color-core);
    line-height: 1.6;
    overflow-x: clip;
    max-width: 100vw;
    position: relative;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00b87a;
}

/* Hide scrollbar for horizontal scroll containers */
.scrollbar-hide {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
}

/* Button Styles */
.btn-accent {
    background-color: var(--color-accent);
    color: var(--color-primary);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-accent:hover {
    background-color: #00b87a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: var(--color-secondary);
}

/* Card Styles */
.card {
    background-color: var(--color-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

/* Input Styles */
.input-field {
    background-color: var(--color-secondary);
    border: 1px solid var(--color-tertiary);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 207, 138, 0.1);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 10, 10, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--color-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    padding: 2rem;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Article Card */
.article-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.article-card-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-card-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.article-card-content p {
    color: #6B7280;
    font-size: 0.875rem;
    flex-grow: 1;
}

.article-card-content .meta {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 0.75rem;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: rgba(0, 207, 138, 0.1);
    color: var(--color-accent);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Hero Section */
.hero-gradient {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination a, .pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--color-primary);
    transition: all 0.2s ease;
}

.pagination a:hover {
    background-color: var(--color-tertiary);
}

.pagination .active {
    background-color: var(--color-accent);
    color: var(--color-primary);
    font-weight: 600;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background-color: var(--color-accent);
    color: var(--color-primary);
}

.toast.error {
    background-color: #EF4444;
    color: white;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mobile Navigation */
.mobile-menu {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu {
        display: block;
    }
    
    .desktop-menu {
        display: none;
    }
    
    .mobile-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--color-secondary);
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-nav.open {
        transform: translateX(0);
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

/* Line Clamp Utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background-color: rgba(0, 207, 138, 0.2);
    color: var(--color-primary);
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Prose Styles for Article Content */
.prose-lg {
    font-size: 1.125rem;
}

/* Border Color for Inputs on Tailwind */
.border-accent {
    border-color: var(--color-accent);
}

/* Company Ticker */
.company-ticker {
    position: relative;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    white-space: nowrap;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

/* Mobile-specific ticker adjustments */
@media (max-width: 640px) {
    .company-ticker {
        max-width: 100%;
        mask-image: linear-gradient(to right, transparent 2%, black 15%, black 85%, transparent 98%);
        -webkit-mask-image: linear-gradient(to right, transparent 2%, black 15%, black 85%, transparent 98%);
    }
}

.company-ticker-track {
    display: inline-block;
    animation: ticker 25s linear infinite;
    /* Ensure hardware acceleration for smoother animation */
    will-change: transform;
}

@media (max-width: 640px) {
    .company-ticker-track {
        animation: ticker 18s linear infinite;
    }
}

.company-name {
    display: inline-block;
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 1.125rem;
    font-weight: 400;
    font-style: italic;
    color: #64748B;
    margin: 0 2rem;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
}

/* Mobile: smaller margin, smaller font */
@media (max-width: 640px) {
    .company-name {
        font-size: 1rem;
        margin: 0 1.25rem;
    }
}

/* Typewriter animation when visible */
.company-name.typing {
    animation: typewriter 2.5s steps(20, end) forwards;
}

@keyframes typewriter {
    0% {
        opacity: 1;
        max-width: 0;
    }
    100% {
        opacity: 1;
        max-width: 200px;
    }
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        /* Move by 50% because we duplicated the list */
        transform: translateX(-50%);
    }
}

/* --- Globe & Popups --- */

/* Globe Section - Responsive display */
.globe-section {
    min-height: 500px;
}

.globe-container {
    width: 450px;
    height: 500px;
}

#globe-canvas {
    width: 100%;
    height: 100%;
}

/* Hide globe on smaller screens where it can't display properly */
@media (max-width: 1279px) {
    .globe-section {
        display: none !important;
    }
}

/* Adjust globe size for different xl+ screen sizes */
@media (min-width: 1280px) and (max-width: 1439px) {
    .globe-container {
        width: 380px;
        height: 450px;
    }
}

@media (min-width: 1440px) {
    .globe-container {
        width: 480px;
        height: 550px;
    }
}

/* Popup Animation */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.globe-popup {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 8px 11px;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.08);
    width: 168px;
    font-size: 0.7em;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Size Variations */
.globe-popup.size-sm { width: 126px; font-size: 0.63em; }
.globe-popup.size-lg { width: 196px; font-size: 0.7em; }

/* X Post Styling */
.globe-popup.type-x-post {
    background: #000000;
    color: #ffffff;
    border-radius: 11px;
    border: 1px solid #333;
}

.globe-popup.type-x-post .x-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.globe-popup.type-x-post .x-avatar {
    width: 22px;
    height: 22px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    font-size: 0.85rem;
}

.globe-popup.type-x-post .x-meta {
    flex-grow: 1;
    line-height: 1.1;
}

.globe-popup.type-x-post .x-name {
    font-weight: 700;
    font-size: 0.7rem;
}

.globe-popup.type-x-post .x-handle {
    color: #71767b;
    font-size: 0.6rem;
}

.globe-popup.type-x-post .x-logo {
    color: #fff;
    font-size: 0.7rem;
    opacity: 0.7;
}

.globe-popup.type-x-post .x-body {
    font-size: 0.75rem;
    line-height: 1.3;
    color: #e7e9ea;
}

/* Standard Popup Styles */
.globe-popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -40%) scale(0.9);
}

.globe-popup.active {
    opacity: 1;
    animation: popupFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.popup-header {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.popup-icon {
    margin-right: 4px;
    font-size: 0.75rem;
}

.popup-title {
    color: var(--color-accent);
    font-weight: 700;
}

.popup-body {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-primary);
    line-height: 1.3;
}

.popup-source {
    margin-top: 4px;
    font-size: 0.55rem;
    color: #94a3b8;
    text-align: right;
    font-style: italic;
}

/* Ensure Canvas opacity transition works */
#globe-canvas.opacity-0 {
    opacity: 0;
}
#globe-canvas:not(.opacity-0) {
    opacity: 1;
}

/* ==================== RANKING PAGE STYLES ==================== */

/* Tooltip for info icons */
.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-primary);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    width: 280px;
    max-width: 90vw;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    text-transform: none;
    letter-spacing: normal;
}

.tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--color-primary) transparent transparent transparent;
}

.group:hover .tooltip-content,
.cursor-help:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* Model row hover effect */
.model-row {
    cursor: pointer;
}

.model-row:hover {
    background-color: #f9fafb;
}

/* Ranking table styles */
.ranking-table th {
    position: relative;
}

/* Score bar animation */
.score-bar {
    transition: width 0.5s ease-out;
}

/* Compare checkbox styling */
.compare-checkbox {
    cursor: pointer;
    accent-color: var(--color-accent);
}

.compare-checkbox:checked {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Provider logo fallback */
.provider-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border-radius: 8px;
}

/* Stat card hover effect */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Benchmark progress bar */
.benchmark-bar {
    background: linear-gradient(90deg, var(--color-accent) 0%, #00e89c 100%);
    border-radius: 4px;
    height: 8px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Winner highlight */
.winner-highlight {
    position: relative;
}

.winner-highlight::after {
    content: '★';
    color: var(--color-accent);
    margin-left: 4px;
    font-size: 0.75rem;
}

/* Source badge */
.source-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Radar chart container */
.radar-chart-container {
    position: relative;
    aspect-ratio: 1;
    max-width: 400px;
    margin: 0 auto;
}

/* Comparison table winner cell */
.comparison-winner {
    background-color: rgba(0, 207, 138, 0.05);
}

/* Mobile responsive adjustments for ranking */
@media (max-width: 768px) {
    .tooltip-content {
        left: 0;
        transform: none;
        width: 240px;
    }
    
    .tooltip-content::after {
        left: 20px;
        transform: none;
    }
    
    .ranking-table {
        font-size: 0.875rem;
    }
}

/* Smooth transitions for filter buttons */
.filter-btn {
    transition: all 0.2s ease;
}

.filter-btn.active {
    background-color: var(--color-accent);
    color: white;
}

/* External link icon animation */
.external-link-icon {
    transition: transform 0.2s ease;
}

a:hover .external-link-icon {
    transform: translate(2px, -2px);
}

/* Loading skeleton for ranking table */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== NEW RANKING PAGE STYLES ==================== */

/* Info Button Styles */
.info-btn {
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-btn:hover svg {
    color: var(--color-accent);
}

/* Expanded Row Animation */
.expanded-row {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Expand Button Rotation */
.expand-btn svg {
    transition: transform 0.3s ease;
}

.expand-btn svg.rotate-180 {
    transform: rotate(180deg);
}

/* Top 3 Hero Cards */
.top-model-card {
    transition: all 0.3s ease;
}

.top-model-card:hover {
    transform: translateY(-4px);
}

/* Medal Badge Animation */
@keyframes pulse-gold {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(250, 204, 21, 0);
    }
}

.top-model-card:first-child:hover .medal-badge {
    animation: pulse-gold 1.5s infinite;
}

/* Podium Styles */
.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.5rem;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.podium-bar {
    border-radius: 0.5rem 0.5rem 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.podium-bar.gold {
    background-color: #fbbf24;
    color: #78350f;
}

.podium-bar.silver {
    background-color: #d1d5db;
    color: #374151;
}

.podium-bar.bronze {
    background-color: #d97706;
    color: white;
}

/* Info Popup Modal */
#infoPopup {
    backdrop-filter: blur(4px);
}

#infoPopup > div {
    animation: popupEnter 0.2s ease-out;
}

@keyframes popupEnter {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Category Tab Styles */
.category-tab {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-tab:hover {
    background-color: #f3f4f6;
}

.category-tab.active {
    background-color: var(--color-accent);
    color: white;
}

/* Table Row Hover Effect */
.model-row {
    transition: background-color 0.15s ease;
}

.model-row:hover {
    background-color: #f9fafb;
}

/* Benchmark Score Bars */
.score-bar-container {
    width: 80px;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent) 0%, #00e89c 100%);
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .top-model-card {
        padding: 1rem;
    }
    
    .podium-container {
        transform: scale(0.85);
    }
    
    #infoPopup > div {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Print Styles for Ranking */
@media print {
    .expand-btn,
    .compare-checkbox,
    #compareBtn,
    #infoPopup,
    .info-btn {
        display: none !important;
    }
    
    .expanded-row {
        display: table-row !important;
    }
}