/**
 * LinkGate Pro - Main Stylesheet
 * ================================
 * Modern, responsive CSS with RTL support
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-rgb: 26, 115, 232;
    --secondary: #f8f9fa;
    --success: #0d9e6e;
    --warning: #f9ab00;
    --danger: #ea4335;
    
    --text: #202124;
    --text-muted: #5f6368;
    --text-light: #9aa0a6;
    
    --bg: #f0f2f5;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f8f9fa;
    
    --border: #dadce0;
    --border-light: #e8eaed;
    
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --container: 1200px;
    --header-height: 70px;
    --nav-height: 52px;
    
    --font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul, ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

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

/* ============================================
   UTILITIES
   ============================================ */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* ============================================
   BREAKING BAR
   ============================================ */
.breaking-bar {
    background: linear-gradient(135deg, var(--danger) 0%, #c5221f 100%);
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    overflow: hidden;
}

.breaking-label {
    background: white;
    color: var(--danger);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    flex-shrink: 0;
}

.breaking-content {
    white-space: nowrap;
    animation: scroll-rtl 20s linear infinite;
}

@keyframes scroll-rtl {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 1rem;
}

.site-logo {
    flex-shrink: 0;
}

.site-logo img {
    height: 40px;
    width: auto;
}

/* Search */
.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
    display: none;
}

@media (min-width: 768px) {
    .header-search {
        display: block;
    }
}

.header-search input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    transition: var(--transition);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.header-search button {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.375rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
}

/* Social & Hamburger */
.header-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-link {
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: none;
}

@media (min-width: 768px) {
    .social-link {
        display: flex;
    }
}

.social-link:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

@media (min-width: 1024px) {
    .hamburger {
        display: none;
    }
}

/* ============================================
   NAVIGATION
   ============================================ */
.main-nav {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: var(--header-height);
    z-index: 90;
}

.nav-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
    display: none;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    white-space: nowrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    position: relative;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.cat-icon {
    font-size: 1.1em;
}

/* Mobile Menu Overlay */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
    padding: 2rem 0;
}

.content-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr 320px;
    }
}

/* ============================================
   ARTICLE CARD
   ============================================ */
.articles-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.article-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-slow);
    border: 1px solid var(--border-light);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-image-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.card-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.card-body {
    padding: 1.25rem;
}

.card-category {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--cat-color, var(--primary));
    margin-bottom: 0.75rem;
}

.card-category::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--cat-color, var(--primary));
    border-radius: 2px;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.card-title a {
    color: var(--text);
}

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

.card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.card-views {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================
   FEATURED ARTICLE
   ============================================ */
.featured-article {
    grid-column: 1 / -1;
    display: grid;
    gap: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .featured-article {
        grid-template-columns: 1fr 1fr;
    }
}

.featured-image {
    aspect-ratio: 16 / 10;
}

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

.featured-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--warning) 0%, #f9ab00 100%);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
    width: fit-content;
}

.featured-title {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .featured-title {
        font-size: 1.75rem;
    }
}

.featured-excerpt {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.featured-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.widget {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.widget-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
}

/* Popular Widget */
.popular-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.popular-link {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.popular-link img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.popular-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.popular-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Categories Widget */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text);
    font-weight: 500;
    transition: var(--transition);
}

.category-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.cat-icon {
    font-size: 1.25rem;
}

.cat-name {
    flex: 1;
}

.cat-arrow {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ============================================
   ADS
   ============================================ */
.ad-container {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-light);
}

.ad-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

/* ============================================
   ARTICLE PAGE
   ============================================ */
.article-header {
    margin-bottom: 2rem;
}

.article-breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb ol {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    color: var(--text-light);
}

.article-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .article-title {
        font-size: 2.25rem;
    }
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.article-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

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

.article-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    font-weight: 700;
    margin: 2rem 0 1rem;
    line-height: 1.4;
}

.article-content h2 {
    font-size: 1.5rem;
}

.article-content h3 {
    font-size: 1.25rem;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-right: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content ul {
    list-style: disc;
}

.article-content ol {
    list-style: decimal;
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content img {
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
}

.article-content blockquote {
    border-right: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--bg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-style: italic;
}

/* ============================================
   GATE SECTION
   ============================================ */
.gate-section {
    margin: 3rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg) 0%, var(--secondary) 100%);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border);
}

.gate-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.gate-box {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.gate-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.gate-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.gate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    transition: var(--transition);
}

.gate-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Countdown */
.countdown-wrapper {
    display: none;
    margin-top: 1.5rem;
}

.countdown-wrapper.active {
    display: block;
}

.countdown-timer {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 1.5rem;
}

.countdown-timer svg {
    transform: rotate(-90deg);
}

.countdown-track {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.countdown-arc {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.countdown-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

.final-link-btn {
    display: none;
    background: var(--success);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.125rem;
    transition: var(--transition);
}

.final-link-btn:hover {
    background: #0b7d55;
    transform: translateY(-2px);
}

.final-link-btn.visible {
    display: inline-flex;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--text);
    background: var(--bg-white);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link.current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.page-ellipsis {
    color: var(--text-light);
    padding: 0 0.5rem;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.footer-brand {
    max-width: 300px;
}

.footer-logo {
    display: block;
    margin-bottom: 1rem;
}

.footer-logo img {
    height: 35px;
    width: auto;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text-muted);
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--primary);
    color: white;
}

.footer-links h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-links ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-contact p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-bottom {
    border-top: 1px solid var(--border-light);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        text-align: right;
    }
}

.footer-powered a {
    color: var(--primary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ============================================
   MOBILE MENU (Active State)
   ============================================ */
@media (max-width: 1023px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        z-index: 96;
        transition: right 0.3s ease;
        border-bottom: none;
        border-left: 1px solid var(--border-light);
    }
    
    .main-nav.active {
        right: 0;
    }
    
    .nav-inner {
        padding: 1rem;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-link {
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-link.active::after {
        display: none;
    }
}
