/* style.css - Modern Arabic Blog */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
    --bg-body: #f1f5f9;
    --bg-white: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --radius: 16px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.7;
    direction: rtl;
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

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

ul {
    list-style: none;
}

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

.hidden {
    display: none !important;
}

/* Header */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    height: 80px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
}

.logo span {
    color: var(--primary);
    margin-right: 10px;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

/* Hero & Search */
.hero-section {
    background: white;
    padding: 80px 0 60px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

.search-container {
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 18px 60px 18px 25px;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1.1rem;
    font-family: inherit;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    right: 25px;
    font-size: 1.3rem;
    color: var(--primary);
}

.quick-categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pill {
    padding: 10px 22px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.pill:hover, .pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Main Grid */
.main-content {
    padding: 50px 0 100px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 35px;
}

.card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

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

.card-img-container {
    height: 220px;
    overflow: hidden;
    position: relative;
}

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

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

.card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--primary);
    color: white;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
}

.card-body {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    line-height: 1.4;
    color: var(--text-main);
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 25px;
    flex-grow: 1;
}

.btn-read {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-read i {
    transition: transform 0.3s ease;
}

.card:hover .btn-read i {
    transform: translateX(-5px);
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 60px;
}

.page-btn {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(.disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn {
    padding: 0 20px;
    width: auto;
}

/* Detail View */
.detail-view {
    max-width: 850px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.detail-header {
    padding: 40px 50px 0;
}

.detail-header h1, .detail-header h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.3;
    color: var(--text-main);
}

.detail-img-wrapper {
    margin: 30px 50px;
    border-radius: 15px;
    overflow: hidden;
}

.detail-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.detail-content {
    padding: 0 50px 50px;
    line-height: 1.8;
}

.share-box {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.share-box h4 {
    margin-bottom: 15px;
}

.share-box .social-icons a.facebook { color: #1877f2; }
.share-box .social-icons a.twitter { color: #1da1f2; }
.share-box .social-icons a.whatsapp { color: #25d366; }

.back-btn {
    margin-bottom: 30px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
}

.detail-meta {
    display: flex;
    gap: 25px;
    color: var(--text-muted);
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.article-body {
    font-size: 1.2rem;
    color: #334155;
}

.article-body p {
    margin-bottom: 25px;
}

/* Professional HTML Tables Styling */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.article-body thead tr {
    background-color: var(--primary);
    color: #ffffff;
    text-align: right;
}

.article-body th,
.article-body td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    text-align: right;
}

.article-body tbody tr:nth-of-type(even) {
    background-color: #f8fafc;
}

.article-body tbody tr:last-of-type {
    border-bottom: 3px solid var(--primary);
}

.article-body tbody tr:hover {
    background-color: #f1f5f9;
    transition: background-color 0.2s ease;
}

/* Responsive Table Wrapper for Mobile */
@media (max-width: 768px) {
    .article-body {
        overflow-x: hidden;
    }
    
    /* Force tables to be scrollable if too wide */
    .article-body table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        border-radius: 8px;
    }
}

/* Footer */
.main-footer {
    background: white;
    padding: 80px 0 40px;
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 50px;
}

.footer-info .logo {
    margin-bottom: 20px;
}

.footer-info p {
    color: var(--text-muted);
    max-width: 400px;
}

.footer-links h4, .footer-social h4 {
    margin-bottom: 25px;
}

.footer-links li {
    margin-bottom: 12px;
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 45px;
    height: 45px;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.social-icons a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-5px);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Category Cards */
.category-card {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.category-card i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .category-card { padding: 30px 15px; }
    .category-card i { font-size: 2.5rem; }
}
/* Mobile Nav */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

.nav-overlay.active {
    display: block;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    padding: 0;
    z-index: 1001;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background: var(--text-main);
    border-radius: 3px;
    transition: var(--transition);
}

.hamburger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Contact Form & Pages */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}

.form-group label {
    font-weight: 700;
    color: var(--text-main);
}

.form-group input, .form-group textarea {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-submit {
    padding: 15px 30px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    align-self: flex-start;
}

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

.contact-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.info-item {
    background: var(--bg-body);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.info-item i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.privacy-content h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-main);
}

.privacy-content ul {
    list-style: disc;
    margin-right: 25px;
    margin-bottom: 20px;
}

.contact-view {
    padding: 60px 50px;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .contact-view { padding: 30px 20px; }
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--primary);
    width: 0;
    z-index: 2000;
    transition: width 0.2s ease;
}

/* Ad Banners & Units */
.ad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 35px auto;
    width: 100%;
    text-align: center;
    overflow: hidden;
}

.ad-label {
    font-size: 10px;
    color: #a1a1aa;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ad-label::before, .ad-label::after {
    content: "";
    height: 1px;
    width: 30px;
    background: #e2e8f0;
}

.ad-wrapper {
    display: flex;
    justify-content: center;
    background: #fafafa;
    border-radius: 8px;
    padding: 5px;
    transition: var(--transition);
}

.native-ad-wrapper {
    margin: 30px auto;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

@media (max-width: 768px) {
    .ad-container { margin: 25px auto; }
    .ad-wrapper { padding: 2px; }
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 55px;
    height: 55px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 1000;
}

/* Responsive */
@media (max-width: 1200px) {
    .container { max-width: 100%; }
}

@media (max-width: 992px) {
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; }
    .hero-content h1 { font-size: 2.5rem; }
}

@media (max-width: 768px) {
    .main-header { height: 70px; }
    .hamburger { display: flex; }
    .nav-links { display: none; }
    
    #nav-menu.active {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        padding: 80px 20px 20px;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        flex-direction: column;
        gap: 1.5rem;
        z-index: 1000;
        overflow-y: auto;
    }

    .container { padding: 0 15px; }
    .hero-content h1 { font-size: 1.8rem; line-height: 1.3; }
    .hero-content p { font-size: 1rem; margin-bottom: 2rem; }
    .search-box input { padding: 15px 50px 15px 20px; font-size: 1rem; }
    .quick-categories { gap: 8px; }
    .pill { padding: 8px 18px; font-size: 0.85rem; }
    .articles-grid { grid-template-columns: 1fr; gap: 20px; }
    .card-body { padding: 15px; }
    .card h3 { font-size: 1.2rem; }
    .card p { font-size: 0.9rem; }
    .pagination-container { gap: 10px; margin-top: 40px; }
    .page-btn { width: 40px; height: 40px; }
    .detail-view { border-radius: 0; max-width: 100%; }
    .detail-header { padding: 25px 20px 0; }
    .detail-img-wrapper { margin: 20px 0; border-radius: 0; }
    .detail-content { padding: 0 20px 30px; }
    .detail-header h1, .detail-header h2 { font-size: 1.6rem; }
    .detail-meta { flex-direction: column; gap: 10px; }
    .article-body { font-size: 1.05rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 30px; }
    .main-footer { padding: 40px 0 20px; }
    .back-to-top { left: 15px; bottom: 15px; width: 45px; height: 45px; }
    .contact-info-grid { grid-template-columns: 1fr; }
    .info-item { padding: 15px; }
}

@media (max-width: 480px) {
    .hero-content h1 { font-size: 1.5rem; }
    .logo { font-size: 1.4rem; }
    .search-box input { padding: 12px 45px 12px 15px; font-size: 0.95rem; }
    .search-icon { right: 15px; font-size: 1.1rem; }
    .card-img-container { height: 180px; }
    .card-badge { top: 10px; right: 10px; padding: 3px 10px; font-size: 0.7rem; }
}

/* Skeleton Loading Animation */
@keyframes skeleton-loading {
    0% { background-color: #f1f5f9; }
    100% { background-color: #e2e8f0; }
}

.skeleton-card {
    height: 350px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.skeleton-img {
    height: 220px;
    animation: skeleton-loading 1s linear infinite alternate;
}

.skeleton-text {
    height: 20px;
    margin: 15px;
    border-radius: 4px;
    animation: skeleton-loading 1s linear infinite alternate;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }
.skeleton-text.long { width: 90%; }

/* Error & Empty States */
.error-container, .empty-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.error-container i, .empty-container i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.btn-retry {
    margin-top: 20px;
    padding: 10px 25px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.btn-retry:hover { background: var(--primary-dark); }

