/**
 * Theme Name:   Divi-Shagerd
 * Theme URI:    https://shagerd.co.uk
 * Description:  Child theme for Divi tailored for Shagerd.co.uk
 * Author:       Hussein Amiri
 * Author URI:   https://amiri.ws
 * Template:     Divi
 * Version:      1.1.0
 *
 * ----------------------------------------------------------------
 *
 * This file contains custom styles.
 *
 * [Table of Contents]
 *
 * 1. Global & Root Variables
 * 2. Fullscreen Search Overlay
 * - Main Container & State
 * - Close Button
 * - Content Wrapper
 * - Form Styles (Ajax Search Lite)
 * 3. Ajax Search Lite Results Grid
 * - Grid Container
 * - Result Item (Card)
 * - Card Image
 * - Card Content
 * - "No Results" & "Show More"
 * 4. Responsive Media Queries
 * 5. Global Typography Overrides
 *
 */

/* ===================================================================
   1. Global & Root Variables
   =================================================================== */

:root {
    --overlay-bg: rgba(31, 44, 67, 0.98);
    --primary-text-color: #333;
    --light-text-color: #ffffff;
    --card-bg: #ffffff;
    --grid-gap: 20px;
    --main-radius: 8px;
    --image-radius: 5px;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-heavy: 0 8px 20px rgba(0, 0, 0, 0.12);
    --transition-fast: 0.2s ease-in-out;
    --transition-medium: 0.4s ease;
}

/* ===================================================================
   2. Fullscreen Search Overlay
   =================================================================== */

/* --- Main Container & State --- */

#fullscreen-search-overlay {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    visibility: hidden;
    opacity: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg);
    z-index: 9999999;
    transition:
        opacity var(--transition-medium),
        visibility var(--transition-medium);
}

#fullscreen-search-overlay.active {
    visibility: visible;
    opacity: 1;
}

/* --- Close Button --- */

#close-search-btn {
    position: absolute;
    top: 30px;
    right: 40px;
    max-width: 50px;
    font-size: 45px;
    font-weight: 100;
    color: var(--light-text-color);
    text-align: center;
    line-height: 1;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

#close-search-btn:hover {
    transform: rotate(90deg) scale(1.2);
}

/* --- Content Wrapper --- */

.search-overlay-content-wrapper {
    width: 90%;
    max-width: 1400px;
}

/* --- Form Styles (Ajax Search Lite) --- */

#fullscreen-search-overlay .probox {
    max-width: 700px;
    margin: 0 auto 40px auto; /* Center form and add space below */
    border: none !important;
    box-shadow: none !important;
}

#fullscreen-search-overlay .probox .proinput input[type="search"] {
    font-weight: bold;
    direction: rtl;
    text-align: right;
    font-size: 20px;
    padding-right: 30px !important;
}

/* ===================================================================
   3. Ajax Search Lite Results Grid
   =================================================================== */

/* --- Grid Container --- */

/* Resetting default plugin styles */
#ajaxsearchliteres1.asl_r.vertical {
    background: none !important;
}

#ajaxsearchliteres1 .results {
    height: auto !important;
    overflow-y: visible !important;
    padding: var(--grid-gap);
}

/* Applying Flexbox to create the grid */
#ajaxsearchliteres1 .results .resdrg {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* این خط ۴ ستون مساوی ایجاد می‌کند */
    gap: var(--grid-gap);
}

/* --- Result Item (Card) --- */

#ajaxsearchliteres1 .results .item {
    /* عرض آیتم‌ها توسط کانتینر گرید کنترل می‌شود */
    background-color: var(--card-bg);
    border: none !important;
    border-radius: var(--main-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    margin-bottom: 0 !important;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

#ajaxsearchliteres1 .results .item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

/* --- Card Image --- */

#ajaxsearchliteres1 .results .item .asl_image {
    width: 100%;
    height: 138px;
    object-fit: cover; /* Prevents image distortion */
    border-radius: var(--image-radius);
    float: none !important;
    margin: 0 !important;
    max-width: none !important;
}

/* --- Card Content --- */

#ajaxsearchliteres1 .results .item .asl_content {
    padding: var(--grid-gap);
}

#ajaxsearchliteres1 .results .item h3 a {
    font-size: 18px;
    line-height: 1.4;
    color: var(--primary-text-color);
    text-align: right;
}

/* Hide the description for a cleaner card layout */
#ajaxsearchliteres1 .results .item .asl_desc {
    display: none;
}

/* --- "No Results" & "Show More" --- */

div#ajaxsearchliteres1.asl_r .results .asl_nores {
    margin: auto;
    background: none;
    color: var(--light-text-color);
}

div#ajaxsearchliteres1.asl_r .results .asl_nores .asl_nores_header {
    font-size: 30px !important;
}

div#ajaxsearchliteres1.asl_r p.showmore {
    max-width: 30%;
    margin: auto;
    height: 40px;
    border-radius: var(--main-radius);
}

div#ajaxsearchliteres1.asl_r p.showmore span {
    border: none;
    font-size: 22px;
    font-weight: bolder;
}

/* ===================================================================
   4. In-Post Injected Layouts (.post-ads)
   =================================================================== */

/* --- Main Wrapper Style --- */
/* This class is added to the main section of the injected layout. */
.post-ads.et_pb_section {
    border-top: 2px solid #e0e0e0;
    border-bottom: 2px solid #e0e0e0;
    padding-top: 30px;
    padding-bottom: 30px;
    margin-top: 40px !important;
    margin-bottom: 40px !important;
}

.post-ads.et_pb_image {
    margin: 80px 30px !important;
}

/* --- Styling a headline inside the ad --- */
.post-ads h2,
.post-ads h3 {
    color: var(--primary-color); /* Using a variable from the root */
    font-weight: bold;
}

/* --- Styling a button inside the ad --- */
.post-ads .et_pb_button {
    border-width: 2px !important;
    border-color: #0c71c3; /* Example color */
    border-radius: var(--main-radius); /* Using a variable */
}

.post-ads .et_pb_button:hover {
    background-color: #0c71c3 !important;
    color: #ffffff !important;
}

/* --- Add any other styles you need for .post-ads here --- */

/* ===================================================================
   5. Responsive Media Queries (was 4)
   =================================================================== */

@media (max-width: 980px) {
    #ajaxsearchliteres1 .results .item {
        /* 2 columns on tablets */
        width: calc(50% - (var(--grid-gap) / 2));
    }
    #ajaxsearchliteres1 .results .resdrg {
        grid-template-columns: repeat(2, 1fr); /* ۲ ستونه می‌شود */
    }
}

@media (max-width: 767px) {
    #ajaxsearchliteres1 .results .item {
        /* 1 column on mobile */
        width: 100%;
    }
    #ajaxsearchliteres1 .results .resdrg {
        grid-template-columns: 1fr; /* تک ستونه می‌شود */
    }

    #close-search-btn {
        top: 15px;
        right: 20px;
    }
}

/* ===================================================================
   6. Global Typography Overrides
   =================================================================== */

/* Corrected typo from 'storng' to 'strong' */
b,
strong {
    font-weight: 600 !important;
}

/* ===================================================================
   Print Styles
   =================================================================== */

@media print {
    /* Hide the injected ad layouts when the page is printed. */
    .post-ads {
        display: none !important;
    }
}
