﻿:root {
    --primary-dark: #1a2b3c;
    --accent-gold: #c5a059;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.bg-navy {
    background-color: var(--primary-dark);
}

.container {
    width: 100% !important;
    max-width: 960px !important;
    margin: 0 auto !important;
}

.nav-link {
    color: white !important;
}

.main-slider-img {
    width: 100% !important;
    height: 400px !important;
    border-radius: 0 !important;
}

#heroCarousel {
    border-radius: 0 !important;
    overflow: hidden;
}

.custom-indicators [button] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #bbb;
    border: none;
    margin: 0 5px;
    opacity: 0.8;
}

.custom-indicators .active {
    background-color: #8a7350;
    opacity: 1;
}

.book-card {
    border: none;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s;
}

.book-card:hover {
    transform: translateY(-5px);
}

.badge-new {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff4d4d;
    color: white;
}

.custom-card-width {
    width: calc(25% - 1rem);
    min-width: 200px;
}

.custom-card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    object-position: center;
}

.custom-scrollbar {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
}

.home-page .category-scroll-wrap {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    padding: 0 0 0.5rem;
    scroll-snap-type: x proximity;
}

.home-page .category-scroll-item {
    flex: 0 0 clamp(220px, 28vw, 300px);
    max-width: 300px;
    scroll-snap-align: start;
}

.home-page .category-scroll-card .custom-card-img {
    height: 180px;
}

.home-page .category-scroll-card .card-body h6 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-page .top-trending-scroll {
    scroll-snap-type: x proximity;
    padding-bottom: 0.5rem;
}

.home-page .top-trending-item {
    flex: 0 0 250px;
    width: 250px;
    scroll-snap-align: start;
}

.book-title {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.genre-card-wrapper {
    width: calc(25% - 12px);
    min-width: 240px;
}

.genre-card {
    height: 140px;
    transition: transform 0.3s ease;
}

.genre-card:hover {
    transform: scale(1.02);
}

.genre-card .card-img {
    height: 100%;
    object-fit: cover;
}

.genre-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 50%);
}

.genre-overlay-content {
    width: 100%;
}

.genre-author-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

.genre-name-text {
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.custom-genre-scrollbar::-webkit-scrollbar {
    height: 6px;
}

.custom-genre-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.card-img-wrapper img {
    width: 100%;
    aspect-ratio: 2/3;
    height: 220px;
    object-fit: cover;
    object-position: top;
}

.wishlist-btn:focus {
    outline: none;
    box-shadow: none;
}

.wishlist-btn.active i {
    color: #ff0000;
    opacity: 1 !important;
}

@media (max-width: 576px) {
    .home-page .category-scroll-item {
        flex-basis: 78vw;
        max-width: 78vw;
    }

    .home-page .top-trending-item {
        flex-basis: 78vw;
        width: 78vw;
    }

    .card-body {
        padding: 0.75rem !important;
    }

    .book-title {
        font-size: 0.1rem;
        line-clamp: 2;
    }

    .badge {
        font-size: 0.7rem;
        padding: 4px 8px !important;
    }
}

.home-page .home-hero {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    filter: saturate(0.94);
    will-change: transform, opacity, filter;
}

.home-page .home-hero.is-visible {
    animation: homeHeroReveal 1s cubic-bezier(0.18, 0.9, 0.2, 1) both;
}

.home-page .home-section {
    opacity: 0;
    transform: translateY(38px);
    will-change: transform, opacity;
}

.home-page .home-section.is-visible {
    animation: homeSectionReveal 0.78s cubic-bezier(0.2, 0.84, 0.26, 1) both;
}

.home-page .home-section .reveal-card {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.home-page .home-section.is-visible .reveal-card {
    animation: homeCardReveal 0.62s cubic-bezier(0.22, 0.9, 0.25, 1) both;
    animation-delay: var(--stagger-delay, 0ms);
}

.home-page .book-card,
.home-page .genre-card {
    transform-origin: center;
    backface-visibility: hidden;
}

.home-page .book-card:hover,
.home-page .genre-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 14px 28px rgba(12, 42, 74, 0.16) !important;
}

.home-page .book-card .card-img-wrapper img,
.home-page .genre-card .card-img {
    transition: transform 0.45s ease;
}

.home-page .book-card:hover .card-img-wrapper img,
.home-page .genre-card:hover .card-img {
    transform: scale(1.04);
}

@keyframes homeHeroReveal {
    0% {
        opacity: 0;
        transform: translateY(34px) scale(0.98);
        filter: saturate(0.86);
    }

    65% {
        opacity: 1;
        transform: translateY(-2px) scale(1.002);
        filter: saturate(1);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: saturate(1);
    }
}

@keyframes homeSectionReveal {
    0% {
        opacity: 0;
        transform: translateY(34px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes homeCardReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.985);
    }

    70% {
        opacity: 1;
        transform: translateY(-2px) scale(1.006);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {

    .home-page .home-hero,
    .home-page .home-section,
    .home-page .home-section .reveal-card,
    .home-page .book-card,
    .home-page .genre-card,
    .home-page .book-card .card-img-wrapper img,
    .home-page .genre-card .card-img {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
        filter: none !important;
    }
}

.genre-card-wrapper {
    flex: 0 0 auto;
    width: 240px;
}

.genre-card img {
    height: 300px;
    object-fit: cover;
}

.custom-scrollbar::-webkit-scrollbar {
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* HERO IMPROVEMENT */
.hero-slide {
    position: relative;
}

.main-slider-img {
    height: 420px;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2));
    display: flex;
    align-items: center;
    padding-left: 5%;
}

.hero-content {
    max-width: 500px;
}

.hero-content h1 {
    font-size: 2.5rem;
}

.hero-content .btn {
    margin-top: 10px;
}

/* Better controls */
.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 50%;
}

/* Rounded edges */
#heroCarousel {
    border-radius: 16px;
    overflow: hidden;
}

.home-chatbot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.home-chatbot__toggle {
    border: 0;
    background: transparent !important;
    padding: 0;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    animation: none;
    box-shadow: none;
}

.home-chatbot__toggle:focus-visible {
    outline: 2px solid rgba(150, 236, 255, 0.8);
    outline-offset: 3px;
}

.home-chatbot__toggle:hover {
    transform: none;
    box-shadow: none;
}

.home-chatbot__toggle:active {
    transform: none;
}

.home-chatbot.is-open .home-chatbot__toggle {
    transform: none;
    box-shadow: none;
}

.home-chatbot__toggle-mark {
    position: relative;
    width: 62px;
    height: 62px;
    display: inline-grid;
    place-items: center;
}

.home-chatbot__logo {
    display: block;
    max-width: none;
    object-fit: contain;
    filter: none;
}

.home-chatbot__logo--tiny {
    width: 62px;
    height: 62px;
    animation: chatbotFloatBreath 2.8s ease-in-out infinite;
}

.home-chatbot__logo--mini {
    width: 36px;
    height: 36px;
}

.home-chatbot__logo--hero {
    width: 126px;
    height: 126px;
    animation: chatbotFloatBreath 3.1s ease-in-out infinite;
}

.home-chatbot__pulse {
    position: absolute;
    inset: -8px;
    border: 2px solid rgba(165, 241, 255, 0.82);
    border-radius: 50%;
    pointer-events: none;
    animation: none;
    display: none;
}

.home-chatbot__panel {
    width: min(390px, calc(100vw - 24px));
    background: #f7fbff;
    border: 1px solid #d8e4f1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 34px rgba(10, 40, 73, 0.2);
    opacity: 0;
    transform: translateY(12px) scale(0.975);
    pointer-events: none;
    transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.2, 0.82, 0.26, 1);
}

.home-chatbot.is-open .home-chatbot__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.home-chatbot__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--sma-navy-800);
    color: var(--sma-surface);
}

.home-chatbot__title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.home-chatbot__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

.home-chatbot__title {
    font-size: 0.95rem;
    margin: 0;
}

.home-chatbot__status {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.88);
}

.home-chatbot__close {
    border: none;
    background: transparent;
    color: var(--sma-surface);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.home-chatbot__hero {
    padding: 12px 12px 4px;
    display: flex;
    justify-content: center;
}

.home-chatbot__logo-stage {
    position: relative;
    width: 164px;
    height: 148px;
    display: grid;
    place-items: center;
}

.home-chatbot__logo-stage::before {
    content: "";
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(127, 218, 255, 0.44) 0%, rgba(127, 218, 255, 0) 70%);
    filter: blur(1px);
    animation: chatbotAuraPulse 3.4s ease-in-out infinite;
}

.home-chatbot__logo-stage::after {
    content: "";
    position: absolute;
    width: 138px;
    height: 138px;
    border-radius: 50%;
    border: 1.5px dashed rgba(130, 218, 255, 0.7);
    animation: chatbotAuraSpin 12s linear infinite;
}

.home-chatbot__orb {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d2ffff, #2ca8dc);
    box-shadow: 0 0 0 4px rgba(176, 237, 255, 0.24);
    animation: chatbotOrbit 4.6s linear infinite;
}

.home-chatbot__orb--one {
    top: 10px;
    left: 16px;
}

.home-chatbot__orb--two {
    top: 20px;
    right: 14px;
    animation-delay: -1.5s;
}

.home-chatbot__orb--three {
    bottom: 14px;
    right: 34px;
    animation-delay: -3s;
}

.home-chatbot__messages {
    max-height: 260px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-chatbot__msg {
    width: fit-content;
    max-width: 88%;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.84rem;
    line-height: 1.45;
}

.home-chatbot__msg--bot {
    align-self: flex-start;
    background: #e6f2ff;
    color: var(--sma-navy-800);
}

.home-chatbot__msg--user {
    align-self: flex-end;
    background: var(--sma-navy-800);
    color: var(--sma-surface);
}

.home-chatbot__msg--guide {
    max-width: 94%;
    background: linear-gradient(180deg, #eef7ff 0%, #e2f1ff 100%);
    border: 1px solid #bfd8f0;
    color: var(--sma-navy-800);
}

.home-chatbot__guide-title {
    margin: 0 0 6px;
    font-weight: 700;
}

.home-chatbot__guide-list {
    margin: 0;
    padding-left: 18px;
}

.home-chatbot__guide-list li {
    margin-bottom: 4px;
}

.home-chatbot__guide-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.home-chatbot__guide-links a {
    display: inline-flex;
    align-items: center;
    border: 1px solid #9ec2e6;
    border-radius: 999px;
    background: var(--sma-surface);
    color: var(--sma-navy-800);
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 4px 9px;
}

.home-chatbot__guide-image {
    display: block;
    width: 100%;
    max-width: 230px;
    margin-top: 9px;
    border-radius: 10px;
    border: 1px solid #bdd5ea;
}

.home-chatbot__quick-actions {
    padding: 0 12px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.home-chatbot__quick-actions button {
    border: 1px solid #c6d8eb;
    border-radius: 999px;
    background: var(--sma-surface);
    color: #10365f;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 6px 10px;
}

.home-chatbot__input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #d8e4f1;
    background: var(--sma-surface);
}

.home-chatbot__input-row input {
    flex: 1;
    border: 1px solid #c9d8e8;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.85rem;
    min-width: 0;
}

.home-chatbot__input-row button {
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    background: var(--sma-navy-800);
    color: var(--sma-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

@keyframes chatbotFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

@keyframes chatbotFloatBreath {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-6px) scale(1.07);
    }
}

@keyframes chatbotToggleGlow {

    0%,
    100% {
        box-shadow: 0 14px 32px rgba(16, 52, 96, 0.35);
    }

    50% {
        box-shadow: 0 18px 38px rgba(26, 96, 150, 0.42);
    }
}

@keyframes chatbotPulseRing {
    0% {
        opacity: 0.85;
        transform: scale(0.72);
    }

    70% {
        opacity: 0;
        transform: scale(1.32);
    }

    100% {
        opacity: 0;
        transform: scale(1.25);
    }
}

@keyframes chatbotAuraPulse {

    0%,
    100% {
        opacity: 0.54;
        transform: scale(0.96);
    }

    50% {
        opacity: 0.82;
        transform: scale(1.06);
    }
}

@keyframes chatbotAuraSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes chatbotOrbit {
    0% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(7px, -8px) scale(1.05);
    }

    50% {
        transform: translate(0, -14px) scale(1);
    }

    75% {
        transform: translate(-6px, -8px) scale(0.95);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

@media (max-width: 767.98px) {
    .home-chatbot {
        right: 10px;
        left: 10px;
        bottom: 12px;
        align-items: stretch;
    }

    .home-chatbot__toggle {
        align-self: flex-end;
        width: 82px;
        height: 82px;
    }

    .home-chatbot__toggle-mark {
        width: 54px;
        height: 54px;
    }

    .home-chatbot__logo--tiny {
        width: 54px;
        height: 54px;
    }

    .home-chatbot__panel {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {

    .home-chatbot__logo--tiny,
    .home-chatbot__logo--hero,
    .home-chatbot__pulse,
    .home-chatbot__orb,
    .home-chatbot__toggle,
    .home-chatbot__logo-stage::before,
    .home-chatbot__logo-stage::after {
        animation: none !important;
    }
}

/* Responsive refinements for Home categories + chatbot */
.home-category-section .home-category-col .book-card {
    height: 100%;
}

.home-category-section .custom-card-img {
    height: clamp(150px, 20vw, 180px);
}

.home-category-section .card-body h6 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-chatbot {
    bottom: max(12px, env(safe-area-inset-bottom));
}

.home-chatbot__panel {
    display: flex;
    flex-direction: column;
    max-height: min(72vh, 560px);
}

.home-chatbot__messages {
    flex: 1 1 auto;
    min-height: 110px;
    max-height: none;
}

@media (max-width: 767.98px) {
    .home-category-section .home-section-head {
        margin-bottom: 0.85rem !important;
        gap: 0.75rem;
    }

    .home-category-section .home-section-head h3 {
        margin: 0;
        font-size: 2rem;
    }

    .home-category-section .home-section-head .btn {
        font-size: 0.84rem;
        padding: 0.28rem 0.62rem;
        white-space: nowrap;
    }

    .home-category-section .home-category-row {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.75rem;
        padding: 0 0.1rem 0.35rem;
        margin-left: 0;
        margin-right: 0;
        scroll-snap-type: x proximity;
    }

    .home-category-section .home-category-row > * {
        padding-left: 0;
        padding-right: 0;
    }

    .home-category-section .home-category-col {
        flex: 0 0 78vw;
        max-width: 78vw;
        scroll-snap-align: start;
    }

    .home-category-section .custom-card-img {
        height: 160px;
    }

    .home-category-section .card-body {
        padding: 0.58rem 0.76rem !important;
    }

    .home-chatbot {
        right: 10px;
        bottom: max(8px, env(safe-area-inset-bottom));
    }

    .home-chatbot:not(.is-open) {
        left: auto;
        align-items: flex-end;
    }

    .home-chatbot.is-open {
        left: 8px;
        right: 8px;
        align-items: stretch;
    }

    .home-chatbot__toggle {
        width: 64px;
        height: 64px;
        align-self: flex-end;
    }

    .home-chatbot__toggle-mark {
        width: 50px;
        height: 50px;
    }

    .home-chatbot__logo--tiny {
        width: 50px;
        height: 50px;
    }

    .home-chatbot__panel {
        width: 100%;
        max-height: min(64vh, 460px);
        border-radius: 14px;
    }

    .home-chatbot__hero {
        display: none;
    }

    .home-chatbot__header {
        padding: 10px 12px;
    }

    .home-chatbot__messages {
        min-height: 92px;
        padding: 10px;
    }

    .home-chatbot__msg {
        font-size: 0.81rem;
    }

    .home-chatbot__quick-actions {
        padding: 0 10px 8px;
    }

    .home-chatbot__quick-actions button {
        font-size: 0.74rem;
        padding: 5px 9px;
    }

    .home-chatbot__input-row {
        padding: 8px 10px 10px;
    }

    .home-chatbot__input-row input {
        font-size: 0.82rem;
        padding: 7px 10px;
    }
}

@media (max-width: 420px) {
    .home-category-section .home-category-col {
        flex-basis: 84vw;
        max-width: 84vw;
    }

    .home-category-section .home-section-head h3 {
        font-size: 1.85rem;
    }
}

/* Keep chatbot compact on mobile when opened (no full-page sheet) */
@media (max-width: 767.98px) {
    .home-chatbot,
    .home-chatbot:not(.is-open),
    .home-chatbot.is-open {
        left: auto !important;
        right: 10px !important;
        align-items: flex-end !important;
    }

    .home-chatbot__panel {
        width: min(340px, calc(100vw - 20px)) !important;
        max-height: min(58vh, 420px) !important;
        border-radius: 14px;
    }
}

@media (max-width: 420px) {
    .home-chatbot,
    .home-chatbot:not(.is-open),
    .home-chatbot.is-open {
        right: 8px !important;
    }

    .home-chatbot__panel {
        width: min(320px, calc(100vw - 16px)) !important;
        max-height: min(56vh, 400px) !important;
    }
}
