


.list.nav-item .nav-link {
   
    color: #ffffff;
    font-size: 16px;
}
.list .navbar-nav .nav-link.active {
    color: #ffffff;
}
.list .nav-item .active {
   
    border-radius: 20px;
    padding: 8px 15px;
    color: #ffffff;
}
.list .nav-item .nav-image{
    width: 20px;
    height: 20px;
    padding: 9.5px 7px 4.5px;
    border: solid 1px #0d0d0d;
}
.profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/*************************************************************** second navbar **********************************************************/

.second-navbar {
    height: 80px;
    padding: 0 24px 0 48px;
  border: solid 1px #ffffff;
  background-color: #ccecfc;
}

.second-navbar .nav-link {
    font-size: 16px;
    color: #000;
    padding: 10px 15px;
    border-radius: 40px;
}

.second-navbar .nav-item {
    position: relative;
    margin: 0 11px 0 11px;
    padding: 0; 
}
.nav-item.dropdown {
    position: relative;
}

/* Show dropdown on hover */
.nav-item.dropdown:hover .dropdown-menu {
    display: block;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    font-size: 14px;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    transition: opacity 0.3s ease, visibility 0.3s ease;

}

/* Style dropdown items */
.dropdown-item {
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: 400;
    color: #333;
    text-align: inherit;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.dropdown-item:hover {
    color: #fff;
    background-color: #007bff;
}
/* Active & Hover State */
.second-navbar .nav-link.active {
    color: #000;
}

/* Dropdown Styling */
.dropdown-menu {
    background-color: #fff;
    border-radius: 8px;
    min-width: 180px;
}


.custom-link {
    color: #000 !important;  /* Override Bootstrap's default link color */
    text-align: right;        /* Align text to the right */
    /*font-family: Tajawal, sans-serif; /* Use Tajawal font */
    font-size: 18px;          /* Set font size */
    font-style: normal;       
    font-weight: 500;         /* Medium weight */
    line-height: normal;      
    padding: 10px 15px;       /* Apply padding */
    display: block;           /* Ensure block-level display */
  
}

.dropdown-menu a:hover {
    background-color: #f7c276;
}

/*****************************************************************************************************************/
.book-cat {
    color: var( #ffffffff);
    text-align: justify;
   
    font-size: 16px;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
margin: 20px;
}
.col-auto .custom-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: #f8f6f2;
    color: #e4af69;
    border: none;
    border-radius: 20px;
  /*  padding: 6px 12px;*/
    font-weight: bold;
    margin-top: 17px;
    height: 54px;
}
.col-auto .custom-btn:hover {
    background-color: #f1ede7;
    color: #d89f5a;
}

/*****************************************************************************************************/


.views-count{
    color: var(--Success-500, #00866B);
text-align: right;
/*font-family: "DIN Next LT Arabic";*/
font-size: 14px;
font-style: normal;
font-weight: 300;
line-height: normal;
}

.costum-title {
  color: #000;
  text-align: right;
  font-size: 18px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.4; /* better readability */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;  /* show up to 2 lines */
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  max-width: 100%;
  height: auto;
  white-space: normal; /* allow wrapping */
}

.costum-author{
    color: var(--Gray-800, #2B323B);
text-align: right;
/*font-family: "DIN Next LT Arabic";*/
font-size: 14px;
font-style: normal;
font-weight: 300;
line-height: normal;
 white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}
.book-link {
    text-decoration: none;
    display: block; /* Ensures it does not shrink */
}

.book-link img {
    display: block;
    max-width: 100%;
    height: auto;
    border: none;
}


/******************************************** dropdown-menu ************************************/
.dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute;
    right: 0; /* Align to the right edge of the parent */
    top: 100%; /* Position below the profile image */
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 10px;
    min-width: 150px;
    max-width: 200px; /* Optional: Set a max-width to prevent overflow */
    overflow: auto; /* Add scroll if content overflows */
}

.dropdown-menu.show {
    display: block; /* Show when toggled */
}

.dropdown-menu a {
    display: block;
    padding: 8px 0px;
    color: #333;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: #f5f5f5;
}

/* Ensure the dropdown doesn't overflow the viewport */
.dropdown {
    position: relative;
  /*  padding-left: 118px;*/
}

.dropdown-menu {
    right: 0;
    left: auto; /* Ensure it aligns to the right */
}

/* Adjust for small screens */
@media (max-width: 768px) {
    .dropdown-menu {
        right: auto;
        left: 0; /* Align to the left on small screens */
    }
}
 


#showAllBtn.active {
    background-color: #f0f0f0;
    border-color: #ddd;
}



@media (min-width: 992px) {
    .navbar {
        padding: 10px 0px;
    }
}



/* ========================================
   MOBILE-ONLY ADDITIONS
   Keep all existing desktop styles unchanged
   ======================================== */

/* ========================================
   TABLETS (768px - 991px)
   ======================================== */
@media (max-width: 991px) {
    
    /* Second Navbar - Make it scrollable horizontally */
    .second-navbar {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding: 12px 16px !important;
    }

    .second-navbar .navbar-nav {
        flex-wrap: nowrap !important;
        display: inline-flex;
    }

    .second-navbar .nav-item {
        flex-shrink: 0;
    }

    /* Show scroll indicator */
    .second-navbar::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to left, rgba(204, 236, 252, 1), rgba(204, 236, 252, 0));
        pointer-events: none;
        z-index: 1;
    }

    /* Dropdown menus on tablet */
    .nav-item.dropdown .dropdown-menu {
        position: fixed;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: 400px;
        margin: 0 auto;
    }
}

/* ========================================
   MOBILE PHONES (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {
    
    /* Container spacing */
    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Second Navbar stays visible and scrollable */
    .second-navbar {
        height: auto !important;
        min-height: 60px;
        padding: 10px 12px !important;
        display: block !important; /* Keep it visible */
    }

    .second-navbar .container-fluid {
        padding: 0 !important;
    }

    .second-navbar .navbar-nav {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    .second-navbar .navbar-nav::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .second-navbar .nav-item {
        margin: 0 4px;
    }

    .second-navbar .nav-link,
    .custom-link {
        font-size: 14px !important;
        padding: 8px 12px !important;
        white-space: nowrap;
    }

    /* Dropdown positioning for mobile */
    .nav-item.dropdown .dropdown-menu {
        position: fixed;
        top: auto !important;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        max-height: 60vh;
        overflow-y: auto;
        z-index: 1050;
        margin-top: 8px;
    }

    .dropdown-item {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Header controls */
    .row.g-0.d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 12px;
    }

    .col-auto {
        width: 100%;
        margin-top: 0 !important;
    }

    .book-cat {
        font-size: 18px;
        margin: 12px 0 !important;
    }

    .custom-btn {
        width: 100%;
        justify-content: center;
        height: 48px !important;
        margin-top: 0 !important;
    }

    /* Book Grid - 2 columns */
    .container.mt-4 .row {
        margin: 0 -8px;
    }

    .container.mt-4 .row > div[class*="col-"] {
        width: 50% !important;
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 8px !important;
        margin-bottom: 20px !important;
    }

    .card-body {
        padding: 10px 4px !important;
    }

    /* Book images */
    .book-link img {
        width: 100%;
        height: auto;
    }

    /* Typography adjustments */
    .costum-title {
        font-size: 14px !important;
        margin-bottom: 6px;
    }

    .costum-author {
        font-size: 12px !important;
        margin-bottom: 6px;
    }

    .views-count {
        font-size: 12px !important;
    }

    .bookmark-icon2 {
        width: 18px !important;
        height: 27px !important;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 20px;
    }

    .pagination .page-link {
        padding: 8px 12px;
        margin: 4px 2px;
        font-size: 14px;
    }

    /* Search results header */
    .search-results-header {
        padding: 16px !important;
    }

    .search-results-header h2 {
        font-size: 18px !important;
    }

    .search-results-header p {
        font-size: 14px;
    }

    .search-results-header .btn {
        margin-top: 8px;
    }
}

/* ========================================
   SMALL MOBILE (max-width: 576px)
   ======================================== */
@media (max-width: 576px) {
    
    /* Second Navbar - smaller on small screens */
    .second-navbar {
        padding: 8px 10px !important;
        min-height: 50px;
    }

    .second-navbar .nav-link,
    .custom-link {
        font-size: 13px !important;
        padding: 6px 10px !important;
    }

    /* Keep 2 columns but with less padding */
    .container.mt-4 .row > div[class*="col-"] {
        padding: 0 6px !important;
    }

    /* Smaller typography */
    .book-cat {
        font-size: 16px !important;
    }

    .costum-title {
        font-size: 13px !important;
    }

    .costum-author {
        font-size: 11px !important;
    }

    .views-count {
        font-size: 11px !important;
    }

    /* Buttons */
    .custom-btn {
        height: 44px !important;
        font-size: 14px;
        padding: 8px 16px;
    }

    .custom-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Pagination */
    .pagination .page-link {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* Dropdown on very small screens */
    .dropdown-menu {
        min-width: 140px;
        font-size: 13px;
    }

    .dropdown-item {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ========================================
   VERY SMALL SCREENS (max-width: 400px)
   ======================================== */
@media (max-width: 400px) {
    
    /* Consider single column if needed */
    .container.mt-4 .row > div[class*="col-"] {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 0 12px !important;
    }

    .book-link img {
        max-width: 200px;
        margin: 0 auto;
        display: block;
    }

    .card-body {
        text-align: center;
    }

    .costum-title,
    .costum-author {
        text-align: center;
    }

    .d-flex.justify-content-start {
        justify-content: center !important;
    }
}

/* ========================================
   TOUCH DEVICE IMPROVEMENTS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    
    /* Better touch targets */
    .nav-link,
    .dropdown-item,
    .book-link,
    .page-link {
        min-height: 44px;
    }

    /* Touch feedback */
    .nav-link:active,
    .dropdown-item:active,
    .custom-btn:active,
    .page-link:active {
        opacity: 0.7;
        transform: scale(0.98);
    }

    .book-link:active img {
        transform: scale(0.98);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Only apply on mobile */
@media (max-width: 768px) {
    
    /* Focus styles for keyboard navigation */
    .nav-link:focus,
    .dropdown-item:focus,
    .custom-btn:focus,
    .book-link:focus,
    .page-link:focus {
        outline: 2px solid #FFAF1F;
        outline-offset: 2px;
    }

    /* Reduced motion support */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            transition-duration: 0.01ms !important;
        }
        
        .second-navbar .navbar-nav {
            scroll-behavior: auto;
        }
    }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */
@media (max-width: 768px) and (orientation: landscape) {
    
    .second-navbar {
        min-height: 50px;
        padding: 8px 12px !important;
    }

    .dropdown-menu {
        max-height: 50vh;
    }

    /* Keep 2 or 3 columns in landscape */
    .container.mt-4 .row > div[class*="col-"] {
        width: 33.333% !important;
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
}

/* ========================================
   FIX FOR HIDDEN ELEMENTS
   ======================================== */

/* Make sure navigation is ALWAYS visible on mobile */
@media (max-width: 768px) {
    .second-navbar,
    .second-navbar .navbar-nav,
    .second-navbar .nav-item,
    .second-navbar .nav-link {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* ========================================
   UTILITY CLASSES FOR MOBILE
   ======================================== */
@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }

    .mobile-show {
        display: block !important;
    }

    .mobile-center {
        text-align: center !important;
        justify-content: center !important;
    }
}