/* ============================================
   Responsive Styles - Mobile First
   ============================================ */

/* ---- Bottom Navigation Bar (Mobile) ---- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 99999;
    padding: 0;
    margin: 0;
    border-top: 2px solid #EF7B15;
    height: 62px;
}

.mobile-bottom-nav ul {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

.mobile-bottom-nav ul li {
    flex: 1;
    text-align: center;
    margin: 0;
    padding: 0;
}

.mobile-bottom-nav ul li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px 5px;
    color: #ffffff;
    text-decoration: none;
    font-size: 10px;
    font-family: ISL, tahoma, sans-serif;
    transition: all 0.25s ease;
    height: 100%;
    position: relative;
    border-top: 3px solid transparent;
}

.mobile-bottom-nav ul li a .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    transition: all 0.25s ease;
    background: transparent;
}

.mobile-bottom-nav ul li a .nav-icon i {
    font-size: 20px;
    color: #ffffff;
    transition: all 0.25s ease;
}

.mobile-bottom-nav ul li a:hover,
.mobile-bottom-nav ul li a.active {
    color: #EF7B15;
    border-top-color: #EF7B15;
}

.mobile-bottom-nav ul li a:hover .nav-icon,
.mobile-bottom-nav ul li a.active .nav-icon {
    background: rgba(239, 123, 21, 0.2);
}

.mobile-bottom-nav ul li a:hover .nav-icon i,
.mobile-bottom-nav ul li a.active .nav-icon i {
    color: #EF7B15;
    transform: scale(1.15);
}

/* ============================================
   Mobile Styles (max-width: 768px)
   ============================================ */
@media only screen and (max-width: 768px) {

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    /* Show bottom nav */
    .mobile-bottom-nav {
        display: block;
    }

    /* Body padding for bottom nav */
    body {
        padding-bottom: 65px !important;
    }

    .hmp {
        padding-bottom: 65px !important;
    }

    /* ---- Header / Top Bar ---- */
    .top-bar-z {
        padding: 5px 0;
    }

    .top-bar-z .row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
    }

    .top-bar-z .logo {
        order: 1;
        width: auto;
        min-width: 0;
        padding: 0 5px;
    }

    .top-bar-z .logo .inr {
        display: flex;
        align-items: center;
    }

    .top-bar-z .logo .inr img {
        width: 40px !important;
        height: auto;
    }

    .top-bar-z .logo .inr {
        font-size: 12px;
    }

    /* Cart & Account - در سمت چپ */
    .top-bar-z .columns:nth-child(3) {
        order: 2;
        width: auto !important;
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: 0;
    }

    .top-bar-z .cart {
        max-width: 50px;
        padding: 0;
    }

    .top-bar-z .cart img {
        width: 35px !important;
        height: auto;
    }

    .top-bar-z .account-nav {
        max-width: 50px;
        padding: 0;
    }

    .top-bar-z .account-nav .avatar img {
        width: 35px !important;
        height: 35px !important;
    }

    /* Search bar */
    .top-bar-z .search {
        order: 3;
        width: 100%;
        margin-top: 8px;
        margin-bottom: 5px;
        padding: 0 5px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .top-bar-z .search input {
        font-size: 14px;
        height: 36px;
        padding-right: 35px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .top-bar-z .search .fa-search {
        right: 18px;
        top: 14px;
    }

    .wrapper-dropdown-5 {
        width: 45px;
    }

    .wrapper-dropdown-5:after {
        display: none;
    }

    .wrapper-dropdown-5 .dropdown {
        right: 0;
        left: auto;
        width: 200px;
    }

    /* Hide desktop main menu & mega menu */
    .top-bar-z .hor-nav.main {
        display: none;
    }

    .et-mega-menu {
        display: none !important;
    }

    /* ---- Slider ---- */
    .hero-z {
        padding: 0 !important;
    }

    .hero-z .row.slider {
        width: 100%;
        max-width: 100%;
    }

    .sliders-w {
        border: 2px solid #fafafa;
        box-shadow: none;
        max-width: 100%;
    }

    .small-slider, .big-slider {
        max-height: 180px;
        overflow: hidden;
    }

    .small-slider img, .big-slider img {
        height: 180px;
        width: 100%;
        object-fit: cover;
    }

    /* ---- Content Area ---- */
    .content-z {
        padding-top: 10px;
        padding-bottom: 10px;
        max-width: 100%;
    }

    .content-center {
        padding: 0 5px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .content-center > .row {
        margin-top: 10px;
    }

    /* ---- Sidebar ---- */
    .sidebar {
        padding-right: 0;
        width: 100% !important;
        margin-bottom: 15px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .sidebar .head h2 {
        font-size: 16px;
    }

    .sidebar nav ul.nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
    }

    .sidebar nav ul.nav li {
        flex: 0 0 auto;
    }

    .sidebar nav ul.nav li a {
        padding: 6px 10px;
        font-size: 12px;
        display: inline-block;
    }

    /* ---- Grid System Override ---- */
    .large-5, .large-6, .large-8, .large-12, .large-18, .large-19, .large-24,
    .medium-5, .medium-6, .medium-7, .medium-8, .medium-10, .medium-12, .medium-14, .medium-18, .medium-24 {
        width: 100% !important;
        float: none !important;
        clear: both;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    .columns {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* ---- Book Grid / Navbar ---- */
    .blk ul.navbar,
    ul.navbar {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        list-style: none !important;
        width: 100% !important;
        float: none !important;
    }
    
    .blk ul.navbar::before,
    .blk ul.navbar::after,
    ul.navbar::before,
    ul.navbar::after {
        display: none !important;
        content: none !important;
    }

    .navs,
    .blk ul.navbar li.navs {
        width: 100% !important;
        max-width: 100% !important;
        padding: 4px !important;
        list-style: none !important;
        box-sizing: border-box !important;
        float: none !important;
        margin: 0 !important;
    }

    .navs img,
    .blk ul.navbar li.navs img {
        width: 100% !important;
        height: auto !important;
        max-height: 200px !important;
        object-fit: contain !important;
        display: block !important;
        margin: 0 auto !important;
    }

    /* ---- Book Covers ---- */
    .cover-b {
        width: 100% !important;
        height: auto !important;
        max-height: 180px;
        float: none !important;
        object-fit: contain;
    }

    .cover-b2 {
        width: 100px !important;
        height: 130px !important;
    }

    /* ---- Book List (Category Page) ---- */
    .category-b {
        max-width: 100%;
        box-sizing: border-box;
    }

    .category-b > li {
        padding: 10px !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    .category-b > li .list-item-b > a {
        display: flex;
        flex-wrap: wrap;
    }

    .category-b .preview-b {
        width: 100% !important;
        text-align: center;
    }

    .category-b .preview-b img {
        float: none !important;
        margin: 0 auto;
        width: auto !important;
        max-width: 150px;
        height: auto !important;
    }

    .category-b .detail-b {
        margin-right: 0 !important;
        width: 100%;
    }

    .category-b .detail-b h2 {
        font-size: 15px;
        margin-top: 8px;
    }

    .category-b .detail-b .intro p {
        font-size: 12px;
    }

    /* ---- Book Detail Page ---- */
    .book-item img {
        min-width: 120px !important;
        max-width: 100% !important;
        width: 100% !important;
        float: none !important;
        margin: 10px auto !important;
    }

    .head-b .detail-b {
        margin-right: 0 !important;
        width: 100%;
    }

    .head-b .actions .button {
        padding: 5px 8px !important;
        font-size: 12px;
        height: auto !important;
        line-height: 20px !important;
    }

    /* ---- Price Block ---- */
    .price {
        font-size: 14px;
    }

    .price table {
        width: 100%;
    }

    /* ---- Block Heads ---- */
    .blk .head h1,
    .blk .head h2,
    .blk .head h3 {
        font-size: 15px;
    }

    .blk .head .see-all {
        font-size: 13px;
    }

    /* ---- Footer ---- */
    .footer {
        padding-bottom: 70px;
    }

    .footer .inr .row > .columns {
        width: 100% !important;
        float: none !important;
        padding: 10px 5px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .footer h5, .footer h4, .footer h3, .footer h2, .footer h1 {
        font-size: 15px;
    }

    .footer ul li {
        font-size: 13px;
    }

    .footer .desc {
        font-size: 12px;
    }

    /* ---- Main Menu / Navigation ---- */
    .main nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0;
        border-radius: 0;
    }

    .main nav ul li {
        float: none;
        border: none;
    }

    .main nav ul li a {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* ---- Ribbon ---- */
    .preview-b .ribbon,
    .price-w .ribbon {
        display: none;
    }

    /* ---- Buttons ---- */
    button.small, .button.small {
        padding: 10px 20px;
        font-size: 12px;
    }

    /* ---- Forms ---- */
    .contact_form {
        width: 100%;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Prevent iOS zoom */
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ---- Dialog / Modal ---- */
    .ui-dialog {
        width: 95% !important;
        max-width: 400px;
        left: 2.5% !important;
    }

    #register_open {
        width: 95% !important;
    }

    #register_open .row {
        margin: 0;
    }

    #register_open .col-sm-6 {
        width: 100%;
        float: none;
        padding: 0;
    }

    /* ---- Pagination ---- */
    .pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination li {
        margin: 2px;
    }

    /* ---- Tables ---- */
    .well-white {
        padding: 10px 5px;
        overflow-x: auto;
    }

    table {
        width: 100%;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ---- Search Side Bar ---- */
    .search_sidebar {
        width: 100%;
    }

    /* ---- Well White Sections ---- */
    .well-white section.row {
        margin-bottom: 15px;
    }

    /* ---- Accordion Menu ---- */
    .mcd-menu {
        width: 100% !important;
        display: flex;
        flex-wrap: wrap;
    }

    .mcd-menu li a {
        padding: 8px 12px;
        min-height: auto !important;
    }

    .mcd-menu li a strong {
        font-size: 12px;
    }

    .mcd-menu li a i {
        font-size: 18px;
    }

    .mcd-menu-contain {
        width: 100% !important;
        margin-right: 0 !important;
    }

    /* ---- Orders / Account Pages ---- */
    .panel {
        padding: 5px;
    }

    .panel-heading {
        font-size: 13px;
    }

    /* ---- General Typography ---- */
    h1 { font-size: 20px !important; }
    h2 { font-size: 18px !important; }
    h3 { font-size: 16px !important; }
    h4 { font-size: 15px !important; }

    /* ---- Misc ---- */
    .full-row {
        padding: 10px 0 0;
        max-width: 100%;
    }

    .row {
        width: 100%;
        max-width: 100%;
    }

    .well-white {
        box-shadow: 0 0 2px #C7C7C7;
        padding: 10px;
    }

    /* ---- Quiz / Test Pages ---- */
    .btn-warp {
        font-size: 11px;
    }

    /* ---- Box1 ---- */
    .box1 {
        padding: 5px;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ---- Book Detail Page ---- */
    .box1 .col-md-12 {
        width: 100% !important;
        float: none !important;
        max-width: 100%;
    }

    .box1 .book-item h1 {
        font-size: 16px !important;
    }

    .box1 .price-w {
        width: 100% !important;
        text-align: center;
        padding: 0 !important;
    }

    .box1 .price-w img {
        float: none !important;
        margin: 0 auto 10px;
        max-width: 180px;
        width: auto;
        height: auto;
    }

    .box1 .price table {
        width: 100%;
        font-size: 13px;
    }

    .box1 .actions .button,
    .box1 .actions .second .button {
        display: block;
        width: 100%;
        text-align: center;
        padding: 10px 5px !important;
        font-size: 13px;
        margin-bottom: 5px;
    }

    .box1 .table-striped td,
    .box1 .table-striped th {
        font-size: 12px;
        padding: 6px 4px;
    }

    .box1 .table-striped .button {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* ---- Cart Table ---- */
    .cart-table {
        font-size: 12px;
    }

    .cart-table img {
        max-width: 60px;
    }

    /* ---- Order Steps ---- */
    ul.step li a,
    ul.step li span {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }

    /* ---- Account / Library Pages ---- */
    .panel-body {
        padding: 10px;
    }

    .col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-9, .col-md-12,
    .col-sm-3, .col-sm-4, .col-sm-6, .col-sm-8, .col-sm-12 {
        width: 100% !important;
        float: none !important;
        max-width: 100%;
    }

    /* ---- Quiz Pages ---- */
    .test-cont {
        padding: 5px;
    }

    .test-cont .test-list .form-group {
        font-size: 14px;
        padding: 6px;
    }

    /* ---- Contact Page ---- */
    .contact_form input,
    .contact_form textarea {
        width: 100%;
    }

    /* ---- Search Results ---- */
    .search_sidebar select,
    .search_sidebar input {
        width: 100%;
        margin-bottom: 5px;
    }

    /* ---- Buttons ---- */
    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* ---- Alerts ---- */
    .alert {
        font-size: 13px;
        padding: 10px;
    }

    /* ---- Ribbon ---- */
    .ribbon {
        font-size: 10px !important;
    }

    .ribbon .blue,
    .ribbon .green,
    .ribbon .red,
    .ribbon .orange {
        padding: 4px 6px !important;
        font-size: 10px !important;
    }

    /* ---- عناصر با ساختار Flex بهتر ---- */
    .box1 .head-b .detail-b > .row {
        display: flex;
        flex-direction: column;
    }

    .box1 .head-b .detail-b .price-w {
        order: 1;
        width: 100% !important;
        text-align: center;
    }

    .box1 .head-b .detail-b .price-w + .columns {
        order: 2;
        width: 100% !important;
    }

    .box1 .intro {
        font-size: 13px;
        line-height: 1.8;
    }

    /* ---- آیکون سبد خرید موبایل ---- */
    .mobile-bottom-nav .fa-shopping-cart {
        position: relative;
    }

    /* ---- فرم ورود/ثبت‌نام موبایل ---- */
    .ui-dialog .ui-dialog-content {
        padding: 12px !important;
    }

    .ui-dialog input[type="text"],
    .ui-dialog input[type="password"],
    .ui-dialog input[type="email"],
    .ui-dialog input[type="tel"],
    .ui-dialog select {
        font-size: 16px !important;
        padding: 10px 12px !important;
        margin-bottom: 10px;
    }

    .ui-dialog span {
        font-size: 13px;
    }

    .ui-dialog input[type="submit"] {
        padding: 12px !important;
        font-size: 15px !important;
    }

    /* ---- انیمیشن محو شدن نرم ---- */
    .blk, .content-center, .footer {
        animation: none;
    }

    /* ---- خرید فصل دکمه‌ها ---- */
    .box1 .table-striped .button.buy-chapter {
        font-size: 11px !important;
        padding: 5px 10px !important;
        white-space: nowrap;
    }

    /* ---- Intro text ---- */
    .intro {
        font-size: 13px;
    }

    /* ---- Offset reset ---- */
    [class*="offset"] {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* ---- Force max-width on ALL elements to prevent overflow ---- */
    .inr, .row, .columns, div, section, header, footer, nav, main, article, aside {
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* ---- Fix inline-block whitespace ---- */
    img {
        max-width: 100%;
        height: auto;
    }

    /* ---- Prevent pre from overflowing ---- */
    pre, code {
        overflow-x: auto;
        max-width: 100%;
        word-wrap: break-word;
    }
}

/* ============================================
   Tablet Styles (769px - 1024px)
   ============================================ */
@media only screen and (min-width: 769px) and (max-width: 1024px) {

    /* Show bottom nav on tablet too (optional) */
    .mobile-bottom-nav {
        display: none;
    }

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden !important;
    }

    /* Header */
    .top-bar-z .logo .inr img {
        width: 120px;
    }

    /* Grid adjustments */
    .large-19 {
        width: 75% !important;
    }

    .large-5, .sidebar {
        width: 25% !important;
    }

    /* Book grid - Grid System for tablet */
    .navbar {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }

    .navs {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Slider */
    .small-slider, .big-slider {
        max-height: 250px;
    }

    .small-slider img, .big-slider img {
        height: 250px;
    }

    /* Menu */
    .main nav ul li a {
        padding: 7px 15px;
        font-size: 13px;
    }

    /* Footer */
    .footer .inr .row > .columns {
        padding: 10px;
    }
}

/* ============================================
   Small Mobile (max-width: 480px)
   ============================================ */
@media only screen and (max-width: 480px) {

    /* Book grid - 2 columns for small mobile */
    .navbar {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .navs {
        width: 100% !important;
        max-width: 100% !important;
        padding: 2px !important;
    }

    .navs img {
        max-height: 160px;
    }

    .top-bar-z .logo .inr img {
        width: 35px !important;
    }

    .top-bar-z .logo .inr {
        font-size: 11px;
    }

    .category-b .detail-b h2 {
        font-size: 14px;
    }

    .mobile-bottom-nav ul li a {
        font-size: 9px;
        padding: 4px 1px 3px;
    }

    .mobile-bottom-nav ul li a .nav-icon {
        width: 28px;
        height: 28px;
    }

    .mobile-bottom-nav ul li a .nav-icon i {
        font-size: 16px;
    }
}

/* ============================================
   Print Styles Enhancement
   ============================================ */
@media print {
    .mobile-bottom-nav {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }
}