/* Modern Global Styles */
:root {
    /* Brand Colors */
    --primary-red: #e63946;
    --primary-blue: #1d3557;
    --accent-blue: #457b9d;
    --light-blue: #a8dadc;

    /* Neutrals */
    --bg-body: #f4f6f8;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);
    --transition: all 0.3s ease;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* Header & Nav */
.top-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-red);
    letter-spacing: -0.5px;
    margin: 0;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 1rem;
    position: relative;
    padding: 5px 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-blue);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    right: 0;
    background-color: var(--primary-red);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.search-box {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 300px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.1);
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-family: 'Cairo';
    color: var(--text-primary);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons i {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.social-icons i:hover {
    color: var(--primary-blue);
    transform: translateY(-2px);
}

/* Header Search Form */
.header-search-form {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 6px 12px;
    margin-right: 15px;
    transition: var(--transition);
}

.header-search-form:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.1);
}

.header-search-form input {
    border: none;
    background: transparent;
    outline: none;
    width: 150px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 4px 8px;
}

.header-search-form input::placeholder {
    color: var(--text-light);
}

.header-search-form button {
    background: var(--primary-red);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.header-search-form button:hover {
    background: #c5303d;
    transform: scale(1.05);
}

/* Hero Section */
.hero-section {
    padding: 30px 0;
}

.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

/* Main Hero Card */
.hero-card-lg {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0d1b2a 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: flex-end;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 2px solid var(--primary-red);
}

.hero-card-lg:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.hero-card-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.4), transparent);
    padding: 30px;
    width: 100%;
    color: white;
}

.hero-tag {
    background: var(--primary-red);
    color: white;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.hero-title-lg {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* Hero Share Buttons */
.hero-share-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.hero-share-btn {
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    color: white;
}

.hero-share-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Brand Colors */
.hero-share-btn.fb {
    background: #1877f2;
}

.hero-share-btn.tw {
    background: #000000;
}

.hero-share-btn.wa {
    background: #25d366;
}

.hero-share-btn.copy {
    background: #6b7280;
}

.hero-share-btn.fb:hover {
    background: #1465d6;
}

.hero-share-btn.tw:hover {
    background: #1a1a1a;
}

.hero-share-btn.wa:hover {
    background: #20b858;
}

.hero-share-btn.copy:hover {
    background: #4b5563;
}

/* Small Hero Cards */
.hero-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero-card-sm {
    background: linear-gradient(135deg, var(--primary-red) 0%, #c5303d 100%);
    padding: 25px;
    border-radius: var(--radius-md);
    border: none;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    color: white;
}

.hero-card-sm:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.hero-card-sm .source-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.hero-title-sm {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.5;
    color: white;
}

.hero-title-sm a {
    color: white;
}

.hero-title-sm a:hover {
    opacity: 0.9;
}

.hero-card-sm .news-card-meta {
    color: rgba(255, 255, 255, 0.85);
}

/* Hero Side Share Buttons */
.hero-side-share {
    display: flex;
    gap: 6px;
    align-items: center;
}

.share-btn-inline,
.hero-side-share-btn {
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 28px;
    height: 28px;
    color: white;
}

.share-btn-inline:hover,
.hero-side-share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

/* Brand Colors for Side Share */
.share-btn-inline.fb,
.hero-side-share-btn.fb {
    background: #1877f2;
}

.share-btn-inline.tw,
.hero-side-share-btn.tw {
    background: #000000;
}

.share-btn-inline.wa,
.hero-side-share-btn.wa {
    background: #25d366;
}

.share-btn-inline.copy,
.hero-side-share-btn.copy {
    background: #6b7280;
}

.share-btn-inline.fb:hover,
.hero-side-share-btn.fb:hover {
    background: #1465d6;
}

.share-btn-inline.tw:hover,
.hero-side-share-btn.tw:hover {
    background: #1a1a1a;
}

.share-btn-inline.wa:hover,
.hero-side-share-btn.wa:hover {
    background: #20b858;
}

.share-btn-inline.copy:hover,
.hero-side-share-btn.copy:hover {
    background: #4b5563;
}

/* Content Layout */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.section-title h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    margin: 0;
    position: relative;
    padding-left: 15px;
}

.section-title h3::before {
    content: '';
    position: absolute;
    right: 0;
    /* RTL specific: changed from left to right? Check logic */
    /* Since we are RTL, right is start. But let's verify context. 
       Usually border-right for RTL. */
    height: 100%;
    width: 5px;
    background: var(--primary-red);
    border-radius: 4px;
    top: 0;
}

/* RTL adjustment: move accent to right, add padding right */
.section-title h3 {
    padding-left: 0;
    padding-right: 15px;
}

.section-title h3::before {
    right: 0;
}


.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 60px;
}

.news-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--light-blue);
}

.source-badge {
    background: #e1f5fe;
    color: #0277bd;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 10px;
}

.news-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.news-card:hover .news-card-title {
    color: var(--primary-blue);
}

.news-card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-card-meta i {
    margin-left: 5px;
}

/* Footer */
.main-footer {
    background: var(--primary-blue);
    color: white;
    padding: 60px 0 20px 0;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: var(--light-blue);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-links a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.footer-links a:hover {
    color: white;
    padding-right: 5px;
}

.copyright {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-side {
        flex-direction: row;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 10px;
        justify-content: flex-start;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .search-box {
        width: 100%;
    }

    .hero-side {
        flex-direction: column;
    }

    .news-card-actions {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px dashed var(--border-color);
        display: flex;
        gap: 10px;
        justify-content: flex-end;
        opacity: 0.6;
        transition: var(--transition);
    }

    .news-card:hover .news-card-actions {
        opacity: 1;
    }

    .share-btn {
        background: transparent;
        border: none;
        cursor: pointer;
        font-size: 1.1rem;
        color: var(--text-secondary);
        transition: var(--transition);
        padding: 5px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .share-btn:hover {
        background: rgba(0, 0, 0, 0.05);
        transform: scale(1.1);
    }

    .share-btn.fb:hover {
        color: #1877f2;
    }

    .share-btn.tw:hover {
        color: #000;
    }

    .share-btn.wa:hover {
        color: #25d366;
    }

    .share-btn.copy:hover {
        color: var(--primary-blue);
    }

    /* Tooltip for Copy */
    .copy-feedback {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: #333;
        color: white;
        padding: 10px 20px;
        border-radius: 30px;
        font-size: 0.9rem;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
        z-index: 2000;
    }

    .copy-feedback.show {
        opacity: 1;
        visibility: visible;
        bottom: 30px;
    }
}

/* ===== INFINITE SCROLL ANIMATIONS ===== */

/* Initial hidden state for newly loaded articles */
.article-loading {
    opacity: 0;
    transform: translateY(20px);
}

/* Animated visible state */
.article-loaded {
    animation: articleFadeIn 0.4s ease forwards;
}

@keyframes articleFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* New article highlight for realtime updates */
.new-article-fade {
    animation: newArticleSlide 0.5s ease-out;
    border-right: 3px solid var(--primary-red) !important;
}

@keyframes newArticleSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }

    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

/* New badge for realtime articles */
.new-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-red);
    color: white;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Load More Button */
.load-more-btn {
    width: 100%;
    padding: 15px 25px;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.load-more-btn:hover {
    background: linear-gradient(135deg, var(--accent-blue), var(--primary-blue));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.load-more-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.load-more-btn.loading i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* End of articles message */
.end-of-articles {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 20px;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    margin-top: 20px;
    border: 1px dashed var(--border-color);
}

.end-of-articles i {
    font-size: 1.5rem;
    color: #28a745;
}

/* Refresh Notification Banner */
.refresh-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.5);
}

.refresh-notification .refresh-content {
    background: linear-gradient(135deg, #1d3557, #457b9d);
    color: white;
    padding: 15px 30px;
    text-align: center;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.refresh-notification.hiding {
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.refresh-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
}

.refresh-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Result State */
.refresh-result {
    background: linear-gradient(135deg, #1d3557, #457b9d);
    color: white;
    padding: 20px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.result-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

.result-info i {
    font-size: 1.5rem;
}

.result-info span {
    color: #ffd700;
    font-size: 1.5rem;
}

.refresh-result .buttons-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.scroll-to-top-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.scroll-to-top-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.stay-btn {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.stay-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.countdown-bar {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.countdown-progress {
    height: 100%;
    background: #ffd700;
    width: 100%;
    transition: width 5s linear;
}

.countdown-progress.animate {
    width: 0%;
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    padding: 20px 0;
    direction: ltr;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.pagination .page-item .page-link:hover {
    background: var(--bg-body);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.pagination .page-item.active .page-link {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-body);
}

/* Laravel default pagination wrapper */
nav[role="navigation"] {
    display: flex;
    justify-content: flex-end;
}

nav[role="navigation"] .flex {
    display: flex;
    gap: 5px;
    align-items: center;
}

nav[role="navigation"] a,
nav[role="navigation"] span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

nav[role="navigation"] a:hover {
    background: var(--bg-body);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

nav[role="navigation"] span[aria-current="page"] span {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
}

nav[role="navigation"] span[aria-disabled="true"] span {
    opacity: 0.5;
    cursor: not-allowed;
}