* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-600: #4b5563;
    --gray-900: #111827;
    --white: #ffffff;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--white);
    color: var(--gray-900);
    line-height: 1.6;
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.pt-8 { padding-top: 2rem; }
.pr-3 { padding-right: 0.75rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.w-full { width: 100%; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.h-16 { height: 4rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-8 > * + * { margin-top: 2rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

.rounded-md { border-radius: 0.375rem; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }

.border { border: 1px solid #e5e7eb; }
.border-t { border-top: 1px solid #e5e7eb; }
.border-b { border-bottom: 1px solid #e5e7eb; }
.border-r-4 { border-right: 4px solid var(--primary); }
.border-blue-100 { border-color: #dbeafe; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-5xl { font-size: 3rem; }

.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }

.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: var(--gray-900); }
.text-blue-600 { color: var(--primary); }
.text-white { color: var(--white); }

.bg-white { background-color: var(--white); }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-blue-50 { background-color: var(--primary-light); }
.bg-blue-600 { background-color: var(--primary); }
.bg-black { background-color: #000000; }
.bg-opacity-50 { background-color: rgba(0, 0, 0, 0.5); }

.hover\:text-blue-600:hover { color: var(--primary); }
.hover\:bg-gray-100:hover { background-color: var(--gray-100); }
.hover\:bg-blue-600:hover { background-color: var(--primary); }
.hover\:text-white:hover { color: var(--white); }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.hover\:text-primary:hover { color: var(--primary); }
.hover\:bg-primary:hover { background-color: var(--primary); }
.hover\:bg-muted:hover { background-color: var(--gray-100); }
.hover\:bg-muted\/80:hover { background-color: rgba(243, 244, 246, 0.8); }

.transition-all { transition: all 0.3s ease; }
.transition-colors { transition: color 0.3s ease; }

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

/* Custom Logo Styling */
.custom-logo {
    max-height: 40px !important;
    width: auto !important;
    display: inline-block !important;
    margin-left: 0.5rem !important;
}

.custom-logo-link {
    display: inline-flex !important;
    align-items: center !important;
}

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

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

/* Specific Styles */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--white);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.sticky { position: sticky; }
.z-50 { z-index: 50; }
.z-40 { z-index: 40; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

input, textarea, select {
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Article Card */
.article-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.article-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover img {
    transform: scale(1.05);
}

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

.article-card-meta {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.article-card-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    cursor: pointer;
    color: var(--gray-900);
    transition: color 0.3s ease;
}

.article-card-title:hover {
    color: var(--primary);
}

.article-card-summary {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: auto;
}

/* Hero Section */
.hero-section {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 2rem;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.5), transparent);
}

.hero-content {
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    padding: 3rem;
    color: var(--white);
}

@media (max-width: 768px) {
    .hero-section {
        height: 300px;
    }
    
    .hero-content {
        padding: 1.5rem;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    .hidden {
        display: none;
    }
    
    .lg\:hidden {
        display: block;
    }
    
    .lg\:flex {
        display: none;
    }
    
    .lg\:col-span-3 {
        grid-column: span 1;
    }
    
    .lg\:col-span-1 {
        grid-column: span 1;
    }
}

@media (min-width: 768px) {
    .md\:flex {
        display: flex;
    }
    
    .md\:grid {
        display: grid;
    }
    
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .lg\:hidden {
        display: none;
    }
    
    .lg\:flex {
        display: flex;
    }
    
    .lg\:col-span-1 {
        grid-column: span 1;
    }
    
    .lg\:col-span-3 {
        grid-column: span 3;
    }
    
    .lg\:col-span-4 {
        grid-column: span 4;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile Menu */
#mobileMenu {
    display: none !important;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    z-index: 40;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

#mobileMenu.show {
    display: block !important;
}

.hidden {
    display: none !important;
}

/* Modal */
#articleModal {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 99999 !important;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#articleModal.show {
    display: flex !important;
}

.modal-close-trigger {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.modal-close-trigger:active {
    background-color: #f3f4f6 !important;
    transform: scale(0.95);
}

#articleModal > div {
    background: white;
    border-radius: 0.5rem;
    max-width: 900px;
    width: 100%;
    margin-top: 2rem;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    color: #111827 !important; /* Force dark text on white background */
}

#articleContent {
    color: #111827 !important;
}

#articleContent h1, 
#articleContent h2, 
#articleContent h3, 
#articleContent p, 
#articleContent div {
    color: #111827 !important;
}

@media (max-width: 768px) {
    #articleModal {
        padding: 0;
    }
    #articleModal > div {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
        color: #111827 !important;
    }
}

.modal-hidden {
    display: none;
}

.modal-visible {
    display: flex;
}

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

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
