/* ============================================================
   RiyBooks — Content Page: Web View Styles
   Print styles remain inline in each page (unchanged).
   This file only applies in screen (web) mode.
   ============================================================ */

/* ---------- View toggle bar ---------- */
.view-bar {
  background: #fff;
  border-bottom: 1px solid #dadce0;
  position: sticky;
  top: 0;
  z-index: 200;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.view-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.view-bar-left a {
  font-size: 0.85rem;
  color: #1a73e8;
  text-decoration: none;
  white-space: nowrap;
}
.view-bar-left a:hover { text-decoration: underline; }

.view-bar-sep {
  color: #dadce0;
  font-size: 0.85rem;
}

.view-bar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-print-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #1a73e8;
  background: transparent;
  color: #1a73e8;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-print-view:hover {
  background: #1a73e8;
  color: #fff;
}
.btn-print-view svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-print-now {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #1a73e8;
  color: #fff;
  transition: background 0.15s ease;
}
.btn-print-now:hover { background: #1557b0; }
.btn-print-now svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ---------- Web view wrapper ---------- */
@media screen {
  body.web-view {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #202124;
    font-size: 16px;
    line-height: 1.7;
    margin: 0;
    padding: 0;
  }

  /* Hide the raw print pages in web view */
  body.web-view .page {
    display: none;
  }

  /* Show the web content panel */
  body.web-view .web-content {
    display: block;
  }

  /* In print view (no web-view class), hide web panel */
  body:not(.web-view) .web-content {
    display: none;
  }

  /* ---------- Web content layout ---------- */
  .web-content {
    max-width: 780px;
    margin: 0 auto;
    padding: 32px 20px 60px;
  }

  /* Page title */
  .wc-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #dadce0;
  }

  .wc-subject-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    color: #fff;
  }
  .tag-maths   { background: #ea4335; }
  .tag-english { background: #4285f4; }
  .tag-evs     { background: #34a853; }
  .tag-bengali { background: #9c27b0; }
  .tag-gk      { background: #ff6d00; }

  .wc-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.25;
    color: #202124;
    margin-bottom: 6px;
  }

  .wc-header .wc-meta {
    font-size: 0.85rem;
    color: #5f6368;
  }

  /* ---------- Sections ---------- */
  .wc-section {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }

  .wc-section h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #202124;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f3f4;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .wc-section h2 .sec-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
  }

  /* ---------- Intro / info box ---------- */
  .wc-intro {
    background: #e8f0fe;
    border-left: 4px solid #1a73e8;
    border-radius: 0 8px 8px 0;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    line-height: 1.65;
  }

  /* ---------- Key points box ---------- */
  .wc-keybox {
    background: #e6f4ea;
    border: 1.5px solid #34a853;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
  }

  .wc-keybox .kb-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0d652d;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  .wc-keybox ul {
    margin-left: 18px;
  }

  .wc-keybox li {
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #202124;
  }

  /* ---------- Example box ---------- */
  .wc-example {
    background: #fff8e1;
    border-left: 4px solid #fbbc04;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 0.9rem;
  }

  .wc-example .ex-label {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #b06000;
    margin-bottom: 6px;
  }

  /* ---------- Tables ---------- */
  .wc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 12px 0;
  }

  .wc-table th {
    background: #f1f3f4;
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    border: 1px solid #dadce0;
    font-size: 0.85rem;
  }

  .wc-table td {
    padding: 9px 14px;
    border: 1px solid #dadce0;
    vertical-align: top;
  }

  .wc-table tr:nth-child(even) td { background: #f8f9fa; }

  /* ---------- Practice questions ---------- */
  .wc-questions {
    counter-reset: q-counter;
  }

  .wc-q-group {
    margin-bottom: 20px;
  }

  .wc-q-group-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
  }

  .wc-question {
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .wc-question .q-num {
    font-weight: 700;
    color: #1a73e8;
    margin-right: 6px;
  }

  /* MCQ options */
  .wc-mcq-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }

  .wc-mcq-options span {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.85rem;
    cursor: default;
  }

  /* Fill-in-the-blank */
  .wc-blank {
    display: inline-block;
    min-width: 100px;
    border-bottom: 2px solid #1a73e8;
    margin: 0 4px;
    height: 20px;
    vertical-align: bottom;
  }

  /* Answer area */
  .wc-answer-area {
    background: #fff;
    border: 1px dashed #dadce0;
    border-radius: 6px;
    min-height: 48px;
    margin-top: 8px;
    padding: 8px;
    font-size: 0.85rem;
    color: #9aa0a6;
  }

  /* ---------- Activity box ---------- */
  .wc-activity {
    background: #fce8e6;
    border: 2px dashed #ea4335;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
  }

  .wc-activity .act-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #c5221f;
    margin-bottom: 10px;
  }

  /* ---------- Think box ---------- */
  .wc-think {
    background: #f3e8fd;
    border-left: 4px solid #9c27b0;
    border-radius: 0 8px 8px 0;
    padding: 10px 16px;
    font-style: italic;
    font-size: 0.9rem;
    color: #4a148c;
    margin: 10px 0;
  }

  /* ---------- Objectives list ---------- */
  .wc-objectives {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .wc-objectives li {
    padding: 6px 0 6px 28px;
    position: relative;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f3f4;
  }

  .wc-objectives li:last-child { border-bottom: none; }

  .wc-objectives li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #34a853;
    font-weight: 700;
  }

  /* ---------- Print CTA at bottom ---------- */
  .wc-print-cta {
    text-align: center;
    padding: 28px 20px;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 12px;
    margin-top: 32px;
  }

  .wc-print-cta p {
    font-size: 0.95rem;
    color: #5f6368;
    margin-bottom: 14px;
  }

  /* ---------- Responsive: tablet ---------- */
  @media (max-width: 768px) {
    .web-content {
      padding: 24px 16px 56px;
    }

    .wc-header h1 {
      font-size: 1.5rem;
    }

    .wc-section {
      padding: 20px 18px;
      border-radius: 10px;
    }

    /* Tables: allow horizontal scroll on tablet */
    .wc-table {
      display: block;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      white-space: nowrap;
    }

    .wc-table th,
    .wc-table td {
      white-space: normal;
      min-width: 100px;
    }
  }

  /* ---------- Responsive: mobile ---------- */
  @media (max-width: 480px) {
    /* View bar: compact single row */
    .view-bar {
      padding: 8px 12px;
      gap: 8px;
      flex-wrap: nowrap;
    }

    .view-bar-left {
      gap: 6px;
      flex: 1;
      min-width: 0;
    }

    /* Hide the topic title in the breadcrumb on small screens — saves space */
    .view-bar-title {
      display: none;
    }

    /* Shrink breadcrumb text */
    .view-bar-left a,
    .view-bar-sep {
      font-size: 0.78rem;
    }

    /* Icon-only buttons on mobile */
    .btn-print-view,
    .btn-print-now {
      padding: 7px 10px;
      font-size: 0;        /* hide text */
      gap: 0;
      border-radius: 8px;
      min-width: 36px;
      justify-content: center;
    }

    .btn-print-view svg,
    .btn-print-now svg {
      width: 18px;
      height: 18px;
    }

    /* Content area */
    .web-content {
      padding: 16px 12px 64px;
    }

    .wc-header {
      margin-bottom: 20px;
      padding-bottom: 16px;
    }

    .wc-header h1 {
      font-size: 1.3rem;
      line-height: 1.3;
    }

    .wc-subject-tag {
      font-size: 0.7rem;
      padding: 2px 8px;
      margin-bottom: 8px;
    }

    /* Sections */
    .wc-section {
      padding: 16px 14px;
      border-radius: 8px;
      margin-bottom: 14px;
    }

    .wc-section h2 {
      font-size: 0.95rem;
      margin-bottom: 12px;
      padding-bottom: 8px;
      flex-wrap: wrap;
    }

    .wc-section h2 .sec-icon {
      width: 22px;
      height: 22px;
      font-size: 0.75rem;
    }

    /* Intro box */
    .wc-intro {
      padding: 12px 14px;
      font-size: 0.9rem;
    }

    /* Key box */
    .wc-keybox {
      padding: 14px 16px;
      border-radius: 8px;
    }

    .wc-keybox li {
      font-size: 0.875rem;
    }

    /* Example box */
    .wc-example {
      padding: 10px 12px;
      font-size: 0.875rem;
    }

    /* Think box */
    .wc-think {
      padding: 10px 12px;
      font-size: 0.875rem;
    }

    /* Tables: horizontal scroll with visible indicator */
    .wc-table {
      display: block;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 6px;
      /* subtle shadow on right edge to hint scrollability */
      background:
        linear-gradient(to right, #fff 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(255,255,255,0), #fff 70%) 0 100%,
        radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.08), transparent),
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.08), transparent) 0 100%;
      background-repeat: no-repeat;
      background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
      background-attachment: local, local, scroll, scroll;
    }

    .wc-table th,
    .wc-table td {
      padding: 8px 10px;
      font-size: 0.82rem;
      white-space: normal;
      min-width: 90px;
    }

    /* Questions */
    .wc-question {
      padding: 12px 12px;
      font-size: 0.875rem;
      margin-bottom: 8px;
    }

    .wc-q-group-title {
      font-size: 0.8rem;
      margin-bottom: 10px;
    }

    /* MCQ options: stack vertically on very small screens */
    .wc-mcq-options {
      flex-direction: column;
      gap: 6px;
      margin-top: 8px;
    }

    .wc-mcq-options span {
      font-size: 0.82rem;
      padding: 6px 10px;
    }

    /* Blank */
    .wc-blank {
      min-width: 70px;
    }

    /* Answer area */
    .wc-answer-area {
      min-height: 56px;
    }

    /* Activity box */
    .wc-activity {
      padding: 14px 14px;
      border-radius: 8px;
    }

    .wc-activity .act-title {
      font-size: 0.9rem;
    }

    /* Objectives */
    .wc-objectives li {
      font-size: 0.875rem;
      padding-left: 24px;
    }

    /* Print CTA */
    .wc-print-cta {
      padding: 20px 16px;
      border-radius: 10px;
      margin-top: 24px;
    }

    .wc-print-cta p {
      font-size: 0.875rem;
    }

    /* Print CTA button: full width on mobile */
    .wc-print-cta .btn-print-now {
      font-size: 0.875rem;
      padding: 10px 20px;
      width: 100%;
      justify-content: center;
    }
  }
}

/* ---------- Print: hide web content, show pages ---------- */
@media print {
  .view-bar   { display: none !important; }
  .web-content { display: none !important; }
  .page { display: block !important; }
}
