@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap');

/* ================= ROOT ================= */
:root {
    --main: #4f5dff;
    --main-dark: #1e2a55;
    --bg: #f5f7ff;
    --card: #ffffff;
    --text: #1e1e2f;
    --muted: #6b7280;
    --radius-lg: 24px;
    --radius-sm: 14px;
    --transition: 0.35s ease;
}

/* ================= GLOBAL ================= */
html {
    scroll-behavior: smooth;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

img {
    max-width: 100%;
    display: block;
}

button,
input {
    font-family: 'Cairo', sans-serif;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
}

/* ================= NAVBAR ================= */
.navbar {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid #eee;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
}

.logo {
    font-size: 26px;
    font-weight: 900;
    color: var(--main);
    letter-spacing: 0.5px;
}

/* nav links */
.nav-search {
    display: flex;
    align-items: center;
}

.nav-search a {
    text-decoration: none;
    font-weight: 600;
    color: var(--text);
    margin-left: 25px;
    position: relative;
    transition: var(--transition);
}

.nav-search a::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--main);
    transition: var(--transition);
}

.nav-search a:hover::after {
    width: 100%;
}

/* nav search */
.nav-search-box {
    display: flex;
    margin-left: 20px;
}

.nav-search-box input {
    padding: 7px 14px;
    border-radius: 20px 0 0 20px;
    border: 1px solid #ddd;
    outline: none;
    transition: var(--transition);
}

.nav-search-box input:focus {
    border-color: var(--main);
}

.nav-search-box button {
    padding: 7px 16px;
    border-radius: 0 20px 20px 0;
    border: none;
    background: var(--main);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.nav-search-box button:hover {
    background: #3f4cff;
}

/* ================= HERO ================= */
.hero {
    background: radial-gradient(circle at top, #6a75ff, #4f5dff);
    padding: 120px 0 140px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    bottom: -60px;
    left: 0;
    width: 100%;
    height: 120px;
    background: var(--bg);
    border-radius: 50% 50% 0 0;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.tag {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 6px 22px;
    border-radius: 30px;
    font-size: 14px;
    margin-bottom: 15px;
}

.hero h1 {
    font-size: 56px;
    font-weight: 900;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    margin-top: 25px;
    background: #fff;
    color: var(--main);
    padding: 15px 45px;
    border-radius: 40px;
    font-weight: 800;
    text-decoration: none;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

/* ================= BOOKS ================= */
.books {
    padding: 90px 0;
}

.books h2 {
    text-align: center;
    font-size: 40px;
    font-weight: 900;
    margin-bottom: 30px;
    color: var(--main-dark);
}

/* search main */
.search-box {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.search-box input {
    width: 300px;
    padding: 14px 18px;
    border-radius: 30px 0 0 30px;
    border: 2px solid #e5e7eb;
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--main);
    box-shadow: 0 0 0 4px rgba(79,93,255,0.15);
}

.search-box button {
    padding: 14px 22px;
    border-radius: 0 30px 30px 0;
    border: none;
    background: var(--main);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: #3f4cff;
}

/* ================= GRID ================= */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 35px;
}

/* card */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 30px 22px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    max-width: 300px;
    width: 100%;
}

/* shine effect */
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(79,93,255,0.18),
        transparent
    );
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 35px 70px rgba(79,93,255,0.25);
}

/* card image */
.card img {
    width: 100%;
    max-width: 220px;
    margin: 0 auto 1px;
    border-radius: 15px;
}

/* card title */
.card h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 15px;
    margin-top: 10px;
}

/* card buttons */
.card-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 5;
}

.card-actions a {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
}

.card-actions a:first-child {
    background: #eef2ff;
    color: var(--main);
}

.card-actions a:first-child:hover {
    background: var(--main);
    color: #fff;
}

.card-actions a:last-child {
    background: var(--main);
    color: #fff;
}

.card-actions a:last-child:hover {
    background: #3f4cff;
}

/* ================= FOOTER ================= */
footer {
    background: var(--main-dark);
    color: #fff;
    text-align: center;
    padding: 25px 0;
    font-size: 14px;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
    .hero h1 {
        font-size: 44px;
    }

    .books h2 {
        font-size: 32px;
    }
}

@media (max-width: 805px) {

    .hero {
        padding: 90px 0 110px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        justify-content: center;
    }

      .nav {
    flex-direction: column;
    align-items: stretch;
  }

  .logo {
    order: 1;
    text-align: center;
  }

  .lang-select {
    order: 2;
    margin: 10px auto;
    width: fit-content;
    margin-left: 15px;
  }

  .nav-search {
    order: 3;
  }

    .nav {
    flex-direction: column;
    align-items: center;
  }

  .logo {
    order: 1;
    margin-bottom: 10px;
  }

  .lang-select {
    order: 2;
    margin: 10px 0;
  }

  .nav-search {
    order: 3;
  }

  #book {
    display: none;
  }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 30px;
    }

    .books {
        padding: 60px 0;
    }

    .search-box {
        flex-direction: column;
        gap: 10px;
    }

    .nav-search {
        display: none;
    }
}

#loader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg,#4f5dff,#1e2a55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.hide {
  opacity: 0;
  visibility: hidden;
}

.loader-box {
  text-align: center;
}

.loader-title {
  color: #fff;
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 25px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* bar loading */
.bar {
  width: 220px;
  height: 8px;
  background: rgba(255,255,255,0.25);
  border-radius: 20px;
  overflow: hidden;
  margin: auto;
}

.bar span {
  display: block;
  height: 100%;
  width: 40%;
  background: #fff;
  border-radius: 20px;
  animation: loading 1.2s ease-in-out infinite;
}

/* animations */
@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.lang-select {
  padding: 8px 18px;
  border-radius: 10px;
  border: 2px solid #4f5dff;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  background: #fff;
  color: #4f5dff;
  margin-left: 20px;
}