/* Custom Styles - Browser-kompatible Version (ohne Tailwind Build-Direktiven) */
/* Tailwind CSS wird separat über tailwind.min.css geladen */

/* ===================================
   CUSTOM KOMPONENTEN
   =================================== */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    background-color: #dc2626;
    color: white;
}
.btn-primary:hover {
    background-color: #b91c1c;
}
.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #ef4444;
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
}
.btn-secondary:hover {
    background-color: #d1d5db;
}
.btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #6b7280;
}

/* Cards */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
}
.card-hover:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Table Styles */
.table-hover tbody tr {
    transition: background-color 0.15s;
}
.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Dividend Status Styling */
.dividend-confirmed {
    color: #1f2937;
    font-weight: 600;
}

.dividend-previous-year {
    color: #1f2937;
    font-weight: 600;
}

.dividend-none {
    color: #6b7280;
}

.dividend-unknown {
    color: #6b7280;
}

.dividend-disclaimer {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ===================================
   CUSTOM UTILITIES
   =================================== */

/* Text Truncate */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading Spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc2626;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loading */
.skeleton {
    background-color: #e5e7eb;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    border-radius: 0.25rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===================================
   PERFORMANCE OPTIMIERUNGEN
   =================================== */

* {
    box-sizing: border-box;
}

body {
    font-display: swap;
}

/* Reduzierte Animationen für User mit Präferenz */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    header, footer, .no-print {
        display: none !important;
    }

    .container {
        max-width: 100% !important;
    }

    table {
        font-size: 12px;
    }
}

/* Mobile-First Responsive Utilities */
@media (max-width: 640px) {
    .mobile-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-stack {
        flex-direction: column;
    }
}

/* Critical Above-the-fold Styles */
.above-fold {
    min-height: 100vh;
}

/* Lazy Loading Placeholder */
img.lazy {
    background: #f0f0f0;
    min-height: 100px;
}

/* ===================================
   STICKY LOGO COLUMN (Mobile)
   =================================== */

/* Logo-Spalte fixieren */
#dividendTable thead th:nth-child(1),
#dividendTable tbody td:nth-child(1) {
    position: sticky !important;
    left: 0 !important;
    z-index: 10;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
}

/* Hintergrund-Farben */
#dividendTable thead th:nth-child(1) {
    background-color: #f9fafb;
}

#dividendTable tbody td:nth-child(1) {
    background-color: transparent;
}

/* Hover-State & Past-State synchronisieren */
#dividendTable tbody tr:hover td:nth-child(1),
#dividendTable tbody tr.bg-gray-50 td:nth-child(1) {
    background-color: #f9fafb !important;
}

/* Shadow-Effekt rechts vom Logo */
#dividendTable thead th:nth-child(1)::after,
#dividendTable tbody td:nth-child(1)::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.08) 0%,
        rgba(0, 0, 0, 0) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Shadow aktiv beim Scrollen */
.table-scrolled #dividendTable thead th:nth-child(1)::after,
.table-scrolled #dividendTable tbody td:nth-child(1)::after {
    opacity: 1;
}

/* GPU-Beschleunigung für Smooth Scrolling */
#dividendTable thead th:nth-child(1),
#dividendTable tbody td:nth-child(1) {
    will-change: transform;
    transform: translateZ(0);
}

/* Mobile: Full-width Container für Tabelle */
@media (max-width: 768px) {
    .overflow-x-auto:has(#dividendTable) {
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
    }

    #dividendTable thead th:nth-child(1),
    #dividendTable tbody td:nth-child(1) {
        display: table-cell !important;
        visibility: visible !important;
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
        padding-left: 16px !important;
        padding-right: 8px !important;
    }
}

#dividendTable th {
    position: relative;
}

#dividendTable th[data-sort] {
    cursor: pointer;
    user-select: none;
}

#dividendTable th[data-sort]:hover {
    background-color: #f9fafb;
}

/* Optimierte Tabellen-Styles */
#dividendTable {
    table-layout: fixed;
}

/* ===================================
   SEARCH & UI COMPONENTS
   =================================== */

/* Search Results Dropdown */
#searchResults {
    max-height: 400px;
    overflow-y: auto;
}

#searchResults::-webkit-scrollbar {
    width: 8px;
}

#searchResults::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#searchResults::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#searchResults::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* GPU Acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Watchlist Star Animation */
.watchlist-star {
    transition: color 0.2s ease, transform 0.2s ease;
}

.watchlist-star:hover {
    transform: scale(1.2);
}

.watchlist-star:active {
    transform: scale(0.95);
}

/* Focus Styles für Accessibility */
:focus {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    left: 0;
    top: 0;
    background-color: #dc2626;
    color: white;
    padding: 0.5rem;
    transform: translateY(-100%);
}
.skip-to-content:focus {
    transform: translateY(0);
}

/* Responsive Tables */
@media (max-width: 768px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .responsive-table table {
        min-width: 600px;
    }
}

/* Grid Layouts */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading States */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===================================
   CONTENT LINK STYLES
   =================================== */

/* Links in Prose/Content-Bereichen visuell hervorheben */
/* Hohe Spezifität um Tailwind zu überschreiben */
main section p a:not([class*="bg-"]):not([class*="btn"]):not([class*="locked"]),
main section li a:not([class*="bg-"]):not([class*="btn"]):not([class*="locked"]),
main .prose a:not([class*="bg-"]):not([class*="btn"]):not([class*="locked"]),
main .prose p a,
main .prose li a,
section.mb-12 p a:not([class*="bg-"]):not([class*="btn"]),
section.mb-12 .text-gray-700 a,
div.prose a,
p.text-gray-700 a,
p.mb-6 a,
.content a:not([class*="bg-"]):not([class*="btn"]) {
    color: #dc2626 !important; /* Brand Red */
    text-decoration: underline !important;
    text-underline-offset: 2px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

main section p a:not([class*="bg-"]):not([class*="btn"]):not([class*="locked"]):hover,
main section li a:not([class*="bg-"]):not([class*="btn"]):not([class*="locked"]):hover,
main .prose a:not([class*="bg-"]):not([class*="btn"]):not([class*="locked"]):hover,
main .prose p a:hover,
main .prose li a:hover,
section.mb-12 p a:not([class*="bg-"]):not([class*="btn"]):hover,
section.mb-12 .text-gray-700 a:hover,
div.prose a:hover,
p.text-gray-700 a:hover,
p.mb-6 a:hover,
.content a:not([class*="bg-"]):not([class*="btn"]):hover {
    color: #b91c1c !important; /* Darker Red on hover */
    text-decoration-color: #b91c1c;
}

/* Links in Dark Backgrounds (z.B. Footer) */
.bg-gray-900 a,
footer a {
    color: #fca5a5; /* Light Red */
}

.bg-gray-900 a:hover,
footer a:hover {
    color: #fecaca; /* Even lighter on hover */
}

/* Ausnahmen: Buttons und Navigation-Links nicht unterstreichen */
.btn a,
a.btn,
nav a,
header a,
.no-underline a,
a.no-underline,
a[class*="bg-red-"],
a[class*="bg-blue-"],
a[class*="bg-green-"],
a.rounded-lg,
a[class*="font-medium"][class*="text-red-700"],
.bg-white a[class*="font-medium"],
a.locked-content,
a.locked-premium,
a.locked-free {
    text-decoration: none !important;
}

/* Spezifische Ausnahmen für Tabellen-Links */
#dividendTable a {
    text-decoration: none !important;
}

/* Hero-Section Premium-Link */
.bg-gray-100 a.underline {
    color: #dc2626;
}
