/* ========== NURSING STUDY VAULT - CLASSIC ACADEMIC THEME ========== */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700;900&family=Open+Sans:wght@300;400;600;700&display=swap');

/* CSS Variables */
:root {
  --bg: #fef9e8;
  --surface: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #5a5a5a;
  --text-muted: #8a8a8a;
  --accent: #1a4d8c;
  --accent-light: #2a6cb8;
  --border: #e0d8c8;
  --shadow: rgba(0,0,0,0.05);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Open Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
}

.logo p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-light);
  text-decoration: none;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px var(--shadow);
}

/* Stats */
.stat-grid {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Merriweather', serif;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  .header-inner { flex-direction: column; text-align: center; }
  .stat-grid { gap: 1rem; }
}

/* ========== COMPLETE RESPONSIVE DESIGN ========== */

/* Base styles (Mobile First Approach) */
/* Default styles are for mobile screens (< 640px) */

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  .container {
    padding: 0 15px;
  }
  
  .card {
    padding: 1rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  
  .categories-grid {
    grid-template-columns: 1fr !important;
    gap: 15px;
  }
}

/* Mobile (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px;
  }
  
  .header-inner {
    flex-direction: column;
    text-align: center;
  }
  
  .stat-grid {
    gap: 1.5rem;
  }
}

/* Tablet (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  body {
    font-size: 16px;
  }
  
  h1 {
    font-size: 2.2rem;
  }
  
  .container {
    max-width: 960px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 25px;
  }
  
  .stat-grid {
    gap: 2rem;
  }
}

/* Small Desktop (1025px to 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
  .container {
    max-width: 1100px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 25px;
  }
}

/* Large Desktop (1201px and above) */
@media (min-width: 1201px) {
  .container {
    max-width: 1400px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 30px;
  }
  
  body {
    font-size: 17px;
  }
  
  h1 {
    font-size: 3rem;
  }
  
  h2 {
    font-size: 2.2rem;
  }
}

/* iPad Pro specific (1024px) */
@media (min-width: 1024px) and (max-width: 1024px) and (min-height: 1366px) {
  .container {
    max-width: 900px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* iPad Mini / iPad Air (768px to 820px) */
@media (min-width: 768px) and (max-width: 820px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .stat-grid {
    gap: 1.2rem;
  }
}

/* Android Tablet (600px to 800px) */
@media (min-width: 600px) and (max-width: 800px) and (orientation: portrait) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Landscape mode for mobile */
@media (max-width: 900px) and (orientation: landscape) {
  .header-inner {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .categories-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* Foldable devices (Galaxy Fold, etc.) */
@media (max-width: 280px) {
  body {
    font-size: 12px;
  }
  
  h1 {
    font-size: 1.2rem;
  }
  
  .btn {
    padding: 0.4rem 0.8rem;
  }
}

/* High resolution screens (Retina, 4K) */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(5, 1fr) !important;
  }
  
  body {
    font-size: 18px;
  }
}

/* Print styles (for taking printouts of practical files) */
@media print {
  .site-header,
  .site-footer,
  .btn,
  .hamburger {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* Sidebar hidden by default */
.sidebar {
    right: -300px !important;
}

.sidebar.active {
    right: 0 !important;
}

/* Hamburger Button */
.hamburger {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    display: none;
    color: var(--text-primary);
}

/* Desktop navigation */
.desktop-nav {
    display: flex;
    gap: 15px;
}

/* Mobile view */
@media (max-width: 768px) {
    .hamburger {
        display: block !important;
    }
    .desktop-nav {
        display: none !important;
    }
}

/* Sidebar styles */
.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--surface);
    z-index: 1001;
    padding: 60px 20px;
    transition: right 0.3s ease;
    box-shadow: -2px 0 8px var(--shadow);
    overflow-y: auto;
}

.sidebar.active {
    right: 0;
}

.sidebar a {
    display: block;
    padding: 10px 0;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar a:hover {
    color: var(--accent);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}

.overlay.active {
    display: block;
}


.site-header .logo h1, 
.site-header .logo p,
.site-footer h4,
.site-footer p,
.site-footer a,
.credit p {
    color: white !important;
}

.site-footer a:hover {
    color: #fbbf24 !important;
}

.credit {
    border-top-color: #334155 !important;
}

/* White Header and Footer */
.site-header, .site-footer {
    background: #ffffff !important;
    color: #1a1a1a !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.site-header .logo h1, 
.site-header .logo p,
.site-footer h4,
.site-footer p,
.site-footer a,
.credit p {
    color: #1a1a1a !important;
}

.site-footer {
    border-top: 1px solid #e2e8f0 !important;
}

.site-footer a:hover {
    color: var(--accent) !important;
}

.credit {
    border-top-color: #e2e8f0 !important;
    color: #64748b !important;
}

.hamburger {
    color: #1a1a1a !important;
}

.desktop-nav .btn-outline {
    border-color: #cbd5e1 !important;
    color: #1a1a1a !important;
}

.desktop-nav .btn-primary {
    background: var(--accent) !important;
    color: white !important;
}

/* ===== GLOBAL ARTICLE RESPONSIVE FIX ===== */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

main, .container, article {
  box-sizing: border-box;
}

article {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  overflow-wrap: break-word;
}

article img,
article video,
article iframe {
  max-width: 100%;
  height: auto;
}

article table {
  width: 100%;
  border-collapse: collapse;
}

article div[style*="overflow-x:auto"] {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

article td,
article th,
article p,
article li {
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 600px) {
  article {
    padding: 12px !important;
    font-size: 15px;
    line-height: 1.7;
  }

  article h1 {
    font-size: 1.45rem !important;
  }

  article h2 {
    font-size: 1.2rem !important;
  }

  article h3 {
    font-size: 1.05rem !important;
  }

  article table {
    font-size: 13px !important;
  }

  article td,
  article th {
    padding: 8px !important;
  }
}

@media (min-width: 601px) and (max-width: 1024px) {
  article {
    max-width: 94%;
    padding: 20px !important;
  }
}

@media (min-width: 1025px) {
  article {
    max-width: 900px;
  }
}

/* ===== ARTICLE DOWNLOAD BUTTON ===== */
.download-box{
  max-width:900px;
  margin:25px auto 40px;
  text-align:center;
  padding:0 12px;
}
.download-btn{
  background:#1a73e8;
  color:#fff;
  border:none;
  padding:12px 22px;
  border-radius:999px;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(26,115,232,.25);
}
.download-btn:hover{
  background:#1557b0;
}
@media print{
  header, footer, .site-header, .site-footer, .sidebar, .overlay, .download-box{
    display:none!important;
  }
  body{
    background:#fff!important;
  }
}

/* ===== PDF PRINT FULL CONTENT FIX ===== */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  html, body {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .site-header,
  .site-footer,
  .sidebar,
  .overlay,
  .desktop-nav,
  .hamburger,
  .download-btn,
  .pdf-download-btn,
  .print-btn,
  button,
  nav {
    display: none !important;
  }

  main,
  .container,
  .main-content,
  article {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  article * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  article div,
  article section {
    overflow: visible !important;
    max-width: 100% !important;
  }

  article div[style*="overflow-x:auto"],
  article div[style*="overflow-x: auto"],
  article div[style*="-webkit-overflow-scrolling"] {
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
  }

  article table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    page-break-inside: auto !important;
    font-size: 10px !important;
  }

  article thead {
    display: table-header-group !important;
  }

  article tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  article th,
  article td {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    padding: 5px !important;
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  article h1 {
    font-size: 22px !important;
  }

  article h2 {
    font-size: 18px !important;
  }

  article h3 {
    font-size: 15px !important;
  }

  article p,
  article li {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  article img {
    max-width: 100% !important;
    height: auto !important;
  }
}
