/* ==========================================================================
   Design System Setup & Root Variables (Unmodified)
   ========================================================================== */
:root {
    --primary: #082C5D;
    --secondary: #061F42;
    --accent: #FF914D;

    --bg-color: #F7F9FC;
    --bg-light: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --glass-bg: rgba(255,255,255,.85);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --font-family: 'Cairo', sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);

    --transition: all .3s ease;
}

/* Premium Dark Mode Override Variables */
[data-theme="dark"] {
    --primary: #3b82f6;
    --secondary: #0f172a;
    --bg-color: #090d16;
    --bg-light: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: #111827;
    --border-color: #1f2937;
    --glass-bg: rgba(17, 24, 39, 0.85);
    --shadow-md: 0 4px 10px rgba(0,0,0,.3);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.4);
}

/* ==========================================================================
   Global & Reset Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.75;
    transition: background-color var(--transition), color var(--transition);
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */
.progress-container {
    width: 100%;
    height: 4px;
    background: transparent;
    position: fixed;
    top: 0;
    z-index: 1001;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    width: 0%;
    border-radius: 0 4px 4px 0;
    transition: width 0.1s ease-out;
}

/* ==========================================================================
   SaaS Premium Glassmorphism Header
   ========================================================================== */
.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
}

.logo {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-accent {
    color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: rotate(15deg);
}

/* ==========================================================================
   Buttons Architecture
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn-outline {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Premium Hero Section
   ========================================================================== */
.hero {
    margin-top: 75px;
    padding: 90px 0 70px 0;
    background: radial-gradient(circle at top right, rgba(8, 44, 93, 0.08), transparent), linear-gradient(135deg, var(--secondary) 0%, #0d1e36 100%);
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--accent);
    filter: blur(150px);
    opacity: 0.15;
    top: -50px;
    left: -50px;
}

.hero-content {
    max-width: 850px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.badge-container {
    margin-bottom: 20px;
}

.hero-badge {
    background: rgba(255, 145, 77, 0.15);
    color: var(--accent);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid rgba(255, 145, 77, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.88;
    max-width: 720px;
    margin: 0 auto 35px auto;
    font-weight: 400;
}

/* ==========================================================================
   2-Column Layout (TOC Sidebar + Content Area)
   ========================================================================== */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 45px;
    padding: 70px 24px;
    align-items: start;
}

/* Sticky TOC Sidebar */
.sidebar {
    position: sticky;
    top: 110px;
}

.toc-glass {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.toc-glass h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.toc-glass ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
}

.toc-link i {
    font-size: 0.95rem;
    opacity: 0.7;
}

.toc-link:hover {
    background: var(--bg-color);
    color: var(--primary);
}

.toc-link.active {
    background: rgba(8, 44, 93, 0.06);
    color: var(--primary);
    border-right: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Dark Mode adjustment for active TOC item */
[data-theme="dark"] .toc-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-right-color: var(--primary);
}

/* ==========================================================================
   Content Cards Structure
   ========================================================================== */
.content {
    display: flex;
    flex-direction: column;
    gap: 35px;
}

.term-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 35px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.term-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: rgba(8, 44, 93, 0.15);
}

[data-theme="dark"] .term-card:hover {
    border-color: rgba(59, 130, 246, 0.25);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
}

.icon-box {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.iprimary { background: rgba(8, 44, 93, 0.08); color: var(--primary); }
.isuccess { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.iwarning { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.idanger { background: rgba(239, 68, 68, 0.08); color: var(--danger); }
.iaccent { background: rgba(255, 145, 77, 0.1); color: var(--accent); }

[data-theme="dark"] .iprimary { background: rgba(59, 130, 246, 0.15); }

.card-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-body p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 16px;
}

/* Modern Document Lists */
.custom-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 10px;
}

.custom-list li {
    position: relative;
    padding-right: 28px;
    color: var(--text-muted);
    font-size: 1.02rem;
}

.custom-list li::before {
    content: '\f058'; /* Font Awesome Check Circle */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0;
    top: 2px;
    color: var(--success);
    font-size: 1.1rem;
}

/* Contact Specific Widget Card */
.contact-card-section {
    background: linear-gradient(to bottom, var(--card-bg), var(--bg-color));
}

.contact-info-widget {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 24px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.info-item i {
    font-size: 1.4rem;
    color: var(--accent);
    width: 24px;
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.info-value {
    display: block;
    font-size: 1.05rem;
    color: var(--text-main);
    font-weight: 700;
}

.btn-contact-action {
    margin-top: 10px;
    width: 100%;
}

/* ==========================================================================
   Site Footer Structure
   ========================================================================== */
.site-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 45px 0;
    margin-top: 60px;
    text-align: center;
}

.footer-brand h3 {
    color: var(--primary);
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer-brand span {
    font-weight: 700;
    color: var(--text-main);
}

.footer-copyright {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Back To Top Interaction Element
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: var(--primary);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: var(--transition);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent);
    transform: translateY(-4px);
}

/* ==========================================================================
   Scroll Reveal Animation Baseline
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints Layout Design
   ========================================================================== */
@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 35px;
    }

    .sidebar {
        position: static;
    }

    .toc-glass ul {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.3rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .header-actions .btn-outline {
        display: none;
    }

    .term-card {
        padding: 24px;
    }
}