/* =========================================================================
   دليل المستخدم - Exam Master User Guide Styles
   يرث من Landing Page ويضيف أنماط خاصة بالدليل
   ========================================================================= */

/* =========================================================================
   CSS Variables (inherited + extended)
   ========================================================================= */
:root {
    --sidebar-width: 280px;
    --sidebar-collapsed: 60px;
    --topbar-height: 70px;
    --guide-bg: #f0f4f8;
    --card-bg: #ffffff;
    --card-border: rgba(37, 99, 235, 0.08);
    --step-color: #2563eb;
    --step-bg: rgba(37, 99, 235, 0.08);
    --tip-bg: rgba(56, 189, 248, 0.08);
    --tip-border: #38bdf8;
    --warning-bg: rgba(245, 158, 11, 0.08);
    --warning-border: #f59e0b;
    --info-bg: rgba(99, 102, 241, 0.08);
    --info-border: #6366f1;
    --role-admin: #2563eb;
    --role-officer: #059669;
    --role-rep: #7c3aed;
    --role-monitor: #d97706;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
    --transition-main: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================================
   Layout: Guide Container
   ========================================================================= */
body.guide-body {
    font-family: 'Cairo', sans-serif;
    background: var(--guide-bg);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.8;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.04), transparent 40%),
        radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.04), transparent 40%);
}

.guide-layout {
    display: flex;
    min-height: 100vh;
}

/* =========================================================================
   Sidebar Navigation
   ========================================================================= */
.guide-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(37, 99, 235, 0.08);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition-main);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.04);
}

.sidebar-header {
    padding: 24px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.sidebar-brand {
    color: #fff;
}

.sidebar-brand h3 {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.sidebar-brand span {
    font-size: 0.75rem;
    opacity: 0.8;
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.15);
    border-radius: 4px;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 12px 6px;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-main);
    text-decoration: none;
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: var(--step-bg);
    color: var(--primary-color);
}

.nav-item.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-item .nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 8px 12px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-main);
}

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

/* =========================================================================
   Main Content Area
   ========================================================================= */
.guide-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
}

/* =========================================================================
   Top Bar
   ========================================================================= */
.guide-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0 40px;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0;
}

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition-main);
}

.mobile-menu-btn:hover {
    background: var(--step-bg);
}

/* =========================================================================
   Sections
   ========================================================================= */
.guide-section {
    display: none;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    animation: fadeInSection 0.5s ease-out;
}

.guide-section.active {
    display: block;
}

@keyframes fadeInSection {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(37, 99, 235, 0.08);
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--secondary-color);
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h1 .section-icon {
    font-size: 1.6rem;
}

.section-header p {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.7;
}

/* =========================================================================
   Content Cards
   ========================================================================= */
.guide-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-main);
}

.guide-card:hover {
    box-shadow: var(--shadow-hover);
}

.guide-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-card p {
    color: #475569;
    line-height: 1.85;
    margin: 0 0 12px;
}

.guide-card p:last-child {
    margin-bottom: 0;
}

/* =========================================================================
   Screenshots
   ========================================================================= */
.screenshot-wrapper {
    margin: 20px 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: var(--transition-main);
    cursor: pointer;
    position: relative;
}

.screenshot-wrapper:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.screenshot-wrapper img {
    width: 100%;
    display: block;
    transition: var(--transition-main);
}

.screenshot-caption {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 12px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.screenshot-caption::before {
    content: '🖼️';
}

/* Zoom overlay icon */
.screenshot-wrapper .zoom-hint {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0;
    transition: var(--transition-main);
}

.screenshot-wrapper:hover .zoom-hint {
    opacity: 1;
}

/* =========================================================================
   Video Embed
   ========================================================================= */
.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin: 16px 0;
    background: #000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* Video Link Card (Alternative to iframe) */
.video-link-card {
    display: flex;
    gap: 20px;
    align-items: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(56, 189, 248, 0.05));
    border: 2px solid rgba(37, 99, 235, 0.15);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    transition: var(--transition-main);
}

.video-link-card:hover {
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.video-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 280px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.video-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition-main);
}

.video-thumbnail:hover img {
    transform: scale(1.05);
}

.video-thumbnail .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 0, 0, 0.9);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    padding-left: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: var(--transition-main);
}

.video-thumbnail:hover .play-button {
    background: rgba(255, 0, 0, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
    flex: 1;
}

.video-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0 0 8px;
}

.video-info p {
    color: #475569;
    font-size: 0.9rem;
    margin: 0 0 16px;
    line-height: 1.6;
}

.watch-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition-main);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
}

.watch-video-btn:hover {
    background: linear-gradient(135deg, #cc0000, #990000);
    box-shadow: 0 6px 16px rgba(255, 0, 0, 0.3);
    transform: translateY(-2px);
}

.watch-video-btn span {
    font-size: 1.2rem;
}

/* =========================================================================
   Steps
   ========================================================================= */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step-counter;
}

.steps-list li {
    counter-increment: step-counter;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    line-height: 1.8;
    color: #475569;
}

.steps-list li:last-child {
    border-bottom: none;
}

.steps-list li::before {
    content: counter(step-counter);
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--step-bg);
    color: var(--step-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    margin-top: 2px;
}

/* =========================================================================
   Callouts (Tips, Warnings, Info)
   ========================================================================= */
.callout {
    padding: 18px 22px;
    border-radius: 12px;
    margin: 20px 0;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.92rem;
    line-height: 1.75;
}

.callout-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.callout-tip {
    background: var(--tip-bg);
    border-right: 4px solid var(--tip-border);
    color: #0c4a6e;
}

.callout-warning {
    background: var(--warning-bg);
    border-right: 4px solid var(--warning-border);
    color: #78350f;
}

.callout-info {
    background: var(--info-bg);
    border-right: 4px solid var(--info-border);
    color: #312e81;
}

/* =========================================================================
   Role Badges
   ========================================================================= */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.role-admin {
    background: rgba(37, 99, 235, 0.1);
    color: var(--role-admin);
}

.role-officer {
    background: rgba(5, 150, 105, 0.1);
    color: var(--role-officer);
}

.role-rep {
    background: rgba(124, 58, 237, 0.1);
    color: var(--role-rep);
}

.role-monitor {
    background: rgba(217, 119, 6, 0.1);
    color: var(--role-monitor);
}

/* =========================================================================
   Roles Table
   ========================================================================= */
.roles-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.roles-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 14px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: right;
}

.roles-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.88rem;
    color: #475569;
    vertical-align: top;
}

.roles-table tr:last-child td {
    border-bottom: none;
}

.roles-table tr:nth-child(even) td {
    background: rgba(37, 99, 235, 0.02);
}

.roles-table .check {
    color: #059669;
    font-weight: 700;
}

.roles-table .cross {
    color: #dc2626;
}

/* =========================================================================
   Feature List
   ========================================================================= */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}

.feature-list li {
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    font-size: 0.92rem;
}

.feature-list li::before {
    content: '✓';
    color: #059669;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

/* =========================================================================
   Lightbox
   ========================================================================= */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 40px;
    cursor: zoom-out;
    animation: fadeIn 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: scaleIn 0.3s ease;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-main);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* =========================================================================
   Welcome Hero (Intro Section)
   ========================================================================= */
.guide-hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 48px 40px;
    border-radius: 20px;
    color: #fff;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.2);
}

.guide-hero-logo {
    width: 90px;
    height: 90px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.guide-hero-text h1 {
    color: #fff;
    font-size: 1.8rem;
    margin: 0 0 8px;
}

.guide-hero-text p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    margin: 0;
    line-height: 1.7;
}

/* =========================================================================
   Quick Nav Grid (Intro Section)
   ========================================================================= */
.quick-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 24px;
}

.quick-nav-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-main);
    text-decoration: none;
    color: var(--text-dark);
}

.quick-nav-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(37, 99, 235, 0.2);
}

.quick-nav-item .qn-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.quick-nav-item .qn-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* =========================================================================
   Inline Keyboard Shortcuts
   ========================================================================= */
.kbd {
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--secondary-color);
    border: 1px solid #cbd5e1;
}

/* =========================================================================
   Progress indicator
   ========================================================================= */
.reading-progress {
    position: fixed;
    top: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    z-index: 200;
    transition: width 0.2s ease;
    border-radius: 0 0 0 2px;
}

/* =========================================================================
   Responsive Design
   ========================================================================= */
@media (max-width: 992px) {
    .guide-sidebar {
        transform: translateX(100%);
        box-shadow: none;
    }

    .guide-sidebar.open {
        transform: translateX(0);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    }

    .guide-content {
        margin-right: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 99;
    }

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

    .guide-section {
        padding: 24px 20px;
    }

    .guide-topbar {
        padding: 0 20px;
    }

    .guide-hero {
        flex-direction: column;
        text-align: center;
        padding: 32px 24px;
    }

    .quick-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .section-header h1 {
        font-size: 1.5rem;
    }

    .guide-card {
        padding: 20px 16px;
    }

    .quick-nav-grid {
        grid-template-columns: 1fr;
    }

    .roles-table {
        font-size: 0.8rem;
    }

    .roles-table th,
    .roles-table td {
        padding: 8px 10px;
    }

    .video-link-card {
        flex-direction: column;
        padding: 16px;
    }

    .video-thumbnail {
        width: 100%;
    }

    .video-info h4 {
        font-size: 1rem;
    }

    .watch-video-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================================
   Print Styles
   ========================================================================= */
@media print {
    .guide-sidebar,
    .guide-topbar,
    .mobile-menu-btn,
    .sidebar-overlay,
    .reading-progress {
        display: none !important;
    }

    .guide-content {
        margin-right: 0 !important;
    }

    .guide-section {
        display: block !important;
        page-break-after: always;
        padding: 20px;
    }

    .screenshot-wrapper {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
