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

.hero{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: url(img/bg.jpg);
    background-position: center;
    background-size: cover;
    z-index: 0;
}

@media (max-width: 768px){
    .hero{
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
        background-color: #000;
    }
}

.pdf-container{
    position: relative;
    z-index: 1;
    direction: rtl;
    padding: 60px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pdf-page{
    width: 100%;
    max-width: 900px;
    padding: 55px 60px;
    margin-bottom: 45px;
    background: linear-gradient(160deg, rgba(22,22,26,0.82), rgba(8,8,12,0.9));
    backdrop-filter: blur(14px) saturate(125%);
    -webkit-backdrop-filter: blur(14px) saturate(125%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.07);
    position: relative;
    overflow: hidden;
    scroll-margin-top: 30px;
}

.pdf-page::before{
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #dd0707, #ff5e5e, #dd0707, transparent);
}

/* ========== LOGO ========== */

.pdf-page .logo-wrap{
    text-align: center;
    margin-bottom: 5px;
    margin-top: -30px;
}

.pdf-page .logo{
    max-width: 450px;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
}

@media (max-width: 768px){
    .pdf-page .logo{
        max-width: 350px;
    }
}

@media (max-width: 480px){
    .pdf-page .logo{
        max-width: 280px;
    }
}

/* ========== TYPOGRAPHY ========== */

.pdf-page p{
    font-family: 'Tajawal', sans-serif;
    font-size: 22px;
    line-height: 2;
    color: #fff;
    text-align: right;
    font-weight: 400;
    word-spacing: 2px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

.pdf-page .title{
    font-family: 'Tajawal', sans-serif;
    font-size: 52px;
    font-weight: 900;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 20px rgba(0,0,0,0.7);
    margin-bottom: 10px;
}

.pdf-page .subtitle{
    font-family: 'Tajawal', sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-align: center;
    text-shadow: 0 2px 15px rgba(0,0,0,0.6);
    margin-bottom: 25px;
}

.pdf-page .section-title{
    font-family: 'Tajawal', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-align: right;
    text-shadow: 0 2px 15px rgba(0,0,0,0.7);
    margin-top: 35px;
    margin-bottom: 15px;
}

.pdf-page .section-title.center,
.pdf-page .center{
    text-align: center;
}

.pdf-page .end-title{
    font-family: 'Tajawal', sans-serif;
    font-size: 42px;
    font-weight: 900;
    color: #dd0707;
    text-align: center;
    text-shadow: 0 2px 20px rgba(0,0,0,0.7);
    margin: 15px 0;
}

/* ========== HIGHLIGHT ========== */

.highlight{
    color: #dd0707;
    font-weight: 700;
}

/* ========== LABEL ========== */

.pdf-page .label{
    color: rgba(255,255,255,0.5);
    font-weight: 400;
}

/* ========== METADATA ========== */

.pdf-page .meta{
    margin: 20px 0;
}

.pdf-page .meta p{
    font-size: 20px;
    line-height: 1.8;
    color: rgba(255,255,255,0.85);
}

/* ========== NOTE ========== */

.pdf-page .note{
    font-size: 20px;
    line-height: 1.8;
    color: rgba(255,255,255,0.8);
    padding: 15px 20px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    margin: 15px 0;
}

/* ========== SEPARATOR ========== */

.pdf-page .sep{
    border: none;
    height: 1px;
    background: linear-gradient(to left, transparent, rgba(255,255,255,0.4), transparent);
    margin: 35px 0;
}

/* ========== LISTS ========== */

.pdf-page ul{
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.pdf-page ul li{
    font-family: 'Tajawal', sans-serif;
    font-size: 21px;
    line-height: 1.9;
    color: #fff;
    text-align: right;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    padding: 6px 30px 6px 0;
    position: relative;
}

.pdf-page ul li::before{
    content: "●";
    position: absolute;
    right: 0;
    top: 6px;
    color: #dd0707;
    font-size: 16px;
}

.pdf-page ul li strong{
    font-weight: 700;
    color: #fff;
}

/* ========== TABLE ========== */

.pdf-page table{
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}

.pdf-page table td,
.pdf-page table th{
    border: 1px solid rgba(255,255,255,0.2);
    padding: 12px 16px;
    color: #fff;
    font-size: 20px;
    line-height: 1.7;
    text-align: right;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    vertical-align: top;
    background: rgba(255,255,255,0.03);
}

.pdf-page table th{
    font-weight: 900;
    font-size: 21px;
    background: rgba(221,7,7,0.25);
    border-color: rgba(221,7,7,0.3);
}

.pdf-page table td:first-child,
.pdf-page table th:first-child{
    font-weight: 700;
    white-space: nowrap;
    width: 1%;
    background: rgba(255,255,255,0.08);
}

.pdf-page table th:first-child{
    background: rgba(221,7,7,0.25);
}

/* ========== MESSAGE BOX ========== */

.pdf-page .message-box{
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 25px 30px;
    margin: 20px 0;
}

.pdf-page .message-box p{
    font-size: 20px;
    line-height: 2;
    color: #fff;
}

/* ========== RECOMMENDATIONS ========== */

.pdf-page .recommendations{
    margin: 15px 0;
}

.pdf-page .recommendations p{
    font-size: 21px;
    line-height: 1.9;
    color: #fff;
    padding: 6px 0;
}

/* ========== TECH GRID ========== */

.pdf-page .tech-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.pdf-page .tech-item{
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 25px;
    transition: 0.3s;
}

.pdf-page .tech-item h3{
    font-family: 'Tajawal', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #dd0707;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    margin-bottom: 8px;
}

.pdf-page .tech-item > p{
    font-size: 18px;
    line-height: 1.6;
    color: rgba(255,255,255,0.7);
    margin-bottom: 10px;
}

.pdf-page .tech-item ul li{
    font-size: 17px;
    line-height: 1.7;
    padding: 3px 22px 3px 0;
}

.pdf-page .tech-item ul li::before{
    font-size: 12px;
    top: 4px;
}

/* ========== LEAD PARAGRAPH ========== */

.pdf-page p.lead{
    font-size: 23px;
    line-height: 2;
    color: rgba(255,255,255,0.95);
    font-weight: 400;
    border-right: 3px solid #dd0707;
    padding-right: 18px;
    margin: 18px 0;
}

/* ========== TABLE OF CONTENTS ========== */

.pdf-page .toc{
    margin: 25px 0;
}

.pdf-page .toc-item{
    display: flex;
    align-items: baseline;
    font-family: 'Tajawal', sans-serif;
    font-size: 21px;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    padding: 11px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.pdf-page .toc-item .toc-num{
    color: #dd0707;
    font-weight: 900;
    min-width: 42px;
}

.pdf-page .toc-item .toc-text{
    flex: 1;
    font-weight: 700;
}

.pdf-page .toc-item .toc-dots{
    flex: 1;
    border-bottom: 1px dotted rgba(255,255,255,0.25);
    margin: 0 10px;
    transform: translateY(-5px);
}

.pdf-page .toc-item .toc-page{
    color: rgba(255,255,255,0.6);
    font-weight: 700;
    min-width: 30px;
    text-align: left;
}

/* ========== PHASE TAG / BADGE ========== */

.pdf-page .phase-tag{
    display: inline-block;
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: rgba(221,7,7,0.85);
    border-radius: 30px;
    padding: 6px 20px;
    margin-bottom: 12px;
    text-shadow: none;
    letter-spacing: 0.5px;
}

.pdf-page .phase-tag.soft{
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.9);
}

/* ========== FEATURE CARDS ========== */

.pdf-page .feature-card{
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-right: 3px solid #dd0707;
    border-radius: 10px;
    padding: 20px 24px;
    margin: 16px 0;
}

.pdf-page .feature-card h3{
    font-family: 'Tajawal', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    margin-bottom: 6px;
}

.pdf-page .feature-card h3 .num{
    color: #dd0707;
    font-weight: 900;
    margin-left: 8px;
}

.pdf-page .feature-card p{
    font-size: 19px;
    line-height: 1.8;
    color: rgba(255,255,255,0.88);
    margin: 0;
}

/* ========== CALLOUT ========== */

.pdf-page .callout{
    background: rgba(221,7,7,0.12);
    border: 1px solid rgba(221,7,7,0.35);
    border-radius: 10px;
    padding: 18px 24px;
    margin: 22px 0;
}

.pdf-page .callout p{
    font-size: 20px;
    line-height: 1.85;
    color: #fff;
    margin: 0;
}

@media (max-width: 768px){
    .pdf-page p.lead{ font-size: 18px; }
    .pdf-page .toc-item{ font-size: 17px; }
    .pdf-page .feature-card h3{ font-size: 19px; }
    .pdf-page .feature-card p{ font-size: 16px; }
    .pdf-page .callout p{ font-size: 17px; }
}

@media (max-width: 480px){
    .pdf-page .toc-item{ font-size: 15px; padding: 9px 0; }
    .pdf-page .toc-item .toc-dots{ display: none; }
    .pdf-page .feature-card{ padding: 16px 18px; }
    .pdf-page .feature-card h3{ font-size: 17px; }
    .pdf-page .feature-card p{ font-size: 15px; }
}

/* ========== PAGE LABEL ========== */

.pdf-page .page-label{
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px){
    .pdf-container{
        padding: 20px 10px;
    }
    .pdf-page{
        padding: 30px 20px;
        margin-bottom: 20px;
    }
    .pdf-page .title{
        font-size: 34px;
    }
    .pdf-page .subtitle{
        font-size: 22px;
    }
    .pdf-page .section-title{
        font-size: 22px;
    }
    .pdf-page .end-title{
        font-size: 28px;
    }
    .pdf-page p{
        font-size: 18px;
        line-height: 1.8;
    }
    .pdf-page ul li{
        font-size: 17px;
        line-height: 1.7;
    }
    .pdf-page table td,
    .pdf-page table th{
        font-size: 16px;
        padding: 10px 12px;
    }
    .pdf-page table td:first-child{
        white-space: normal;
        width: auto;
    }
    .pdf-page .message-box p{
        font-size: 17px;
    }
    .pdf-page .recommendations p{
        font-size: 17px;
    }
    .pdf-page .note{
        font-size: 17px;
    }
    .pdf-page .tech-grid{
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .pdf-page .tech-item h3{
        font-size: 20px;
    }
    .pdf-page .tech-item ul li{
        font-size: 15px;
    }
    .pdf-page .meta p{
        font-size: 17px;
    }
}

@media (max-width: 480px){
    .pdf-container{
        padding: 10px 5px;
    }
    .pdf-page{
        padding: 20px 14px;
        margin-bottom: 15px;
    }
    .pdf-page .title{
        font-size: 26px;
    }
    .pdf-page .subtitle{
        font-size: 18px;
    }
    .pdf-page .section-title{
        font-size: 18px;
    }
    .pdf-page .end-title{
        font-size: 22px;
    }
    .pdf-page p{
        font-size: 16px;
        line-height: 1.7;
    }
    .pdf-page ul li{
        font-size: 15px;
        line-height: 1.6;
        padding: 4px 22px 4px 0;
    }
    .pdf-page table td,
    .pdf-page table th{
        font-size: 14px;
        padding: 8px 10px;
    }
    .pdf-page .meta p{
        font-size: 15px;
    }
    .pdf-page .message-box{
        padding: 15px 18px;
    }
    .pdf-page .message-box p{
        font-size: 15px;
    }
    .pdf-page .recommendations p{
        font-size: 15px;
    }
    .pdf-page .note{
        font-size: 15px;
        padding: 12px 14px;
    }
    .pdf-page .tech-item{
        padding: 18px;
    }
    .pdf-page .tech-item h3{
        font-size: 17px;
    }
}

/* =====================================================
   ENHANCEMENTS: NAVIGATION, ACTIONS & INTERACTIVITY
   ===================================================== */

html{
    scroll-behavior: smooth;
}

/* ---------- Reading progress bar ---------- */

.progress-bar{
    position: fixed;
    top: 0;
    right: 0;
    height: 4px;
    width: 0;
    background: linear-gradient(90deg, #dd0707, #ff6b6b);
    box-shadow: 0 0 12px rgba(221,7,7,0.7);
    z-index: 200;
    transition: width 0.1s linear;
}

/* ---------- Table of contents as links ---------- */

a.toc-item{
    text-decoration: none;
    border-radius: 12px;
    padding-right: 12px;
    padding-left: 12px;
    transition: background 0.25s ease, transform 0.25s ease;
}

a.toc-item:hover{
    background: rgba(221,7,7,0.14);
    transform: translateX(-6px);
}

a.toc-item:hover .toc-text{
    color: #ff6b6b;
}

a.toc-item:hover .toc-page{
    color: #fff;
}

/* ---------- Action buttons ---------- */

.pdf-page .btn-group{
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 28px 0 6px;
}

.btn{
    font-family: 'Tajawal', sans-serif;
    font-size: 18px;
    font-weight: 700;
    padding: 13px 32px;
    border-radius: 40px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.btn-primary{
    background: linear-gradient(135deg, #dd0707, #ff3b3b);
    color: #fff;
    box-shadow: 0 10px 24px rgba(221,7,7,0.45);
}

.btn-primary:hover{
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(221,7,7,0.6);
}

.btn-ghost{
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.28);
}

.btn-ghost:hover{
    background: rgba(255,255,255,0.18);
    transform: translateY(-3px);
}

/* ---------- Back to top ---------- */

.to-top{
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dd0707, #ff3b3b);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(221,7,7,0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
    z-index: 200;
}

.to-top.show{
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.to-top:hover{
    transform: translateY(-4px);
    background: linear-gradient(135deg, #ff2d2d, #ff5e5e);
}

/* ---------- Scroll reveal ---------- */

body.reveal-on .pdf-page{
    opacity: 0;
    transform: translateY(45px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

body.reveal-on .pdf-page.visible{
    opacity: 1;
    transform: none;
}

/* ---------- Hover interactions ---------- */

.pdf-page .tech-item:hover{
    transform: translateY(-6px);
    border-color: rgba(221,7,7,0.45);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 14px 30px rgba(0,0,0,0.35);
}

.pdf-page .feature-card{
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.pdf-page .feature-card:hover{
    transform: translateX(-8px);
    background: rgba(255,255,255,0.1);
    border-right-width: 5px;
}

.pdf-page table tr:hover td{
    background: rgba(221,7,7,0.1);
}

/* ---------- Responsive tweaks for actions ---------- */

@media (max-width: 768px){
    .btn{ font-size: 16px; padding: 11px 24px; }
    .to-top{ width: 48px; height: 48px; font-size: 22px; bottom: 20px; left: 20px; }
}

/* ---------- Mobile safeguard: wrap long terms, no overflow ---------- */

.pdf-page p,
.pdf-page li,
.pdf-page td,
.pdf-page .feature-card p,
.pdf-page .toc-item .toc-text{
    overflow-wrap: break-word;
}

@media (max-width: 480px){
    .pdf-page .btn-group{ flex-direction: column; }
    .btn{ justify-content: center; width: 100%; }
}

/* ---------- Print / Save as PDF ---------- */

@media print{
    *{
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .hero,
    .progress-bar,
    .to-top,
    .btn-group,
    .no-print{
        display: none !important;
    }
    body{
        background: #0c0c0e !important;
    }
    .pdf-container{
        padding: 0;
    }
    .pdf-page{
        background: #161618 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        border-radius: 0;
        border: none;
        margin: 0;
        max-width: 100%;
        opacity: 1 !important;
        transform: none !important;
        page-break-after: always;
    }
}
