@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom styles for RTL and dark theme */
body {
    font-family: 'Roboto', Helvetica, Arial, sans-serif !important;
    direction: rtl;
    text-align: right;
    line-height: 25px;
    word-wrap: break-word;
    color: #e0e0e0; /* Default light text color */
    background-color: #0d0d0d; /* Default dark background */
}

.dark body {
    background-color: #0d0d0d;
    color: #e0e0e0;
}

.light body {
    background-color: #f0f0f0; /* Light background */
    color: #333333; /* Dark text */
}

/* Dark mode toggle button styles */
.dark-mode-toggle-btn {
    color: #e0e0e0; /* Light color for icons in dark mode */
}

.light .dark-mode-toggle-btn {
    color: #333333; /* Dark color for icons in light mode */
}

.dark .light-icon {
    display: none;
}

.light .dark-icon {
    display: none;
}

.light .light-icon {
    display: inline-block;
}

.dark .dark-icon {
    display: inline-block;
}

/* RTL specific adjustments */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 0.5rem;
}

[dir="rtl"] .mr-2 {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Custom utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide scrollbar for carousel */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Smooth transitions */
* {
    transition-property: color, background-color, border-color, transform, opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

/* Modal backdrop */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.75);
}

/* Carousel smooth scrolling */
.pm-ul-carousel-videos {
    scroll-behavior: smooth;
}

/* Featured carousel item hover effect */
.block-post:hover .poster {
    transform: scale(1.05);
}

.block-post .poster {
    transition: transform 0.3s ease;
}

/* Backdrop blur support */
.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Navigation menu overlay */
#myNavmenu {
    transition: transform 0.3s ease-in-out;
}

#myNavmenu.translate-x-full {
    transform: translateX(100%);
}

/* Responsive iframe */
.responsive-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive font sizes for mobile */
@media (max-width: 640px) {
    h1, .text-3xl {
        font-size: 1.5rem !important; /* 24px */
    }
    
    h2, .text-2xl {
        font-size: 1.25rem !important; /* 20px */
    }
    
    h2.text-xl {
        font-size: 1.125rem !important; /* 18px */
    }
    
    h3, .text-xl {
        font-size: 1rem !important; /* 16px */
    }
    
    h4, .text-lg {
        font-size: 0.9375rem !important; /* 15px */
    }
}

/* Accessibility improvements - Better contrast */
.bg-gray-900 .text-gray-300,
.bg-gray-900 .text-gray-400,
.bg-gray-900 p {
    color: #f3f4f6 !important; /* text-gray-100 - better contrast ratio (WCAG AA) */
}

/* Links with better contrast and underline */
a.text-red-500,
a.text-red-400 {
    text-decoration: underline;
    text-underline-offset: 2px;
    color: #f87171 !important; /* text-red-400 - better contrast */
}

a.text-red-500:hover,
a.text-red-400:hover {
    text-decoration: none;
    color: #fca5a5 !important; /* text-red-300 */
}

/* Ensure sufficient touch target size (minimum 44x44px) */
button.pm-watch-later-add,
button.pm-watch-later-remove,
a.pm-watch-later-add {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px !important;
}

/* Better contrast for text on dark backgrounds */
.bg-gray-800 .text-gray-300,
.bg-gray-800 .text-gray-400,
.bg-gray-800 p {
    color: #e5e7eb !important; /* text-gray-200 - better contrast (WCAG AA) */
}

.bg-gray-900 .text-gray-300,
.bg-gray-900 .text-gray-400,
.bg-gray-900 p,
.container-fluid.bg-gray-900 .text-gray-300,
.container-fluid.bg-gray-900 p {
    color: #f3f4f6 !important; /* text-gray-100 - better contrast (WCAG AA) */
}

/* Links that rely on color - add underline */
a[class*="text-red"]:not([class*="underline"]):not([class*="no-underline"]) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

a[class*="text-red"]:not([class*="underline"]):not([class*="no-underline"]):hover {
    text-decoration: none;
}

/* Better spacing for touch targets */
.pm-watch-later-add,
.pm-watch-later-remove {
    margin: 4px;
}

/* Ensure absolute links have minimum touch target size and are accessible */
a.absolute.inset-0:not([aria-label]):not([title]) {
    /* Add aria-label in templates for accessibility */
}

a.absolute.inset-0 {
    min-width: 44px;
    min-height: 44px;
    z-index: 1;
}

/* Better contrast for paragraph text */
p.text-gray-400,
.bg-gray-900 p.text-gray-400,
.container-fluid.bg-gray-900 p {
    color: #f3f4f6 !important; /* text-gray-100 - WCAG AA compliant */
}

/* Ensure all links have accessible names - handled in templates */
/* All links should have aria-label, title, or visible text content */

