/* ===== CRITICAL CSS - INLINE THIS IN <head> ===== */
/* This should be placed in <style> tags in your HTML head */
:root {
  --primary: #8E1616;
  --secondary: #B54040;
  --accent: #D4AF37;
  --neutral-bg: #F8F9FA;
  --text-primary: #2C2C2C;
  --text-secondary: #5F6368;
  --link-hover: #C62828;
  --footer-bg: #5A0F0F;
  --sidebar-bg: #FFFFFF;
  --doi-color: #E74C3C;
  --din-color: #1ABC9C;
  --primary-dark: #6A1111;
  --focus-outline: #FFC107;
  --header-gradient: linear-gradient(135deg, #8E1616 0%, #6A1B3B 100%);
  --footer-gradient: linear-gradient(135deg, #5A0F0F 0%, #34495E 100%);
}

/* Base mobile styles */
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--neutral-bg);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  overflow-x: hidden;
}

.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  text-decoration: none;
  z-index: 9999;
  border-radius: 0 0 4px 0;
  font-weight: 600;
  font-size: 1rem;
}

.skip-to-main:focus {
  top: 0;
  outline: 3px solid var(--focus-outline);
  outline-offset: 2px;
}

/* ===== MAIN CSS FILE ===== */
/* Load this file asynchronously */

/* Accessibility & Base */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
.nav-link:focus,
.btn:focus {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5);
}

/* Typography - Fluid */
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 700; color: var(--primary-dark); margin-bottom: 1.5rem; line-height: 1.2; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; color: var(--primary-dark); margin-bottom: 1.25rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--accent); }
h3 { font-size: clamp(1.5rem, 3.5vw, 1.75rem); font-weight: 600; color: var(--text-primary); margin-bottom: 1rem; }
h4 { font-size: clamp(1.25rem, 3vw, 1.5rem); font-weight: 500; color: var(--text-primary); margin-bottom: 0.75rem; }
h5 { font-size: clamp(1.1rem, 2.5vw, 1.25rem); font-weight: 500; color: #fff; margin-bottom: 0.5rem; }
h6 { font-size: clamp(1rem, 2vw, 1.1rem); font-weight: 500; color: var(--text); margin-bottom: 0.5rem; }

/* Links */
a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Header & Navigation */
header, .bg-theme-color {
  background: var(--header-gradient);
}

.navbar-light .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  border-radius: 4px;
  margin: 0 2px;
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link:focus {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

.navbar-light .navbar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.25);
  font-weight: 600;
}

/* Header Layout */
.header-container {
  min-height: 80px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.logo-section {
  flex: 0 0 auto;
  min-width: 70px;
  max-width: 90px;
}

.logo-section img {
  width: 100%;
  height: auto;
  max-width: 80px;
}

.title-section {
  flex: 1 1 auto;
  min-width: 200px;
  padding-right: 15px;
}

.journal-title {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  font-weight: 500;
}

.info-section {
  flex: 0 0 auto;
  min-width: 200px;
  text-align: right;
}

.issn-info {
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  white-space: nowrap;
  font-weight: 400;
}

.social-links {
  margin-top: 8px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  min-height: 44px;
  min-width: 44px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--link-hover) 0%, var(--secondary) 100%);
  color: #fff;
  transform: translateY(-2px);
}

.btn-outline-theme {
  color: var(--secondary);
  border: 2px solid var(--secondary);
  background: transparent;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  min-height: 44px;
  min-width: 44px;
}

.btn-outline-theme:hover {
  color: #fff;
  background-color: var(--secondary);
  border-color: var(--secondary);
}

/* Cards */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-body {
  padding: 1.25rem;
}

/* Web Title */
.webtitle {
  color: var(--primary-dark);
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  padding: 8px 0;
  font-family: 'Poppins', sans-serif;
}

/* Social Icons */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 16px;
  font-weight: normal;
  min-width: 44px;
  min-height: 44px;
}

.social-icon.facebook { background-color: #1877F2; }
.social-icon.twitter { background-color: #000000; }
.social-icon.linkedin { background-color: #0077B5; }
.social-icon.instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }

.social-icon:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* DOI/DIN Styles */
.bg-gradient-doi {
  background: linear-gradient(135deg, var(--doi-color), #ee5a52);
  color: white;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  display: inline-block;
}

.bg-gradient-din {
  background: linear-gradient(135deg, var(--din-color), #44a08d);
  color: white;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  display: inline-block;
}

/* Keywords & Meta Boxes */
.keywords-box {
  background: #f0f8ff;
  border: 1px solid #cce5ff;
  border-radius: 0.4rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.keywords-content {
  padding: 6px 10px;
  display: inline-block;
  background: white;
  border-radius: 4px;
  border-left: 3px solid var(--secondary);
  font-weight: 500;
}

.page-number-box {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 0.5rem;
  display: inline-block;
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  font-weight: 600;
  color: #856404;
  border-left: 4px solid var(--accent);
}

/* Sidebar */
.sidebar-widget {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--sidebar-bg);
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  border-left: 4px solid var(--secondary);
  transition: transform 0.3s ease;
}

.sidebar-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.sidebar-widget h4 {
  color: var(--primary-dark);
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #EAECEE;
  transition: all 0.3s ease;
}

.sidebar-list li:last-child {
  border-bottom: none;
}

.sidebar-list li:hover {
  background-color: #F8F9FA;
  padding-left: 10px;
}

/* Footer */
.footer {
  background: var(--footer-gradient);
  color: rgba(255, 255, 255, 0.95);
  margin-top: 3rem;
  border-top: 4px solid var(--accent);
}

.footer a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
  display: block;
  margin-bottom: 0.5rem;
}

.footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  padding-left: 8px;
}

.footer h4 {
  color: white;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  display: inline-block;
}

/* Article Buttons */
.article-buttons-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 1rem 0;
}

/* Copy Buttons */
.copy-btn {
  min-width: 70px;
  transition: all 0.2s ease;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.copy-btn:hover {
  transform: translateY(-2px);
}

.copy-btn.copied {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

/* FAQ */
.faq-question {
  background-color: #f8f9fa;
  color: #333;
  border: 1px solid #dee2e6;
  padding: 1rem;
  width: 100%;
  text-align: left;
  border-radius: 0.375rem;
}

.faq-question:not(.collapsed) {
  background-color: #f5e1da;
  color: var(--primary);
}

.faq-answer {
  background-color: #fff;
  border-top: 1px solid #dee2e6;
  color: #555;
  padding: 1rem;
}

/* Toast Notifications */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

.custom-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
}

.custom-toast.removing {
  animation: slideOut 0.3s ease;
}

/* Utility Classes */
.text-theme-color { color: var(--primary-dark); }
.bg-theme-color { background: var(--header-gradient); }
.text-accent { color: var(--accent); }

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet (≥ 768px) */
@media (min-width: 768px) {
  .header-container {
    flex-wrap: nowrap;
    min-height: 100px;
  }
  
  .logo-section {
    min-width: 85px;
    max-width: 100px;
  }
  
  .logo-section img {
    max-width: 90px;
  }
  
  .title-section {
    padding-right: 20px;
  }
  
  .journal-title {
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    text-align: left;
  }
  
  .issn-info {
    font-size: clamp(0.85rem, 1.3vw, 1rem);
  }
  
  .webtitle {
    font-size: 1.3rem;
    text-align: left;
  }
  
  .social-icon {
    width: 40px;
    height: 40px;
  }
  
  .article-buttons-container {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .doi-din-section .row {
    display: flex;
    flex-wrap: nowrap;
  }
}

/* Desktop (≥ 992px) */
@media (min-width: 992px) {
  .header-container {
    min-height: 120px;
  }
  
  .journal-title {
    font-size: 1.2rem;
  }
  
  .issn-info {
    font-size: 1rem;
  }
  
  .main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
  }
  
  .article-buttons-container {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  .article-buttons-container .btn {
    flex: 1;
    min-width: 140px;
  }
}

/* Large Desktop (≥ 1200px) */
@media (min-width: 1200px) {
  .journal-title {
    font-size: 1.3rem;
  }
  
  .logo-section {
    min-width: 100px;
  }
  
  .logo-section img {
    max-width: 100px;
  }
}

/* Mobile (< 768px) */
@media (max-width: 767.98px) {
  .header-container {
    justify-content: center;
    text-align: center;
    min-height: 140px;
    padding: 15px 0;
  }
  
  .logo-section {
    flex: 0 0 100%;
    margin-bottom: 15px;
    max-width: 110px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .title-section {
    flex: 0 0 100%;
    padding: 0;
    margin-bottom: 15px;
  }
  
  .info-section {
    flex: 0 0 100%;
    text-align: center;
    margin-top: 15px;
  }
  
  .issn-info {
    white-space: normal;
    line-height: 1.6;
    font-size: 0.95rem;
  }
  
  .social-links {
    margin-top: 12px;
  }
  
  .social-icon {
    width: 40px;
    height: 40px;
    margin: 0 8px;
  }
  
  .article-buttons-container {
    grid-template-columns: 1fr;
  }
  
  .doi-din-section .d-flex {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .doi-din-section .btn {
    align-self: flex-start;
  }
  
  .keywords-box {
    padding: 0.5rem 0.75rem;
  }
  
  .keywords-content {
    padding: 4px 8px;
    font-size: 0.9rem;
  }
  
  .page-number-box {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .sidebar-widget {
    padding: 1rem;
  }
  
  .footer .col-md-4 {
    margin-bottom: 2rem;
  }
}

/* Small Mobile (< 576px) */
@media (max-width: 575.98px) {
  .journal-title {
    font-size: 1rem;
    line-height: 1.5;
    padding: 0 10px;
  }
  
  .issn-info {
    font-size: 0.9rem;
    padding: 0 10px;
  }
  
  .webtitle {
    font-size: 1.1rem;
    text-align: center;
  }
  
  .social-icon {
    width: 36px;
    height: 36px;
    margin: 0 6px;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .btn-primary,
  .btn-outline-theme {
    padding: 0.6rem 1rem;
  }
}

/* ===== ACCESSIBILITY & PERFORMANCE ===== */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
  
  .card:hover,
  .sidebar-widget:hover,
  .social-icon:hover,
  .btn:hover {
    transform: none;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .bg-light {
    background-color: #343a40;
    color: #f8f9fa;
  }
  
  .card {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #495057;
  }
  
  .keywords-box {
    background-color: #2c3e50;
    border-color: #34495e;
  }
  
  .keywords-content {
    background-color: #34495e;
    color: #ecf0f1;
  }
}

/* High contrast */
@media (prefers-contrast: high) {
  :root {
    --primary: #4a1429;
    --secondary: #7a2344;
    --accent: #d4a506;
    --text-primary: #000000;
  }
  
  body {
    background-color: white;
    color: black;
  }
}

/* Print styles */
@media print {
  .social-links,
  .navbar,
  .btn,
  .sidebar-widget,
  .footer {
    display: none;
  }
  
  body {
    background-color: white;
    color: black;
    font-size: 12pt;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
  }
}

/* Lazy loading images */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Content visibility for performance */
.content-below-fold {
  content-visibility: auto;
  contain-intrinsic-size: 500px;
}

/* Ensure minimum tap target size */
@media (max-width: 768px) {
  .nav-link {
    padding: 1rem;
    min-height: 44px;
    min-width: 44px;
  }
  
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
}