/* Define the BNazanin font using @font-face */
@font-face {
    font-family: 'BNazanin';
    src: url('../fonts/BNazanin.eot'); /* IE9 compatibility */
    src: url('../fonts/BNazanin.eot?#iefix') format('embedded-opentype'),
          url('../fonts/BNazanin.ttf') format('truetype'); /* Standard TrueType format */
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Improves performance by displaying text with a fallback font first */
}

:root {
    --primary-color: #296cd6; /* Blue */
    --secondary-color: #28A745; /* Green */
    --accent-color: #DC3545; /* Red */
    --text-color: #333; /* Dark gray for general text */
    --light-bg: #F8F9FA; /* Light gray background */
    --dark-bg: #343A40; /* Dark gray for nav/footer */
    --white: #FFFFFF;
    --gray: #F0F2F5; /* A slightly lighter gray for body background, typical for modern UIs */
    --border-color: #CED4DA;
    --header-height-desktop: 4rem;
    --nav-height-desktop: 50px;
    --header-height-mobile: 60px;
    --footer-height: 60px;

    /* Card Header Colors */
    --card-header-word: #259462; /* Green */
    --card-header-conversation: #1994d1; /* Blue */
    --card-header-idiom: #2f4296; /* Dark Blue */
    --card-header-proverb: #9C27B0; /* Purple */
    --card-header-default: #6c757d; /* Gray for undefined */
}

* {
    font-family: 'BNazanin';
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--gray);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: calc(var(--header-height-desktop) + var(--nav-height-desktop));
    padding-bottom: var(--footer-height);
    overflow-x: hidden; /* Keep this to prevent horizontal scroll if small overflow happens */
    direction: rtl; /* Ensure global RTL */
}

header {
    background-color: #296cd6;
    color: var(--white);
    padding: 10px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center; /* Centered on desktop */
    height: var(--header-height-desktop);
    gap: 15px;
}

.header-logo {
    height: 50px;
    width: auto;
}

header h1 {
    margin: 0;
    font-size: 0.8vw;
}

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

/* Mobile Menu Button (Hamburger) */
.menu-toggle {
    display: none; /* Hidden by default on desktop */
    background-color: transparent;
    color: var(--white);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
}

.menu-toggle .menu-text {
    font-size: 0.9rem;
    margin-right: 5px;
    vertical-align: middle;
}
.menu-toggle .fa-bars {
    vertical-align: middle;
}

/* Updated .nav for desktop right alignment (flex-start in RTL) */
.nav {
    background-color: var(--dark-bg);
    padding: 10px 0;
    position: fixed;
    top: var(--header-height-desktop);
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: var(--nav-height-desktop);
    display: flex;
    justify-content: flex-start; /* Correct for aligning to visual right in RTL */
    align-items: center;
    padding-left: 20px; /* Add padding on the left to prevent items from touching the edge */
    padding-right: 20px; /* Add padding on the right to match content padding */
}

.nav ul {
    list-style: none;
    display: flex;
    justify-content: flex-start; /* Align menu items to the visual right (start in RTL) */
    flex-wrap: wrap;
    width: auto; /* Allow ul to shrink to content width */
}

.nav li {
    margin: 0 15px;
    position: relative;
}

.nav a {
    color: var(--white);
    text-decoration: none;
    padding: 10px 15px;
    display: block;
    transition: background-color 0.3s ease;
    border-radius: 5px;
    font-size: 0.8vw;

}

.nav a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-submenu ul {
    display: none;
    position: absolute;
    background-color: var(--dark-bg);
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    top: 100%;
    right: 0; /* Align submenu to the right for RTL */
    flex-direction: column;
    border-radius: 5px;
    padding: 0px;
}

.nav-submenu:hover ul {
    display: flex;
}

.container {
    width: 100%; /* Ensure it takes full available width */
    margin: 15px auto;
    padding: 20px 20px; /* Container's internal padding */
    display: grid;
    /* Updated grid-template-columns for 25% | 50% | 25% */
    /* Remember RTL: Visual left (first column) is grid column 3 */
    grid-template-columns: 25fr 50fr 25fr;
    gap: 30px;
}

/* Assign columns to their respective grid areas */
/* In RTL:
    Visual Left (info-text) should be grid column 3
    Center (search-category) should be grid column 2
    Visual Right (contact-tags) should be grid column 1
*/
.col-info-text {
    grid-column: 3 / 4;
}

.col-search-category {
    grid-column: 2 / 3;
    padding:5px !important;
}

.col-contact-tags {
    grid-column: 1 / 2;
}

.col {
    background-color: var(--white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.col h4 {
    color: black !important; /* Set h4 color to black with !important for desktop */
    margin-bottom: 20px;
    font-size: 0.8vw;
    text-align: right;
}

.col p {
    text-align: right;
}

.contact-icons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.contact-icons img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.contact-icons img:hover {
    transform: translateY(-5px);
}

.fc{
    width: 100%;
    padding: 6px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1vw;
    direction: ltr;
    text-align: center;
}
#search_text {
    direction: ltr;
    text-align: center;
}

#category-select {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.8vw;
    direction: rtl; /* Keep RTL for select/category */
    text-align: right;
    font-family: 'BNazanin'!important;

}
#category-select option {
    font-family: 'BNazanin' !important; /* Apply font to options */
    
}
form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    text-align: right;
}

form input[type="text"],
form input[type="email"],
form input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    direction: ltr; /* Ensure these specific inputs are LTR */
    text-align: left;
}

form p {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: justify;
}

.button1 {
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
    width: auto;
    display: block;
    margin: 20px auto 0;
}

.button1:hover {
    background-color: #218838;
}

.info-text {
    text-align: justify;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
}

footer {
    background-color:#296cd6 !important;
    color: var(--white);
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer .afoot {
    color: var(--white);
    text-decoration: none;
}

.footer h3 {
    margin: 0;
    font-size: 0.8vw;
}

.fa {
    padding: 15px;
    font-size: 25px;
    width: 50px;
    text-align: center;
    text-decoration: none;
    margin: 5px 2px;
    border-radius: 50%;
}

.fa:hover {
    opacity: 0.8;
}

.fa-instagram {
    background: #E1306C;
    color: white;
}

/* --- New and Updated Styles for Search Results Cards --- */

/* Add this new rule to specifically remove underline from the overall link around the card */
.search-result-link {
    text-decoration: none; /* Remove underline from the link wrapping the card */
    color: inherit; /* Ensure it inherits color from its parent if not explicitly set later */
}

.card-header {
    background-color: var(--primary-color); /* Default color, overridden by specific classes */
    color: var(--white);
    padding: 12px;
    text-align: center; /* Align header text to the right for RTL */
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 8px;
    margin-top: 15px; /* Space between different word type sections */
    margin-bottom: 15px; /* Space between different word type sections */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Subtle shadow for depth */
}

/* Specific card header colors */
.card-header.header-word { background-color: var(--card-header-word); }
.card-header.header-conversation { background-color: var(--card-header-conversation); }
.card-header.header-idiom { background-color: var(--card-header-idiom); }
.card-header.header-proverb { background-color: var(--card-header-proverb); }
.card-header.header-default { background-color: var(--card-header-default); }

.card-view {
    background-color: var(--white);
    border-radius: 8px; /* Consistent with col */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Stronger shadow for cards */
    margin-top: 10px; /* Space between different word type sections */
    margin-bottom: 15px; /* Spacing between cards - Confirmed at 15px */
    overflow: hidden; /* Ensures border-radius applies to children */
    border: 1px solid var(--border-color); /* Subtle border for definition */
}

.card-view:last-of-type {
    margin-bottom: 0; /* No margin after the last card in a group */
}

.card-body {
    padding: 15px 20px; /* Padding inside the card */
    font-size: 1.1rem; /* Consistent font size */
    line-height: 1.5;
}

.flex-group { /* Replaces card-icon-text-container */
    display: flex;
    align-items: center;
    margin-bottom: 8px; /* Space between TR and FA lines */
}

.card-icon {
    width: 32px; /* Fixed width for the icon container */
    height: 32px; /* Fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 12px; /* Space between icon and text */
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.card-icon img {
    width: 25px;
    height: 25px;
    display: block; /* Remove extra space below image */
}

.card-tr-text, .card-fa-text {
    flex-grow: 1; /* Allows text to take available space */
}

/* --- CRITICAL FIX FOR TR/FA ALIGNMENT, DIRECTION, COLOR, AND UNDERLINE --- */
/* (These rules already remove underline and set color to black for the text itself) */
.card-tr-text span { /* Targeting the span inside .card-tr-text */
    color: black !important; /* Make TR text black */
    text-decoration: none !important; /* Remove underline */
    font-size: 0.9vw; /* Keep size */
    display: block; /* Ensure it takes full width for text alignment */
    text-align: left !important; /* TR (Turkish) is LTR, force left alignment */
    direction: ltr !important;     /* Force LTR direction */
}

.card-fa-text span { /* Targeting the span inside .card-fa-text */
    color: black !important; /* Make FA text black */
    text-decoration: none !important; /* Remove underline */
    font-size: 0.9vw; /* Keep size */
    display: block; /* Ensure it takes full width for text alignment */
    text-align: right !important; /* FA (Farsi) is RTL, force right alignment */
    direction: rtl !important;        /* Force RTL direction */
    margin-top: 5px; /* Small space between TR and FA */
}
/* --- END CRITICAL FIX --- */

.card-image-container {
    margin-top: 15px;
    text-align: center; /* Center images */
    background-color: var(--light-bg); /* Light background for image container */
    padding: 10px;
    border-radius: 5px;
}

.card-image-container img {
    max-width: 100%;
    height: auto;
    display: block; /* Removes extra space below image */
    margin: 0 auto; /* Center image horizontally */
    border-radius: 4px; /* Slight border-radius for image itself */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); /* Subtle shadow for image */
}

.empty-results-card {
    border: 1px dashed var(--border-color); /* Dashed border for empty state */
    text-align: center;
    padding: 30px;
    color: var(--text-color);
    font-size: 1.1rem;
    background-color: var(--white);
    margin-top: 20px; /* Space from other elements */
}


/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding-top: var(--header-height-mobile);
        padding-bottom: var(--footer-height);
    }

    header {
        height: var(--header-height-mobile);
        padding: 10px 15px;
        justify-content: flex-start; /* Aligns content to the start (right in RTL) on mobile */
    }

    .header-logo {
        height: 40px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        position: absolute;
        left: 15px; /* Position on the left for RTL layout */
        top: 50%;
        transform: translateY(-50%);
        order: initial;
    }

    .nav {
        top: 0; /* Align to the very top */
        right: -250px;
        width: 250px;
        height: 100%;
        padding-top: var(--header-height-mobile); /* Keep space for the header */
        background-color: var(--dark-bg);
        transition: right 0.3s ease-in-out;
        z-index: 999;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
        flex-direction: column;
        align-items: start;
        display: flex;
        overflow-y: auto;
        padding-left: 0; /* Remove desktop padding */
        padding-right: 0; /* Remove desktop padding */
    }

    .nav.open {
        right: 0;
    }

    .nav ul {
        flex-direction: column;
        align-items: start;
        width: 100%;
        padding: 0; /* Remove all padding from the ul */
        margin: 0;
    }

    .nav li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

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

    .nav a {
        padding: 15px 20px; /* Keep padding for individual links */
    }

    .nav-submenu ul {
        position: static;
        background-color: rgba(0, 0, 0, 0.1);
        box-shadow: none;
        width: 100%;
        padding: 0 20px 0 0; /* Indent sub-menu items for RTL */
        margin: 0;
    }

    .nav-submenu:hover ul {
        display: flex;
    }

    /* --- ORDERING BLOCKS FOR MOBILE --- */
    .container {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 20px;
        padding: 0 5px;
        margin-top: 20px; /* No top margin on mobile container */
    }

    /* Reset desktop column ordering/placement for mobile */
    .col-info-text,
    .col-search-category,
    .col-contact-tags {
        grid-column: auto; /* Reset grid-column for mobile */
        order: initial; /* Reset order for mobile */
    }

    /* Re-establish mobile order explicitly if needed, or let source order apply */
    .col-search-category { order: 2; }
    .col-info-text { order: 1; }
    .col-contact-tags { order: 3; }


    .col h4 {
        font-size: 1.1rem;
        color: var(--primary-color); /* Reset h4 color for mobile */
    }
    .col p {
        font-size: 0.95rem;
    }

    .contact-icons img {
        width: 45px;
        height: 45px;
    }

    footer {
        padding: 5px 5px;
        font-size: 1.3rem;
        height:50px;
    }

    /* Card adjustments for mobile */
    .card-header {
        font-size: 1.1rem; /* Smaller header text on mobile */
        padding: 10px 15px;
    }
    .card-body {
        font-size: 1rem; /* Smaller body text on mobile */
        padding: 12px 15px;
    }
    .card-tr-text span, .card-fa-text span {
        font-size: 1rem; /* Smaller word text on mobile */
    }
    .card-icon {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }
    .card-icon img {
        width: 20px;
        height: 20px;
    }
 .col-info-text{
     padding: 8px;
    margin-bottom: 0px;
}

.fc{
    font-size: 1.1rem;
}


#category-select {
    
    font-size: 1.1rem;

}
.footer h3{
font-size: 1rem;
}
.nav a{
font-size: 1rem;
}
.col h4{
font-size: 1rem;
}
}