/**
 * Bharat First TV - Custom Styles
 * Tailwind directives + custom styles for Hindi fonts, brand colors, animations
 */

/* Tailwind Directives */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Custom Base Styles */
@layer base {
    html, body {
        margin: 0;
        padding: 0;
        font-family: 'Noto Sans Devanagari', 'Hind', 'Inter', sans-serif;
    }
    
    .hindi-text {
        font-family: 'Noto Sans Devanagari', 'Hind', sans-serif;
    }
    
    /* Fix sticky headers - Combined into one */
    header {
        position: sticky;
        top: 0;
        z-index: 50;
        margin: 0;
        width: 100%;
        left: 0;
        right: 0;
        background: white;
    }
    
    #yellow-header {
        margin: 0;
        width: 100%;
        left: 0;
        right: 0;
        margin-top: 0 !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        background-color: #F9BB1E !important;
        min-height: 64px;
    }
    
    /* Ensure sidebar never goes behind header */
    .sidebar-container {
        position: sticky !important;
        top: 200px !important;
        z-index: 40 !important;
    }
}

/* Custom Components */
@layer components {
    /* Navigation Links */
    .nav-link {
        @apply text-gray-700 hover:text-red-600 transition-colors duration-200 font-medium;
        color: #374151;
    }
    
    .nav-link.active {
        color: #D4110F;
        @apply font-semibold;
    }
    
    .nav-link:hover {
        color: #D4110F;
    }
    
    /* Post Card Styles */
    .post-card {
        @apply bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow duration-300;
    }
    
    /* Button Styles */
    .btn-primary {
        @apply px-6 py-2 text-white rounded-lg transition-colors duration-200 font-medium;
        background-color: #D4110F;
    }
    
    .btn-primary:hover {
        background-color: #b00e0d;
    }
    
    .btn-secondary {
        @apply px-6 py-2 bg-gray-200 hover:bg-gray-300 rounded-lg transition-colors duration-200 font-medium;
    }
    
    /* Gold Accent Button */
    .btn-gold {
        @apply px-6 py-2 text-gray-900 rounded-lg transition-colors duration-200 font-medium;
        background-color: #F9BB1E;
    }
    
    .btn-gold:hover {
        background-color: #e0a81a;
    }
    
    /* Input Styles */
    .input-field {
        @apply w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-600 transition-all duration-200;
    }
    
    /* Sidebar Box */
    .sidebar-box {
        @apply bg-white rounded-lg shadow-md p-4;
    }
    
    /* Ticker Animation */
    @keyframes scroll {
        0% {
            transform: translateX(0);
        }
        100% {
            transform: translateX(-100%);
        }
    }
    
    .animate-scroll {
        animation: scroll 30s linear infinite;
    }
    
    /* Slide-up Panel Animation */
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .slide-up {
        animation: slideUp 0.3s ease-out forwards;
    }
    
    /* Auth Panel Styling */
    #auth-panel {
        z-index: 9999 !important;
    }
    
    #auth-panel > div:first-child {
        backdrop-filter: blur(2px);
    }
    
    #auth-panel > div:last-child {
        z-index: 10000 !important;
        position: relative;
    }
    
    #auth-panel #auth-panel-content {
        position: relative;
        z-index: 1;
    }
    
    #auth-panel form {
        position: relative;
        z-index: 1;
    }
    
    #auth-panel input,
    #auth-panel button,
    #auth-panel label {
        position: relative;
        z-index: 1;
    }
    
    /* Fade In Animation */
    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    
    .fade-in {
        animation: fadeIn 0.5s ease-in;
    }
    
    /* Rotated Advertisement Text */
    .ad-rotated {
        transform: rotate(90deg);
        @apply text-gray-400 font-semibold text-lg;
    }
    
    /* Line Clamp Utilities */
    .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;
    }
    
    /* Custom Scrollbar */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-track {
        @apply bg-gray-100;
    }
    
    ::-webkit-scrollbar-thumb {
        @apply bg-gray-400 rounded;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        @apply bg-gray-500;
    }
}

/* Custom Utilities */
@layer utilities {
    /* Brand Colors */
    .text-brand-red {
        color: #D4110F;
    }
    
    .bg-brand-red {
        background-color: #D4110F;
    }
    
    .text-brand-gold {
        color: #F9BB1E;
    }
    
    .bg-brand-gold {
        background-color: #F9BB1E;
    }
    
    /* Border Brand Colors */
    .border-brand-red {
        border-color: #D4110F;
    }
    
    .border-brand-gold {
        border-color: #F9BB1E;
    }
    
    /* Hover States */
    .hover-brand-red:hover {
        color: #D4110F;
    }
    
    .hover-bg-brand-red:hover {
        background-color: #D4110F;
    }
    
    /* Focus States */
    .focus-brand-red:focus {
        outline: none;
        ring-color: #D4110F;
    }
}

/* Responsive Design Adjustments */
@media (max-width: 768px) {
    /* Mobile-specific styles */
    .container {
        @apply px-4;
    }
    
    /* Hide advertisements on mobile */
    .ad-mobile-hidden {
        @apply hidden;
    }
    
    /* Full-width auth panel on mobile */
    #auth-panel > div:first-child {
        @apply rounded-none;
        max-height: 100vh;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #D4110F;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notification Styles */
.toast {
    @apply fixed top-4 right-4 px-6 py-3 rounded-lg shadow-lg z-50 transform transition-transform duration-300;
}

.toast-success {
    @apply bg-green-500 text-white;
}

.toast-error {
    @apply bg-red-500 text-white;
}

.toast-info {
    @apply bg-blue-500 text-white;
}

/* Comment Styles */
.comment-item {
    @apply flex items-start space-x-3 p-3 rounded-lg hover:bg-gray-50 transition-colors;
}

.comment-reply {
    @apply ml-12 mt-4;
}

/* Prose Styles for Post Content */
.prose {
    @apply text-gray-700 leading-relaxed;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    @apply font-bold mt-6 mb-4;
    color: #D4110F;
}

.prose p {
    @apply mb-4;
}

.prose a {
    @apply text-red-600 hover:underline;
}

.prose img {
    @apply rounded-lg my-4;
}

.prose ul,
.prose ol {
    @apply ml-6 mb-4;
}

.prose li {
    @apply mb-2;
}

.prose blockquote {
    @apply border-l-4 border-gray-300 pl-4 italic my-4;
    border-color: #D4110F;
}

/* Sticky Header */
.sticky-header {
    @apply sticky top-0 z-50 bg-white shadow-sm;
}

/* Ticker Bar Styles */
.ticker-bar {
    background-color: #F9BB1E;
    @apply py-2 overflow-hidden;
}

.ticker-item {
    @apply px-3 py-1 bg-white rounded-full text-sm font-medium text-gray-900 whitespace-nowrap;
}

/* Liked Posts Drawer */
#liked-posts-drawer {
    @apply fixed right-0 top-0 h-full w-80 bg-white shadow-2xl z-50 overflow-y-auto;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Form Validation Styles */
.input-error {
    @apply border-red-500 focus:ring-red-500;
}

.error-message {
    @apply text-red-500 text-sm mt-1;
}

.success-message {
    @apply text-green-500 text-sm mt-1;
}

/* Pagination Styles */
.pagination {
    @apply flex justify-center space-x-2;
}

.pagination a,
.pagination span {
    @apply px-4 py-2 rounded transition-colors;
}

.pagination .active {
    @apply bg-red-600 text-white;
}

.pagination a:not(.active) {
    @apply bg-gray-200 hover:bg-gray-300;
}

/* Category Animation Styles */
.category-item {
    animation: slideInFromBottom 0.5s ease-out;
    display: inline-block;
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.category-item.fade-out {
    animation: slideOutToTop 0.5s ease-out forwards;
}

@keyframes slideOutToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}
