/* Custom RTL Overrides & Font Setup */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

body {
    font-family: 'Cairo', sans-serif !important;
    text-align: right;
    direction: rtl;
}

h1,
h2,
h3,
h4,
h5,
h6,
.tp-slider-title-2,
.tp-section-title-2,
.tp-product-title-2,
.tp-footer-widget-title,
.tp-main-menu-content ul li a,
p,
span,
a,
div,
button,
input,
select,
textarea {
    font-family: 'Cairo', sans-serif;
}

/* Helpers for margin/padding flipping */
/* NOTE: Bootstrap RTL should handle ms/me (margin-start/end) but legacy classes like ml-*, mr-* might need manual flipping or overrides if the theme uses them extensively */

.mr-5 {
    margin-left: 5px !important;
    margin-right: 0 !important;
}

.ml-5 {
    margin-right: 5px !important;
    margin-left: 0 !important;
}

.mr-10 {
    margin-left: 10px !important;
    margin-right: 0 !important;
}

.ml-10 {
    margin-right: 10px !important;
    margin-left: 0 !important;
}

.mr-15 {
    margin-left: 15px !important;
    margin-right: 0 !important;
}

.ml-15 {
    margin-right: 15px !important;
    margin-left: 0 !important;
}

.mr-20 {
    margin-left: 20px !important;
    margin-right: 0 !important;
}

.ml-20 {
    margin-right: 20px !important;
    margin-left: 0 !important;
}

.mr-30 {
    margin-left: 30px !important;
    margin-right: 0 !important;
}

.ml-30 {
    margin-right: 30px !important;
    margin-left: 0 !important;
}

.mr-35 {
    margin-left: 35px !important;
    margin-right: 0 !important;
}

.ml-35 {
    margin-right: 35px !important;
    margin-left: 0 !important;
}

.mr-40 {
    margin-left: 40px !important;
    margin-right: 0 !important;
}

.ml-40 {
    margin-right: 40px !important;
    margin-left: 0 !important;
}

.mr-50 {
    margin-left: 50px !important;
    margin-right: 0 !important;
}

.ml-50 {
    margin-right: 50px !important;
    margin-left: 0 !important;
}


.pr-10 {
    padding-left: 10px !important;
    padding-right: 0 !important;
}

.pl-10 {
    padding-right: 10px !important;
    padding-left: 0 !important;
}

.pr-20 {
    padding-left: 20px !important;
    padding-right: 0 !important;
}

.pl-20 {
    padding-right: 20px !important;
    padding-left: 0 !important;
}

.pr-30 {
    padding-left: 30px !important;
    padding-right: 0 !important;
}

.pl-30 {
    padding-right: 30px !important;
    padding-left: 0 !important;
}

/* Text Alignment */
.text-left {
    text-align: right !important;
}

.text-right {
    text-align: left !important;
}

.text-end {
    text-align: left !important;
}

/* Bootstrap 5 end is normally right, in RTL it should be left */

/* Float utilities */
.float-left {
    float: right !important;
}

.float-right {
    float: left !important;
}

/* Flip arrow icons */
.fa-angle-right:before {
    content: "\f104";
}

.fa-angle-left:before {
    content: "\f105";
}

.fa-arrow-right:before {
    content: "\f060";
}

.fa-arrow-left:before {
    content: "\f061";
}

.fa-chevron-right:before {
    content: "\f053";
}

.fa-chevron-left:before {
    content: "\f054";
}

/* Offcanvas and Sidebars */
.offcanvas__style-darkRed {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

.offcanvas-opened .offcanvas__style-darkRed {
    transform: translateX(0);
}

.cartmini__style-darkRed {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

.cartmini-opened .cartmini__style-darkRed {
    transform: translateX(0);
}

/* Header Specifics */
/* .tp-header-action-btn svg { transform: scaleX(-1); } - Uncomment if icons feel backwards */


.tp-header-action-badge {
    right: auto;
    left: -5px;
}

/* Active Wishlist Button Color */
.tp-product-add-to-wishlist-btn.active,
.tp-product-details-action-sm-btn.wishlist-btn.active,
.tp-product-details-action-sm-btn.wishlist-btn.active svg,
.wishlist-btn.active {
    color: var(--tp-theme-primary) !important;
    border-color: var(--tp-theme-primary) !important;
}

.tp-product-add-to-wishlist-btn.active:hover,
.tp-product-details-action-sm-btn.wishlist-btn.active:hover {
    color: var(--tp-theme-primary) !important;
    background-color: transparent !important;
}

/* Ensure SVG matches current color */
.tp-product-details-action-sm-btn.wishlist-btn.active svg path,
.tp-product-add-to-wishlist-btn.active svg path {
    fill: var(--tp-theme-primary) !important;
    stroke: var(--tp-theme-primary) !important;
}

/* Filled heart icon color */
.tp-product-add-to-wishlist-btn.active i {
    color: var(--tp-theme-primary) !important;
}

/* Product Details Page RTL Fixes */
/* Fix padding/margin on right side for RTL layout */
.tp-product-details-wrapper {
    margin-left: 0 !important;
    margin-right: 21px !important;
}

@media only screen and (min-width: 992px) and (max-width: 1199px) {
    .tp-product-details-wrapper {
        margin-right: 0 !important;
    }
}

@media only screen and (min-width: 768px) and (max-width: 991px),
only screen and (min-width: 576px) and (max-width: 767px),
(max-width: 575px) {
    .tp-product-details-wrapper {
        margin-right: 0 !important;
    }
}

.tp-product-details-thumb-wrapper {
    margin-right: 0 !important;
    margin-left: 20px !important;
    width: 100% !important;
}

@media (min-width: 576px) {
    .tp-product-details-thumb-wrapper .tab-content {
        flex-grow: 1 !important;
        min-width: 0 !important;
    }
}

.tp-product-details-thumb-wrapper .nav-tabs {
    margin-right: 0 !important;
    margin-left: 10px !important;
}

.tp-product-details-stock {
    margin-right: 0 !important;
    margin-left: 12px !important;
}

.tp-product-details-rating {
    margin-right: 0 !important;
    margin-left: 11px !important;
}

.tp-product-details-quantity .tp-product-quantity {
    margin-right: 0 !important;
    margin-left: 15px !important;
}

/* Increase Main Product Image Size & Fix Production Narrowing */
.tp-product-details-nav-main-thumb,
.tp-product-details-nav-main-thumb img {
    width: 100% !important;
    max-width: 100% !important;
}

@media (min-width: 576px) {
    .tp-product-details-nav-main-thumb {
        height: 600px !important;
    }
}

/* Ensure thumbnails stay proportional */
.tp-product-details-thumb-wrapper .nav-tabs .nav-link {
    height: 120px !important;
}

@media (max-width: 575px) {
    .tp-product-details-thumb-wrapper .nav-tabs .nav-link {
        height: auto !important;
    }
}

/* Enhanced Main Dropdown Menu Styling */
.main-menu>nav>ul>li>.tp-submenu {
    border-radius: 8px;
    box-shadow: 0px 20px 60px 0px rgba(11, 6, 70, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 15px 0;
}

.main-menu>nav>ul>li>.tp-submenu li a {
    padding: 10px 25px;
    transition: all 0.3s ease;
    position: relative;
}

.main-menu>nav>ul>li>.tp-submenu li a::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, transparent, rgba(var(--tp-theme-primary-rgb), 0.05));
    transition: width 0.3s ease;
    z-index: -1;
}

.main-menu>nav>ul>li>.tp-submenu li:hover a {
    padding-right: 30px;
}

.main-menu>nav>ul>li>.tp-submenu li:hover a::after {
    width: 100%;
}

/* Nested Dropdown Menu Support - Enhanced */
.main-menu>nav>ul>li>.tp-submenu li.has-dropdown {
    position: relative;
}

/* Add extra padding for items with nested submenus to make room for arrow */
.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>a {
    padding-right: 40px;
}

/* Add arrow indicator for items with nested submenus */
.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>a::before {
    content: "\f104";
    font-family: "Font Awesome 5 Pro";
    font-weight: 300;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--tp-common-black);
    opacity: 0.5;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.main-menu>nav>ul>li>.tp-submenu li.has-dropdown:hover>a::before {
    opacity: 1;
    color: var(--tp-theme-primary);
}

/* Nested submenu styling */
.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu {
    position: absolute;
    top: -12px;
    right: 100%;
    left: auto;
    min-width: 220px;
    background: var(--tp-common-white);
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    box-shadow: 0px 20px 60px 0px rgba(11, 6, 70, 0.12);
    padding: 15px 0;
    border-radius: 8px;
    transform-origin: right center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transform: translateX(10px);
    -moz-transform: translateX(10px);
    -ms-transform: translateX(10px);
    -o-transform: translateX(10px);
    transform: translateX(10px);
    margin-right: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Show nested submenu on hover */
.main-menu>nav>ul>li>.tp-submenu li.has-dropdown:hover>.tp-submenu {
    visibility: visible;
    opacity: 1;
    -webkit-transform: translateX(0);
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    -o-transform: translateX(0);
    transform: translateX(0);
}

/* Nested submenu items styling */
.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu li {
    padding: 0 20px;
}

.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu li a {
    padding: 10px 15px;
    display: block;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu li a::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, transparent, rgba(var(--tp-theme-primary-rgb), 0.05));
    transition: width 0.3s ease;
    z-index: -1;
}

.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu li:hover a {
    color: var(--tp-theme-primary);
    padding-right: 20px;
}

.main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu li:hover a::after {
    width: 100%;
}

/* Ensure proper positioning for RTL */
[dir="rtl"] .main-menu>nav>ul>li>.tp-submenu li.has-dropdown>.tp-submenu {
    right: 100%;
    left: auto;
    transform-origin: right center;
}

/* Product Card Border & Fixes */
.tp-product-item-2 {
    border: 1px solid rgba(128, 128, 128, 0.5) !important;
    padding: 0 !important;
    /* remove any default padding */
}

.tp-product-item-2 .tp-product-thumb-2 {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    /* Remove line-height spacing */
}

.tp-product-item-2 .tp-product-thumb-2 a {
    display: block !important;
    /* Ensure anchor is block to remove inline gaps */
    line-height: 0 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.tp-product-item-2 .tp-product-thumb-2 img {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-radius: 0 !important;
    /* Force no radius on image itself to fill container */
}

.tp-product-item-2::after,
.tp-product-item-2::before {
    display: none !important;
}

/* Footer Styling - White Text for Arabic */
.tp-footer-area,
.tp-footer-area *,
.tp-footer-widget-title,
.tp-footer-widget p,
.tp-footer-widget a,
.tp-footer-widget span,
.tp-footer-widget li,
.tp-footer-widget-content,
.tp-footer-copyright p,
.tp-footer-copyright a {
    color: #ffffff !important;
}

/* Footer Links Hover */
.tp-footer-widget a:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Fix bullet points for Arabic RTL lists in footer */
.tp-footer-widget ul {
    list-style: none !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
    margin: 0 !important;
}

.tp-footer-widget ul li {
    text-align: right !important;
    direction: rtl !important;
    position: relative !important;
    padding-right: 20px !important;
    padding-left: 0 !important;
}

/* Add proper bullet points for RTL */
.tp-footer-widget ul li::before {
    content: "• " !important;
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    color: #ffffff !important;
}

/* Global Logo Size Standardization */
.logo img,
.tp-header-bottom-2 .logo img,
header .logo img {
    max-width: 140px !important;
    width: 140px !important;
    height: auto !important;
}

/* Center logo on all pages */
.logo,
.tp-header-bottom-2 .logo,
header .logo {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
}

/* Mobile Responsive Adjustments */
@media (max-width: 767px) {

    /* Font Size Reductions */
    .tp-section-title-2 {
        font-size: 24px !important;
    }

    .tp-section-title-pre-2 {
        font-size: 14px !important;
        margin-bottom: 5px !important;
    }

    .tp-product-title-2 {
        font-size: 14px !important;
        margin-bottom: 5px !important;
    }

    .tp-product-tag-2 a {
        font-size: 12px !important;
    }

    .tp-product-price-2 {
        font-size: 14px !important;
    }

    /* Product Card Size Reductions */
    .tp-product-item-2 {
        margin-bottom: 20px !important;
    }

    .tp-product-content-2 {
        padding-top: 10px !important;
        padding-right: 10px !important;
        padding-left: 10px !important;
        padding-bottom: 10px !important;
    }

    /* Adjust grid spacing if needed */
    .mb-40 {
        margin-bottom: 20px !important;
    }

    /* Hero section font sizing */
    .ghain-hero-content h1 {
        font-size: 28px !important;
    }

    .ghain-hero-content p {
        font-size: 16px !important;
    }
}

/* Header Adjustments for Phone Screens (strictly max-width: 575px) */
@media (max-width: 575px) {

    /* Stack logo column and action column vertically */
    .tp-header-bottom-2 .container>.tp-mega-menu-wrapper>.row {
        flex-direction: column !important;
        align-items: center !important;
        padding-top: 10px !important;
        padding-bottom: 15px !important;
    }

    /* Make columns full width and center content */
    .tp-header-bottom-2 .col-6 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        text-align: center !important;
        display: flex !important;
        justify-content: center !important;
    }

    /* Override any specific padding/centering for the logo container */
    .tp-header-bottom-2 .logo {
        text-align: center !important;
        margin-bottom: 5px !important;
    }

    /* Increase logo size for phone screens */
    .logo img,
    .tp-header-bottom-2 .logo img,
    header .logo img {
        max-width: 180px !important;
        width: 180px !important;
        height: auto !important;
    }

    /* Adjust the action area (contains hamburger) to be centered below logo */
    .tp-header-bottom-right {
        justify-content: center !important;
        padding-left: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
    }

    .tp-header-action {
        margin-left: 0 !important;
        justify-content: center !important;
        width: 100% !important;
    }

    /* Ensure hamburger icon is centered and properly spaced */
    .tp-header-hamburger {
        margin-right: 0 !important;
        margin-left: 0 !important;
        display: flex !important;
        justify-content: center !important;
    }

    /* Footer Restructuring for Phone Screens Only */
    /* Make the footer row use flexbox for ordering */
    .tp-footer-area .tp-footer-top .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    /* Override ALL column classes for footer restructuring */
    /* Logo Section - Centered at Top */
    .tp-footer-area .tp-footer-top .row>.col-xl-4.col-lg-3.col-md-4.col-sm-6.col-6,
    .tp-footer-area .tp-footer-top .row>div.col-xl-4.col-lg-3.col-md-4.col-sm-6.col-6 {
        order: 1 !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        text-align: center !important;
        margin-bottom: 30px !important;
    }

    .tp-footer-area .footer-col-1 .tp-footer-logo {
        text-align: center !important;
        margin-bottom: 15px !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .tp-footer-area .footer-col-1 .tp-footer-desc {
        text-align: center !important;
        margin-bottom: 15px !important;
    }

    .tp-footer-area .footer-col-1 .tp-footer-social {
        justify-content: center !important;
        display: flex !important;
        gap: 10px !important;
    }

    /* حسابي Column (خدمات) - Right Side (50% width) */
    .tp-footer-area .tp-footer-top .row>.col-xl-2.col-lg-3.col-md-4.col-sm-6.col-6,
    .tp-footer-area .tp-footer-top .row>div.col-xl-2.col-lg-3.col-md-4.col-sm-6.col-6 {
        order: 2 !important;
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        margin-bottom: 30px !important;
    }

    /* معلومات Column - Left Side (50% width) */
    .tp-footer-area .tp-footer-top .row>.col-xl-3.col-lg-3.col-md-4.col-sm-6.col-6:nth-child(3),
    .tp-footer-area .tp-footer-top .row>div.col-xl-3.col-lg-3.col-md-4.col-sm-6.col-6:nth-child(3) {
        order: 3 !important;
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        margin-bottom: 30px !important;
    }

    /* Contact Section - Full Width at Bottom */
    .tp-footer-area .tp-footer-top .row>.col-xl-3.col-lg-3.col-md-4.col-sm-6.col-6:nth-child(4),
    .tp-footer-area .tp-footer-top .row>div.col-xl-3.col-lg-3.col-md-4.col-sm-6.col-6:nth-child(4) {
        order: 4 !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        text-align: center !important;
    }

    .tp-footer-area .footer-col-4 .tp-footer-widget-title {
        text-align: center !important;
    }

    .tp-footer-area .footer-col-4 .tp-footer-talk {
        text-align: center !important;
    }

    .tp-footer-area .footer-col-4 .tp-footer-contact {
        text-align: center !important;
    }

    .tp-footer-area .footer-col-4 .tp-footer-contact-item {
        justify-content: center !important;
        text-align: center !important;
    }
}

/* Contact Section Right Alignment */
.tp-footer-widget.footer-col-4 {
    text-align: right !important;
}

.tp-footer-widget.footer-col-4 .tp-footer-widget-title {
    text-align: right !important;
}

.tp-footer-widget.footer-col-4 .tp-footer-talk {
    text-align: right !important;
}

.tp-footer-widget.footer-col-4 .tp-footer-talk span,
.tp-footer-widget.footer-col-4 .tp-footer-talk h4,
.tp-footer-widget.footer-col-4 .tp-footer-talk a {
    text-align: right !important;
    display: block !important;
}

/* Email and Address Section Right Alignment */
.tp-footer-widget.footer-col-5 {
    text-align: right !important;
}

.tp-footer-widget.footer-col-5 .tp-footer-contact {
    text-align: right !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    /* In RTL column, flex-start is Right */
}

.tp-footer-widget.footer-col-5 .tp-footer-contact-item {
    justify-content: flex-start !important;
    text-align: right !important;
    direction: rtl !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 15px !important;
}

.tp-footer-widget.footer-col-5 .tp-footer-contact-icon {
    margin: 0 !important;
    order: 1 !important;
    /* Icon First (Right) */
}

.tp-footer-widget.footer-col-5 .tp-footer-contact-content {
    text-align: right !important;
    flex: 0 !important;
    order: 2 !important;
    /* Content Second (Left) */
}

.tp-footer-widget.footer-col-5 .tp-footer-contact-content p,
.tp-footer-widget.footer-col-5 .tp-footer-contact-content a {
    text-align: right !important;
    direction: rtl !important;
}

/* Override Product Title Size to match 'Quiet Elegance' section (15px) globally */
.tp-product-title-2 {
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1.33 !important;
    margin-bottom: 7px !important;
}

/* Ensure tag sizes are consistent if they differ */
.tp-product-tag-2,
.tp-product-tag-2 a {
    font-size: 16px !important;
    /* Default was 16px in some contexts, ensuring consistency */
}