/* Google Fonts Import */
/* Inter for LTR (English) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');
/* Vazirmatn for RTL (Persian) - Using Google Fonts for better stability and variable font support */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap');

/* Base HTML and Body Styles */
html {
    font-size: 16px; /* Base font size for rem units */
}

body {
    background-color: rgb(15, 43, 81); /* Using rgb for consistency, was rgba */
    margin: 0; /* Remove default body margins */
    padding: 0; /* Remove default body padding */
    box-sizing: border-box; /* Ensure padding and border are included in element's total width/height */
    overflow-x: hidden; /* Prevent horizontal scroll bar from margin/padding issues */
    /* direction and font-family and text-align will be set by JS based on rtl-mode/ltr-mode classes */
}

/* Font Assignments based on mode */
body.ltr-mode {
    font-family: 'Inter', sans-serif;
    direction: ltr;
    text-align: left;
}
body.rtl-mode {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    text-align: right;
}

/* Base Image Styles (apply generally, more specific classes override as needed) */
img {
    max-width: 100%; /* Ensure images are responsive and don't overflow */
    height: auto; /* Maintain aspect ratio */
}

.center { /* For block-level centering */
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Header and Navigation Styles */
header {
    position: relative;
    z-index: 1000; /* Ensure header is on top */
}

.topnav.navbar { /* Main navigation container */
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Allows items to wrap on smaller screens */
    width: 100%;
    background-color: #163b75;
    box-sizing: border-box;
    padding: 0px; /* Added padding for content inside topnav, will be handled by box-sizing */
    position: fixed; /* Keep navbar fixed at the top */
    top: 0;
    left: 0;
    min-height: 50px; /* Ensure minimum height for consistency */
    justify-content: space-between; /* Spreads nav-links-group and utility-group */
    margin: 0; /* **Crucial: Remove any negative margins if they were here** */
}

/* Adjust main content padding to prevent it from being hidden by the fixed navbar */
main {
    padding-top: 50px; /* Match min-height of .topnav */
    box-sizing: border-box;
    /* other main styles from styles-about.css or specific to index.html if present */
}

/* Grouping for main navigation links */
.nav-links-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px; /* Spacing between links within the group */
}

/* Grouping for lang dropdown and social icons */
.utility-group {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between lang dropdown and social */
}

/* Navigation links (general) */
.topnav a {
    font-size: 1rem; /* Use rem for scalability */
    color: white;
    text-align: center; /* Will be overridden by RTL/LTR specific styles if needed */
    padding: 16px; /* Consistent padding for nav links */
    text-decoration: none;
    border: none;
    outline: none;
    box-sizing: border-box;
    transition: background-color 0.3s ease; /* Smooth transition for hover */
}

/* Specific Logo within topnav (small logo) */
.topnav .logo {
    width: 20px;
    height: 20px;
    vertical-align: middle; /* Align with text */
    padding: 0; /* Reset padding for the logo image itself */
    margin: 0; /* Ensure no extra margin */
}

.topnav a:hover {
    background-color: #5c99df;
    color: black;
}

.topnav .active {
    background-color: #4aab87;
    /* padding here is fine if it makes it visually distinct */
    padding: 15px;
}

/* Subnavigation (Download) */
.subnav {
    position: relative;
    overflow: visible; /* Allows dropdown content to be visible */
}

.subnav .subnavbtn {
    font-size: 1rem;
    border: none;
    outline: none;
    color: white;
    padding: 1rem; /* Consistent padding */
    background-color: inherit;
    font-family: inherit; /* Inherit Vazirmatn/Inter */
    margin: 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.subnav-content {
    display: none; /* Hidden by default, JS will show/hide */
    position: absolute;
    background-color: #1e457f;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    flex-direction: column; /* Stack items vertically */
    top: 100%; /* Position below the button */
    border-radius: 5px; /* Consistent rounded corners */
    overflow: hidden; /* Ensures child elements don't spill outside rounded corners */
}

.subnav-content a {
    float: none; /* Remove float for block display within flex column */
    padding: 0.75rem 1rem; /* Use rem for dropdown item padding */
    white-space: nowrap; /* Prevent text wrapping */
    font-size: 0.95rem; /* Slightly smaller for dropdown items */
    text-align: left; /* Default text alignment */
}

.subnav-content a:hover {
    background-color: #2d64b6;
    color: black;
}

/* Class added by JS to show the dropdown */
.subnav.open .subnav-content {
    display: flex; /* Show as flex column */
}


/* Language Dropdown Button & Content */
.lang-dropdown {
    position: relative;
}

.lang-dropdown-btn {
    background-color: #0c2b53;
    color: white;
    border: 1px solid #2d64b6;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lang-dropdown-btn:hover {
    background-color: #2d64b6;
}

.lang-dropdown-content {
    display: none; /* Hidden by default */
    position: absolute;
    background-color: #1e457f;
    min-width: 120px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 5px;
    overflow: hidden;
    top: 100%; /* Position below the button */
}

.lang-option {
    color: white;
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block; /* Make options block-level */
    background-color: inherit;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap; /* Prevent text wrapping */
    font-size: 0.9rem;
    text-align: left; /* Default text alignment */
}

.lang-option:hover {
    background-color: #2d64b6;
}

.lang-option.active {
    background-color: #4aab87;
    font-weight: bold;
}

.lang-dropdown.open .lang-dropdown-content {
    display: block; /* Show when 'open' class is added by JS */
}

/* Social Icons */
.social {
    display: flex;
    align-items: center;
}

.social-icons-group { /* Replaced .m-s-top in HTML */
    display: flex;
    align-items: center;
    gap: 0.3rem; /* Spacing between social icons */
}

.social a {
    padding: 1rem; /* Consistent padding */
    color: white;
    text-decoration: none;
    font-size: 1rem; /* Consistent font size */
}


/* Main Content Sections - Specific to index.html layout */
.img-top { /* Container for the main banner image */
    padding-top: 1.5rem; /* Space from navbar */
    margin-bottom: 25px; /* Space below the banner */
}

.img-top img { /* Specific styling for the main banner image itself */
    max-width: 800px; /* Limit max width for large screens */
    width: 100%; /* Ensure it's responsive and scales down */
    object-fit: contain; /* Image scales without cropping to fit container */
    display: block;
    margin: auto; /* Center the image horizontally */
}

h1, h2 {
    color: rgba(250, 253, 255, 0.8);
    text-align: center;
    margin-bottom: 0.6rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    color: rgba(250, 253, 255, 0.8);
    font-size: 1.1rem;
    margin-top: 0.6rem;
    margin-bottom: 0.3rem;
}

.section-break {
    position: relative;
    margin-top: 1.5rem;
    padding: 0.5rem;
    padding-bottom: 3.75rem;
    width: auto;
    min-height: auto;
    box-sizing: border-box;
}

.section-color {
    background-color: #12335f;
    font-size: 0.9rem;
    color: rgba(250, 253, 255, 0.8);
}

.section-break p {
    text-align: center;
    font-size: 1.125rem;
}

/* Card/Child Layout (used for features in index.html) */
.parent {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.25rem;
}

.child {
    flex-grow: 1;
    flex-basis: 300px; /* Minimum width for flex item */
    max-width: 400px; /* Maximum width for flex item */
    text-align: center;
    border: 1px solid #2d64b6;
    margin: 0.3rem;
    background-color: #1e457f;
    box-sizing: border-box;
    border-radius: 0.75rem;
    padding-bottom: 1rem; /* Add padding to child instead of image for spacing */

    display: flex;
    flex-direction: column;
    min-height: 450px; /* Set a minimum height for consistent card size */
}

/* Image wrapper for consistent image areas within cards */
.image-wrapper {
    height: 200px; /* Fixed height for the image container */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Hide any overflow if image is too large */
    padding: 0.6rem;
    box-sizing: border-box;
}

.image-wrapper img {
    max-width: 100%; /* Ensure image fits wrapper */
    max-height: 100%; /* Ensure image fits wrapper */
    object-fit: contain; /* Ensure image fits without cropping */
    display: block; /* Remove extra space below images */
}

.description {
    position: relative;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    border-bottom-right-radius: 0.6rem;
    border-bottom-left-radius: 0.6rem;
    background-color: #153c75;
    height: fit-content;
    box-sizing: border-box;
    flex-grow: 1; /* Allow description to grow and fill available space */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute content vertically */
    min-height: 100px; /* Ensure minimum height for description content */
}

.description p {
    margin-bottom: 0.3rem;
    margin-top: 0.3rem;
}

/* Shadow Classes */
.m-shadow {
  filter: drop-shadow(0 0.3rem 0.35rem rgba(0, 0, 0, 0.4)); /* Use rem values if desired for shadow */
}
.m-shadow-des {
  filter: drop-shadow(0 -0.5rem 1rem rgba(0, 0, 0, 0.4)); /* Use rem values if desired for shadow */
}

/* Footer Styles */
.footer {
    text-align: center;
    color: aliceblue;
    padding: 1rem 15px; /* Use rem, and 15px horizontal padding */
    margin-top: 0.6rem;
    position: relative; /* Relative is usually safer than fixed for footer */
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #133365;
    box-sizing: border-box;
    z-index: 100; /* Ensure footer is on top */
    font-size: 12px;
}

/* RTL Specific Styles (فارسی) */
body.rtl-mode {
    direction: rtl;
    text-align: right;
    /* font-family already set above using @import and body.rtl-mode */
}
body.rtl-mode .topnav a,
body.rtl-mode .subnav .subnavbtn,
body.rtl-mode .lang-dropdown-btn {
    text-align: right; /* Text align for nav items */
}
body.rtl-mode .subnav-content {
    right: 0;
    left: auto; /* Dropdown opens from right */
    text-align: right;
}
body.rtl-mode .subnav-content a {
    text-align: right;
}
body.rtl-mode .lang-dropdown-content {
    right: 0; /* Dropdown menu starts from right of button */
    left: auto;
    text-align: right;
}
body.rtl-mode .lang-option {
    text-align: right;
}
body.rtl-mode h3 {
    text-align: right;
    padding-right: 0rem; /* Padding for RTL */
    padding-left: 0;
}
body.rtl-mode .description,
body.rtl-mode .description p {
    text-align: right;
}
body.rtl-mode .description i { /* Check icon in description */
    margin-left: 0.5rem; /* Space for icon in RTL */
    margin-right: 0;
}

/* LTR Specific Styles (انگلیسی) */
body.ltr-mode {
    direction: ltr;
    text-align: left;
    /* font-family already set above using @import and body.ltr-mode */
}
body.ltr-mode .topnav a,
body.ltr-mode .subnav .subnavbtn,
body.ltr-mode .lang-dropdown-btn {
    text-align: left; /* Text align for nav items */
}
body.ltr-mode .subnav-content {
    left: 0;
    right: auto;
    text-align: left;
}
body.ltr-mode .subnav-content a {
    text-align: left;
}
body.ltr-mode .lang-dropdown-content {
    left: 0; /* Dropdown menu starts from left of button */
    right: auto;
    text-align: left;
}
body.ltr-mode .lang-option {
    text-align: left;
}
body.ltr-mode h3 {
    text-align: left;
    padding-left: 1rem; /* Padding for LTR */
    padding-right: 0;
}
body.ltr-mode .description,
body.ltr-mode .description p {
    text-align: left;
}
body.ltr-mode .description i { /* Check icon in description */
    margin-right: 0.5rem; /* Space for icon in LTR */
    margin-left: 0;
}


/* Responsive Styles (using mobile-first approach as seen in original code) */

/* General rounded div used for cards in index.html */
.roundeddiv { 
    border-radius: 12px; 
    /* Base styles, overridden by media queries */
}


/* Mobile adjustments (up to 431px) */
@media (max-width: 431px) {
    .topnav {
        flex-direction: column; /* Stack items vertically */
        align-items: center; /* Center items in column */
        padding-bottom: 0.6rem;
        position: relative; /* Change to relative for mobile to allow content flow */
        min-height: auto; /* Allow height to adjust */
        padding-inline: 0.5rem;
    }
    main {
        padding-top: 0; /* No fixed nav height adjustment needed for relative nav */
    }

    /* Ensure all groups take full width and are centered */
    .nav-links-group, .utility-group, .social {
        width: 100%;
        margin: 0.3rem 0 !important; 
        justify-content: center; /* Center internal items */
        flex-direction: column !important; /* Stack items inside for mobile */
        align-items: center;
        gap: 0.3rem; /* Reduce gap for mobile */
    }
    .utility-group {
        gap: 0; /* Remove gap between language and social group in mobile */
    }

    /* Specific mobile adjustments for text alignment within links/buttons */
    .topnav a, .subnav .subnavbtn, .lang-option {
        text-align: center;
        width: 100%;
    }

    /* Override description text alignment to center for better mobile readability */
    .description, .description p {
        text-align: center !important;
    }
    .description i { /* Adjust icon position for centered text */
        margin-inline: auto !important; /* Center the icon */
        display: block; /* Make icon block to ensure centering */
    }

    .topnav .active {
        width: auto; /* Logo button can be auto width */
        padding: 0.6rem 1rem;
    }

    .subnav-content, .lang-dropdown-content {
        position: static; /* Dropdowns appear in normal flow */
        width: 100%;
        box-shadow: none;
        background-color: #1e457f;
        border-radius: 0;
        text-align: center;
    }
    .img-top {
        padding-top: 1rem;
    }
    .parent {
        flex-direction: column;
        padding: 0.6rem;
    }
    .child {
        max-width: 100%;
        margin: 0.6rem 0;
    }
    .section-break p {
        font-size: 1rem;
    }
    .footer {
        position: relative; /* In mobile, footer should not be fixed */
        width: 100%;
        margin-top: 20px; /* Space from content */
    }
    .roundeddiv { /* Styles for rounded sections/cards in mobile */
        border: 2px solid #5270d1;
        background-color: #5270d1;
        border-radius: 15px;
        padding: 10px;
        margin-top: 23px;
        margin-left: 5px;
        margin-right: 5px;
        margin-bottom: 13px;
        font-size: 10px;
    }
}

/* Tablet (max-width: 568px) - for vertical stacking of child elements */
@media (max-width: 568px) {
    .parent {
        flex-direction: column;
    }
    .child:first-child {
        order: 1; /* Example ordering, check if needed */
    }
    .child:last-child {
        order: -1; /* Example ordering, check if needed */
    }
}

/* Larger mobile/small tablet (min-width: 432px) */
@media (min-width: 432px) {
    .topnav {
        flex-direction: row; /* Return to row layout */
        position: fixed; /* Fixed position for larger screens */
    }
    main {
        padding-top: 3.4375rem; /* Adjusted padding for fixed nav height */
    }
    .topnav a {
        width: auto; /* Allow links to shrink wrap content */
    }
    .img-top {
        padding-top: 1.5rem;
    }
    .parent {
        flex-direction: row;
    }
}

/* Medium tablet (min-width: 576px) */
@media (min-width: 576px) {
    .topnav {
        justify-content: space-between;
    }
    .img-top {
        padding-top: 3.75rem;
    }
    .parent {
        gap: 1.875rem;
    }
    .child {
        flex-basis: calc(50% - 1.875rem); /* Adjusted for 2 columns with gap */
        max-width: calc(50% - 1.875rem);
    }
}

/* Desktop screens (min-width: 768px) */
@media (min-width: 768px) {
    .topnav {
        padding: 0 1rem;
    }
    .img-top {
        padding-top: 2.5rem;
    }
    .parent {
        justify-content: center; /* Center cards */
    }
    .child {
        flex-basis: calc(33.333% - 1.875rem); /* Adjusted for 3 columns with gap */
        max-width: calc(33.333% - 1.875rem);
    }
    .roundeddiv { /* Styles for rounded sections/cards in desktop */
        border-radius: 15px;
        margin-top: 25px;
        margin-left: 5px;
        margin-right: 5px;
        margin-bottom: 15px;
        font-size: 16px;
    }
}

/* Larger desktop screens (min-width: 992px) */
@media (min-width: 992px) {
    .img-top {
        padding-top: 2.2rem;
    }
}

/* Extra large desktop screens (min-width: 1200px) */
@media (min-width: 1200px) {
    .img-top {
        padding-top: 1.8rem;
    }
}

/* Even larger desktop screens (min-width: 1400px) */
@media (min-width: 1400px) {
    .img-top {
        padding-top: 1.5rem;
    }
}