/* General body and container styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0; /* Remove body padding, handled by main container or header/footer */
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensure footer is at bottom */
    position: relative;
}

/* Ad Banner Styles */
.ad-banner {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    padding: 12px 15px;
    margin: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s ease;
}

.ad-banner:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.ad-banner h3 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.ad-banner p {
    color: #4a5568;
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
}

.ad-banner a {
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
}

.ad-banner a:hover {
    text-decoration: underline;
}

/* Top Banner */
.top-banner {
    margin-bottom: 15px;
}

/* Side Banner */
.side-banner {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    z-index: 100;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .side-banner {
        display: none; /* Hide side banner on smaller screens */
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    header .container {
        padding: 8px 10px; /* Reduced vertical padding */
        min-height: auto;
        flex-direction: column; /* Stack items vertically */
        align-items: center; /* Center items */
    }
    
    header h1 {
        margin: 5px 0; /* Reduce margin around logo */
        text-align: center; /* Center logo */
    }
    
    .header-logo {
        max-height: 60px; /* Even smaller logo on mobile */
        width: auto; /* Maintain aspect ratio */
        margin: 0; /* Reset margin */
    }
    
    header nav {
        margin: 8px 0 0;
        width: 100%;
        order: 3;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px; /* Consistent gap between buttons */
    }
    
    .cta-button {
        margin: 2px;
        padding: 8px 12px; /* Slightly more padding for better touch targets */
        font-size: 0.9em;
        min-width: 120px; /* Minimum width for better touch targets */
        justify-content: center; /* Center button content */
        box-sizing: border-box; /* Include padding in width calculation */
    }
    
    .cta-button svg {
        width: 16px;
        height: 16px;
        margin-right: 6px;
        flex-shrink: 0; /* Prevent icon from shrinking */
    }
    
    html[dir="rtl"] .cta-button svg {
        margin-right: 0;
        margin-left: 6px;
    }
    
    /* Adjust for very small screens */
    @media (max-width: 400px) {
        .cta-button {
            width: calc(50% - 10px); /* Two buttons per row on very small screens */
            margin: 3px;
            padding: 8px 5px;
            font-size: 0.8em;
        }
        
        .header-logo {
            max-height: 50px;
        }
    }
}

/* Main content area adjustment for side banner */
.main-content-area {
    margin-right: 20px; /* Add space for side banner */
}

@media (max-width: 1200px) {
    .main-content-area {
        margin-right: 0;
    }
}

.container {
    width: 90%; /* More responsive width */
    max-width: 1100px; /* Max width for larger screens */
    margin: 20px auto; /* Centering */
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Remove margin from .container if it's inside header/footer/main that already has spacing */
header .container,
footer .container,
main.container {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 15px; /* Padding inside header/footer/main containers */
    padding-bottom: 15px;
}

main.container {
    flex: 1; /* Allows main content to grow and push footer down */
    margin-top: 20px; /* Space below header */
    margin-bottom: 20px; /* Space above footer */
}


/* Header styles */
header {
   /*  background-color: #0056b3; Darker blue for header */
    background-color: #72b6ee;
    color: white;
    padding: 15px 0; /* Vertical padding */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: transparent; /* Make header container transparent */
    box-shadow: none;
    padding: 0 15px; /* Ensure padding for content within header container */
    max-width: 1100px; /* Consistent max-width */
    margin: 0 auto; /* Centering for the inner container */
    min-height: 70px; /* Added max height for header container */
    flex-wrap: nowrap; /* Prevent wrapping in full screen */
    transition: all 0.3s ease; /* Smooth transitions for responsive changes */
}

header h1 {
    margin: 0;
    font-size: 1.8em;
    color: white; /* Ensure h1 color is white */
    text-align: right; /* Align header title to the right for RTL */
}

header h1 a {
    color: white;
    text-decoration: none;
}

.header-logo {
    max-height: 120px; /* Adjust as needed */
    margin-right: 10px; /* Space between logo and text */
    vertical-align: middle; /* Align with text */
}

html[dir="rtl"] .header-logo {
    margin-left: 10px;
    margin-right: 0;
}

.logo-text {
    font-family: 'Tahoma', 'Geneva', sans-serif; /* A slightly more distinct font */
    font-weight: bold;
    font-size: 1.5em; /* Make the logo text a bit larger than default h1 */
    color: #ffffff; /* Keep it white, or choose a light accent color */
    /* You could add text-shadow or other effects here too */
    /* Example: text-shadow: 1px 1px 2px rgba(0,0,0,0.2); */
}

header nav {
    display: flex;
    align-items: center;
    gap: 10px; /* Consistent spacing between nav items */
    white-space: nowrap; /* Prevent wrapping of nav items */
}

header nav a {
    color: #f0f0f0; /* Lighter color for nav links */
    text-decoration: none;
    font-size: 1.1em;
    background-color: transparent; /* Remove button-like background */
    padding: 5px 0; /* Adjust padding */
    border-radius: 0;
    margin: 0; /* Reset margins */
    flex-shrink: 0; /* Prevent shrinking */
}

header nav a:last-child {
    margin-right: 0;
}

header nav a:hover {
    color: #ffffff; /* Brighter on hover */
    text-decoration: underline;
    background-color: transparent;
}

/* Footer styles */
footer {
    background-color: #343a40; /* Dark grey for footer */
    color: #f8f9fa; /* Light text for footer */
    text-align: center;
    padding: 20px 0;
    margin-top: auto; /* Pushes footer to the bottom if content is short */
}

footer .container {
    background-color: transparent; /* Make footer container transparent */
    box-shadow: none;
    padding: 0 20px; /* Ensure padding for content within footer container */
    max-width: 1100px; /* Consistent max-width */
    margin: 0 auto; /* Centering for the inner container */
}

footer p {
    margin: 0;
    font-size: 0.9em;
}

/* RTL specific adjustments for header */
html[dir="rtl"] header nav a {
    margin-left: 20px; /* Space between nav links for RTL */
    margin-right: 0;
}

html[dir="rtl"] header nav a:last-child {
    margin-left: 0;
}

/* Existing styles below, check for conflicts or redundancies */
html[dir="rtl"] body {
    text-align: right;
}

/* Styles for thumbnails and file items from viewer_content_listing.ejs */
.thumbnail {
    width: 50px; /* Adjust as needed */
    height: auto; /* Maintain aspect ratio */
    margin-right: 10px; /* For LTR, adjust for RTL below */
    vertical-align: middle;
    border-radius: 4px; /* Optional: add some rounding */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Optional: add a subtle shadow */
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.file-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.file-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.file-thumbnail {
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

.file-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-name {
    font-size: 0.9em;
    text-align: center;
    word-break: break-word;
}

.page-item {
    display: inline-block; /* Allows items to sit in a row */
    margin: 0 2px; /* Adds a small gap between page items */
    background-color: transparent; /* Override general li background for pagination */
}

html[dir="rtl"] .thumbnail {
    margin-left: 10px;
    margin-right: 0;
}

html[dir="rtl"] .container h1 {
    text-align: right;
}

/* Styles for file link layout - to make image and text side-by-side */
.file-link-flex {
    display: flex;
    align-items: center; /* Vertically align items in the middle */
    text-decoration: none;
    color: inherit;
}


html[dir="rtl"] ul {
    padding-right: 0; /* Reset for RTL if default padding-left is an issue */
}

.boxes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Space between boxes */
    justify-content: center; /* Center boxes if they don't fill the row */
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Hide the 'فيديوهات التأسيس' box on the specific course page */
a.box[href="/course/%D8%AF%D9%88%D8%B1%D8%A9%20%D8%A7%D9%8A%D9%87%D8%A7%D8%A8%20%D8%A3%D8%BA%D8%B3%D8%B7%D8%B3/foundation-videos"] {
    display: none;
}

.box {
    flex: 1 1 300px; /* Grow, shrink, basis of 300px - allows wrapping */
    max-width: 350px; /* Max width for a box */
    background-color: #4197f3;
    color: white;
    padding: 25px;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.box:hover {
   /* background-color: #0056b3;*/
    background-color: #72b6ee;
    transform: translateY(-5px);
}

.box h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.75em;
    color: white;
}

.box p {
    font-size: 1em;
    color: #f0f0f0;
}

/* Modal Basic Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
}

.modal-content {
    background-color: #fefefe;
    margin: auto; /* Auto margin for centering, works with flex */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px; /* Max width for the modal */
    border-radius: 8px;
    position: relative; /* For positioning the close button */
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#videoModalTitle {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
    color: #333;
}

#modalVideoPlayer {
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    max-height: 70vh; /* Limit height to 70% of viewport height */
    background-color: #000; /* Black background for video player */
    border-radius: 4px;
}

.header-container nav a:last-of-type {
    margin-right: 0; /* Remove margin from the last nav item if it was generic */
}

/* CTA Button Styles */
.cta-button {
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600; /* Slightly bolder for better readability */
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    margin: 0; /* Remove margin */
    white-space: nowrap;
    font-size: 0.95em;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow for depth */
    flex-shrink: 0; /* Prevent buttons from shrinking */
    min-width: 120px; /* Ensure consistent minimum width */
}

.telegram-cta {
    background-color: #0088cc; /* Telegram blue */
    color: white;
}

.telegram-cta:hover {
    background-color: #0077b3; /* Darker blue on hover */
    transform: translateY(-1px);
    color: white; /* Ensure text color remains white on hover */
}

.whatsapp-cta {
    background-color: #25D366; /* WhatsApp green */
    color: white;
}

.whatsapp-cta:hover {
    background-color: #128C7E; /* Darker green on hover */
    transform: translateY(-1px);
    color: white;
}

/* WhatsApp icon specific styles */
.whatsapp-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: auto;
    min-width: 100px; /* Ensure minimum width for better touch targets */
    margin: 0; /* Remove margin */
}

.whatsapp-cta span {
    order: 2; /* Text comes first in the DOM order */
    margin-right: 8px; /* Space between text and icon */
}

.whatsapp-cta svg {
    order: 1; /* Icon comes after text in the DOM order */
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.3));
    flex-shrink: 0; /* Prevent icon from shrinking */
    margin-left: auto; /* Push icon to the right */
}

/* Ensure the phone part of the icon is visible */
.whatsapp-cta svg path:first-child {
    fill: #075E54; /* Darker green for the phone part */
}

/* Ensure the circle part of the icon is visible */
.whatsapp-cta svg path:last-child {
    fill: #25D366; /* WhatsApp green for the circle */
}

/* Hover state for better visibility */
.whatsapp-cta:hover svg path:first-child {
    fill: #054d3d; /* Even darker green on hover */
}

.whatsapp-cta:hover svg path:last-child {
    fill: #128C7E; /* Darker green on hover */
}

/* RTL support for WhatsApp button */
html[dir="rtl"] .whatsapp-cta {
    flex-direction: row; /* Keep text on left, icon on right in RTL */
}

/* Adjust spacing in RTL */
html[dir="rtl"] .whatsapp-cta span {
    margin-right: 10px;
    margin-left: 8px;
    order: 2; /* Keep text first in RTL */
}

html[dir="rtl"] .whatsapp-cta svg {
    margin-left: 0;
    margin-right: auto; /* Push icon to the right in RTL */
    order: 1; /* Keep icon after text in RTL */
}

/* Style for the SVG icon within the CTA */

/* Adjustments for RTL if necessary */
html[dir="rtl"] .header-container nav .cta-button {
    margin-left: 0;
    margin-right: 10px; /* Space from other nav items in RTL */
}

html[dir="rtl"] .telegram-cta svg {
    margin-right: 0;
    margin-left: 5px; /* Space icon to the left of text in RTL */
}

/* Ensure existing styles don't conflict too much */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* A font that supports Arabic well */
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 20px auto;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    background-color: #eee;
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

li a {
    text-decoration: none;
    color: #4197f3;
    font-weight: bold;
}

li a:hover {
    text-decoration: underline;
}

/* Pagination Styles */
.pagination-nav {
    display: flex; /* Use flex to center the ul.pagination */
    justify-content: center; /* Center the pagination block */
    margin-top: 20px;
    margin-bottom: 20px;
}

.pagination {
    display: inline-flex; /* Makes the UL only as wide as its content, and allows flex items */
    list-style: none;
    padding-left: 0; /* Remove default UL padding */
    border-radius: 4px; /* Optional: rounded corners for the whole pagination bar */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); /* Optional: subtle shadow */
}

.page-item {
    display: inline-block; 
    margin: 0 2px; 
    background-color: transparent; /* Override general li background for pagination items */
}

.page-item:first-child .page-link {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.page-item:last-child .page-link {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.page-link {
    position: relative;
    display: block; /* Or inline-block if not using flex on parent */
    padding: 0.5rem 0.75rem;
    margin-left: -1px; /* Create the "attached" look */
    line-height: 1.25;
    color: #4197f3;
    background-color: #fff;
    border: 1px solid #dee2e6;
    text-decoration: none; /* Remove underline from links */
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.page-link:hover {
    z-index: 2;
    /*color: #0056b3;*/
    color: #72b6ee;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #4197f3;
    border-color: #4197f3;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* RTL adjustments for pagination */
html[dir="rtl"] .page-link {
    margin-left: 0;
    margin-right: -1px; /* Create the "attached" look for RTL */
}

html[dir="rtl"] .page-item:first-child .page-link {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

html[dir="rtl"] .page-item:last-child .page-link {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

nav a {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 15px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

nav a:hover {
    background-color: #218838;
}

form {
    margin-top: 20px;
    padding: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
}

input[type="file"] {
    display: block;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: calc(100% - 22px); /* Adjust for padding and border */
}

button {
    background-color: #4197f3;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    /*background-color: #0056b3;*/
    background-color: #72b6ee;
}

.message {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

p.no-files {
    text-align: center;
    color: #6c757d;
}


