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

/* Fix scrolling on all devices */
html {
    overflow-y: scroll;
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: #f5f5f5;
}
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    background-color: #f5f5f5;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color: #d62929;
}

/* RTL text support for Hebrew */
.rtl-text {
    direction: rtl;
    text-align: right;
    font-family: 'David Libre', 'Noto Sans Hebrew', serif;
}

/* Tab content transitions */
.tab-content {
    animation: fadeIn 0.15s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Line clamp utility for topic descriptions */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Lyrics sync highlighting ===== */
.lyrics-active {
    background-color: rgba(239, 68, 68, 0.08);
    border-radius: 0.375rem;
}

.has-timing .lyrics-pair {
    cursor: pointer;
}
.has-timing .lyrics-pair:hover {
    background-color: rgba(239, 68, 68, 0.04);
    border-radius: 0.375rem;
}

/* ===== Dark mode overrides ===== */

/* Backgrounds */
html.dark .bg-white { background-color: #1f2937; }
html.dark .bg-gray-50 { background-color: #111827; }
html.dark .bg-gray-100 { background-color: #374151; }
html.dark .bg-gray-200 { background-color: #4b5563; }
html.dark .hover\:bg-gray-50:hover { background-color: #374151; }
html.dark .bg-red-50, html.dark .hover\:bg-red-50:hover { background-color: rgba(239, 68, 68, 0.15); }

/* Text colors */
html.dark .text-gray-900 { color: #f3f4f6; }
html.dark .text-gray-800 { color: #e5e7eb; }
html.dark .text-gray-700 { color: #d1d5db; }
html.dark .text-gray-600 { color: #d1d5db; }
html.dark .text-gray-500 { color: #9ca3af; }
html.dark .text-gray-400 { color: #9ca3af; }
html.dark .text-gray-300 { color: #9ca3af; }
html.dark .text-gray-200 { color: #6b7280; }
html.dark .text-blue-700 { color: #93c5fd; }
html.dark .text-red-700 { color: #fca5a5; }
html.dark .text-green-700 { color: #86efac; }
html.dark .text-red-800 { color: #fca5a5; }
html.dark .text-green-800 { color: #86efac; }
html.dark .text-blue-800 { color: #93c5fd; }
html.dark .text-red-600 { color: #f87171; }

/* Hover text */
html.dark .hover\:text-red-700:hover { color: #fca5a5; }
html.dark .group:hover .group-hover\:text-red-700 { color: #fca5a5; }

/* Borders */
html.dark .border { border-color: #374151; }
html.dark .border-t { border-top-color: #374151; }
html.dark .border-b { border-bottom-color: #374151; }
html.dark .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: #374151; }
html.dark .border-gray-300 { border-color: #4b5563; }
html.dark .border-green-200 { border-color: #065f46; }
html.dark .border-red-200 { border-color: #991b1b; }
html.dark .border-blue-200 { border-color: #1e40af; }
html.dark .hover\:border-red-200:hover { border-color: #991b1b; }
html.dark .hover\:border-red-400:hover { border-color: #f87171; }

/* Shadows */
html.dark .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3); }
html.dark .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4); }
html.dark .hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3); }

/* Badges */
html.dark .bg-green-100 { background-color: rgba(34, 197, 94, 0.15); }
html.dark .bg-blue-100 { background-color: rgba(59, 130, 246, 0.15); }
html.dark .bg-red-100 { background-color: rgba(239, 68, 68, 0.15); }
html.dark .text-green-700 { color: #86efac; }

/* Flash messages / alerts */
html.dark .bg-green-50 { background-color: rgba(34, 197, 94, 0.1); }
html.dark .bg-blue-50 { background-color: rgba(59, 130, 246, 0.1); }

/* Inputs & selects */
html.dark input, html.dark textarea, html.dark select {
    background-color: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
}
html.dark input::placeholder, html.dark textarea::placeholder {
    color: #9ca3af;
}
html.dark input:focus, html.dark textarea:focus, html.dark select:focus {
    border-color: #ef4444;
}

/* Lyrics sync */
html.dark .lyrics-active { background-color: rgba(239, 68, 68, 0.12); }
html.dark .has-timing .lyrics-pair:hover { background-color: rgba(239, 68, 68, 0.06); }

/* Scrollbar */
html.dark .custom-scrollbar::-webkit-scrollbar-track { background-color: #1f2937; }
html.dark .custom-scrollbar::-webkit-scrollbar { background-color: #1f2937; }

/* 404 page */
html.dark .text-gray-200 { color: #4b5563; }

/* ===== Print styles ===== */
@media print {
    /* Force light colors */
    * { color: #000 !important; background: #fff !important; box-shadow: none !important; }

    /* Hide header, footer, nav */
    header, footer, nav { display: none !important; }

    /* Clean up lyrics container */
    .rounded-lg { border: none !important; }
    .shadow-sm { box-shadow: none !important; }

    /* Keep lyrics readable */
    .lyrics-pair { break-inside: avoid; cursor: default !important; }
    .lyrics-active { background-color: transparent !important; }
    .text-blue-700 { color: #333 !important; }

    /* Site name footer for print */
    body::after {
        content: "SingHebrew.com";
        display: block;
        text-align: center;
        font-size: 10pt;
        color: #999 !important;
        margin-top: 2em;
        padding-top: 0.5em;
        border-top: 1px solid #ccc;
    }

    @page { margin: 1.5cm; }
}
