/* Import Professional Medical Fonts */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,600;1,8..60,700&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Professional Medical Color Palette */
  --primary-color: #00416A;
  --primary-hover: #003153;
  --primary-light: #005A92;
  --secondary-color: #4682B4;
  --secondary-light: #6397C2;
  --accent-color: #AFDBF5;
  --accent-dark: #82ACCE;
  
  /* Neutral Palette */
  --text-color: #1a1a1a;
  --text-secondary: #4a5568;
  --text-muted: #708090;
  --text-light: #94a3b8;
  
  /* Backgrounds */
  --bg-color: #F8FAFB;
  --bg-secondary: #EEF2F6;
  --card-bg: #ffffff;
  --card-hover-bg: #F9FBFC;
  
  /* Borders & Dividers */
  --border-color: #E1E8ED;
  --border-light: #EDF1F5;
  --border-dark: #CBD5E0;
  
  /* Typography */
  --font-heading: 'Source Serif 4', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Type Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  
  /* Layout */
  --container-width: 1120px;
  --content-max-width: 720px;
  --border-radius-sm: 6px;
  --border-radius: 10px;
  --border-radius-lg: 14px;
  --border-radius-xl: 20px;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(0, 65, 106, 0.06), 0 1px 2px -1px rgba(0, 65, 106, 0.04);
  --shadow: 0 4px 6px -1px rgba(0, 65, 106, 0.08), 0 2px 4px -2px rgba(0, 65, 106, 0.05);
  --shadow-md: 0 8px 12px -2px rgba(0, 65, 106, 0.10), 0 4px 6px -3px rgba(0, 65, 106, 0.08);
  --shadow-lg: 0 16px 24px -4px rgba(0, 65, 106, 0.12), 0 8px 12px -6px rgba(0, 65, 106, 0.08);
  --shadow-xl: 0 24px 40px -8px rgba(0, 65, 106, 0.15), 0 12px 16px -8px rgba(0, 65, 106, 0.10);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index layers */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-modal: 1050;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  overflow-x: hidden;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-color);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-5xl); font-weight: 700; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p {
  margin-bottom: var(--space-5);
  line-height: 1.75;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* Container */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Enhanced Navbar with Glassmorphism */
.navbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  height: 72px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.navbar.scrolled {
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Logo Enhancement */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.logo:hover {
  transform: translateY(-1px);
}

.logo-icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 65, 106, 0.1));
}

.logo-text {
  font-size: var(--text-xl);
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--primary-color);
  letter-spacing: -0.02em;
}

/* Navigation Links */
.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-8);
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  transition: all var(--transition-fast);
  position: relative;
  padding: var(--space-2) 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-base);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-color);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Button System */
.auth-buttons {
  display: flex;
  gap: var(--space-3);
}

.btn {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-color);
}

.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--border-dark);
  transform: translateY(-1px);
}

/* Hero Section Enhancement */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  text-align: center;
  /* Combined background with image overlay */
  background: 
    /* Background image with overlay */
    linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.3)),
    /* Replace with your image URL */
    url('img/header.jpg'),
    /* Fallback gradient */
    linear-gradient(135deg, rgba(175, 219, 245, 0.12) 0%, rgba(70, 130, 180, 0.08) 100%);
  
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border-light);
  position: relative;
  min-height: 200px; /* Added minimum height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Optional: Add overlay with reduced opacity */
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(0, 65, 106, 0.15) 0%, rgba(0, 0, 0, 0.2) 70%);
  pointer-events: none;
}

/* Content wrapper for better positioning */
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: var(--space-8);
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  color: var(--text-light); /* Changed to light color for better contrast */
  margin-bottom: var(--space-5);
  letter-spacing: -0.03em;
  font-weight: 700;
  line-height: 1.15;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); /* Added shadow for better readability */
}

.hero p {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.9); /* Lighter color for better contrast */
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); /* Added shadow for better readability */
}

/* Blog Grid with Modern Layout */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-8);
  margin: var(--space-16) 0 var(--space-20);
}

/* Enhanced Blog Cards */
.blog-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: relative;
}

.blog-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-dark);
}

.blog-card:hover::before {
  opacity: 1;
}

.blog-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform var(--transition-slow);
  background: var(--bg-secondary);
}

.blog-card:hover .blog-image {
  transform: scale(1.05);
}

.blog-card-content {
  padding: var(--space-6);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Tag System */
.blog-tag {
  background: linear-gradient(135deg, rgba(0, 65, 106, 0.08), rgba(70, 130, 180, 0.1));
  color: var(--primary-color);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--border-radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: var(--space-4);
  border: 1px solid rgba(0, 65, 106, 0.15);
}

.blog-card h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
  color: var(--text-color);
  line-height: 1.35;
  font-weight: 600;
  flex-shrink: 0;
}

.blog-card p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.65;
  margin-bottom: var(--space-5);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.blog-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

/* Post Detail View */
.blog-post-view {
  max-width: var(--content-max-width);
  padding-top: var(--space-12);
  padding-bottom: var(--space-20);
}

.post-header {
  margin-bottom: var(--space-10);
}

.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-left: 3px solid var(--primary-color);
}

.post-title {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
  line-height: 1.2;
  margin-bottom: var(--space-5);
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.025em;
}

.post-hero-image {
  width: 100%;
  border-radius: var(--border-radius-lg);
  margin-bottom: var(--space-10);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

/* Enhanced Post Content */
.post-body {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--text-color);
}

.post-body p {
  margin-bottom: var(--space-6);
  max-width: 65ch;
}

.post-body img {
  max-width: 100%;
  height: auto;
  margin: var(--space-8) 0;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.post-body .video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--border-radius-lg);
  margin: var(--space-10) 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.post-body .video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--border-radius-lg);
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--border-radius-lg);
  margin: var(--space-10) 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Comments Section Enhancement */
.comments-section {
  margin-top: var(--space-16);
  padding-top: var(--space-12);
  border-top: 2px solid var(--border-light);
}

.comments-section h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-8);
  color: var(--text-color);
}

.comment {
  background: var(--card-bg);
  padding: var(--space-6);
  border-radius: var(--border-radius-lg);
  margin-bottom: var(--space-5);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-base);
}

.comment:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-dark);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
  gap: var(--space-2);
}

.comment-author {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.comment-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 400;
}

.comment p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: var(--text-sm);
  margin-bottom: 0;
}

.comment-reply {
  margin-top: var(--space-5);
  margin-left: var(--space-8);
  border-left: 3px solid var(--accent-color);
  background: linear-gradient(90deg, rgba(175, 219, 245, 0.05), transparent);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.admin-badge {
  background: var(--primary-color);
  color: white;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Comment Form */
.comment-form-container {
  background: linear-gradient(135deg, rgba(175, 219, 245, 0.08), rgba(70, 130, 180, 0.05));
  padding: var(--space-8);
  border-radius: var(--border-radius-lg);
  margin-top: var(--space-10);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.comment-form-container h4 {
  margin-bottom: var(--space-6);
  font-size: var(--text-xl);
  color: var(--text-color);
}

#commentForm input,
#commentForm textarea {
  width: 100%;
  padding: var(--space-4);
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-color);
  background: white;
  transition: all var(--transition-fast);
}

#commentForm input:focus,
#commentForm textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 65, 106, 0.1);
}

#commentForm textarea {
  height: 140px;
  resize: vertical;
  line-height: 1.6;
}

/* Footer Enhancement */
.footer {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: var(--space-16) 0 var(--space-6);
  margin-top: var(--space-20);
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-10);
  gap: var(--space-12);
}

.footer-info h3 {
  margin-bottom: var(--space-3);
  font-size: var(--text-xl);
  color: white;
}

.footer-info p {
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 0;
}

.footer-links h4 {
  margin-bottom: var(--space-4);
  font-size: var(--text-base);
  color: white;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-3);
}

.footer-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-6);
  text-align: center;
  color: #94a3b8;
  font-size: var(--text-sm);
}

/* Utility Classes */
.loader {
  text-align: center;
  padding: var(--space-16);
  color: var(--text-muted);
  font-size: var(--text-lg);
}

.no-posts,
.no-comments {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--text-muted);
}

.no-posts h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

/* Flash Messages */
.flash-message {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-6);
  text-align: center;
  font-weight: 500;
  font-size: var(--text-sm);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.flash-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.flash-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2.25rem;
    --text-4xl: 2rem;
    --text-3xl: 1.5rem;
    --space-16: 3rem;
    --space-20: 4rem;
  }
  
  .navbar {
    height: 64px;
  }
  
  .nav-links {
    display: none;
  }
  
  .hero {
    padding: var(--space-12) 0 var(--space-10);
  }
  
  .hero h1 {
    font-size: var(--text-3xl);
  }
  
  .hero p {
    font-size: var(--text-base);
  }
  
  .blog-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin: var(--space-10) 0 var(--space-12);
  }
  
  .footer-content {
    flex-direction: column;
    gap: var(--space-8);
  }
  
  .post-meta {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }
  
  .comment-reply {
    margin-left: var(--space-4);
    padding-left: var(--space-4);
  }
  
  .auth-buttons {
    gap: var(--space-2);
  }
  
  .btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .blog-card-content {
    padding: var(--space-5);
  }
  
  .comment-form-container {
    padding: var(--space-6);
  }
}

/* Visitor Statistics Styles */
.footer-stats {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 2rem;
}

.footer-stats h4 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

/* Responsive adjustments for visitor stats */
@media (max-width: 768px) {
    .footer-stats {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 2rem;
        margin-top: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
}