/* ===================================
   Medical Certificate Generator
   Global Design System
=================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Lora:wght@400;600;700&family=Kalam:wght@300;400;700&family=Caveat:wght@400;500;600;700&family=Dancing+Script:wght@400;500;600;700&family=Satisfy&family=Mr+Dafoe&family=Pinyon+Script&display=swap');

/* ===================================
   RX PAD (INDIAN PRESCRIPTION) STYLES
=================================== */

/* Override for Rx pad */
#certificate-preview.rx-pad-mode {
  background: #fffef9;
  background-image:
    linear-gradient(rgba(16,181,203,0.04) 1px, transparent 1px);
  background-size: 100% 1.85rem;
  border: none;
  border-radius: 0;
  padding: 0;
  font-family: 'Kalam', cursive;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.06);
  position: relative;
  overflow: visible;
}
#certificate-preview.rx-pad-mode::before {
  display: none;
}

/* Rx Pad layout */
.rx-pad {
  font-family: 'Kalam', cursive;
  color: #1a237e;
  position: relative;
  min-height: 580px;
}

/* Left red margin line (classic Indian pad style) */
.rx-pad::before {
  content: '';
  position: absolute;
  left: 52px;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(220, 38, 38, 0.35);
  pointer-events: none;
}

/* Watermark */
.rx-pad-watermark {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Kalam', cursive;
  font-size: 5rem; font-weight: 700;
  color: rgba(16,181,203,0.06);
  pointer-events: none; z-index: 0;
  transform: rotate(-20deg);
  letter-spacing: 0.1em;
  user-select: none;
}

.rx-pad > *:not(.rx-pad-watermark) { position: relative; z-index: 1; }

/* Letterhead top */
.rx-letterhead {
  padding: 1rem 1.25rem 0.75rem 1.4rem;
  border-bottom: 3px double #1a237e;
  margin-bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: linear-gradient(135deg, #f0f4ff 0%, #fffef9 100%);
}
.rx-letterhead-left { flex: 1; }
.rx-doc-name {
  font-size: 1.25rem; font-weight: 700; color: #1a237e;
  font-family: 'Kalam', cursive; line-height: 1.1;
}
.rx-doc-quals {
  font-size: 0.78rem; color: #3949ab; font-family: 'Inter', sans-serif;
  font-weight: 500; letter-spacing: 0.02em; margin-top: 0.15rem;
}
.rx-doc-reg {
  font-size: 0.72rem; color: #5c6bc0; font-family: 'Inter', sans-serif;
  margin-top: 0.3rem;
}
.rx-letterhead-right {
  text-align: right; flex-shrink: 0;
}
.rx-clinic-name {
  font-size: 1rem; font-weight: 700; color: var(--primary);
  font-family: 'Kalam', cursive;
}
.rx-clinic-address {
  font-size: 0.72rem; color: #64748b; font-family: 'Inter', sans-serif;
  line-height: 1.5; margin-top: 0.2rem;
}
.rx-clinic-phone {
  font-size: 0.72rem; color: var(--primary); font-family: 'Inter', sans-serif;
  margin-top: 0.15rem; font-weight: 600;
}

/* Patient details strip */
.rx-patient-strip {
  display: flex; gap: 0; flex-wrap: wrap;
  padding: 0.55rem 1.25rem 0.45rem 1.5rem;
  border-bottom: 1.5px solid #c5cae9;
  background: rgba(240,244,255,0.4);
  font-size: 0.82rem; font-family: 'Inter', sans-serif;
  align-items: center; gap: 0.5rem 2rem;
}
.rx-field-group {
  display: flex; align-items: baseline; gap: 0.35rem;
}
.rx-field-label {
  font-size: 0.72rem; font-weight: 600; color: #5c6bc0;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.rx-field-value {
  font-family: 'Kalam', cursive; font-size: 0.92rem;
  color: #1a237e; font-weight: 400;
  border-bottom: 1.5px solid #9fa8da;
  min-width: 80px; padding: 0 0.15rem;
}
.rx-field-value.wide { min-width: 160px; }
.rx-date-right { margin-left: auto; }

/* Rx body area */
.rx-body {
  display: grid;
  grid-template-columns: 52px 1fr;
  min-height: 260px;
}

/* Rx symbol column */
.rx-symbol-col {
  display: flex;
  padding-top: 1.25rem;
  justify-content: center;
  border-right: 2px solid rgba(220,38,38,0.3);
}
.rx-symbol {
  font-size: 2.6rem; font-weight: 700; color: #1a237e;
  font-family: 'Times New Roman', serif;
  line-height: 1; opacity: 0.85;
}

/* Prescription content */
.rx-content {
  padding: 1rem 1.25rem 1rem 1rem;
}
.rx-section-label {
  font-size: 0.65rem; font-weight: 700; color: #9fa8da;
  text-transform: uppercase; letter-spacing: 0.08em;
  font-family: 'Inter', sans-serif; margin-bottom: 0.35rem;
}
.rx-diagnosis-line {
  font-family: 'Kalam', cursive;
  font-size: 1.05rem; color: #1a237e;
  border-bottom: 1.5px solid rgba(159,168,218,0.5);
  padding: 0.2rem 0;
  margin-bottom: 0.75rem;
  min-height: 1.8rem;
}
.rx-meds-area {
  margin-bottom: 0.75rem;
}
.rx-med-line {
  font-family: 'Kalam', cursive;
  font-size: 0.95rem; color: #1a237e;
  padding: 0.2rem 0;
  border-bottom: 1px dashed rgba(159,168,218,0.35);
  min-height: 1.7rem;
  display: flex; align-items: baseline; gap: 0.4rem;
}
.rx-med-num {
  font-size: 0.78rem; color: #9fa8da;
  font-family: 'Inter', sans-serif; font-weight: 600;
  min-width: 18px;
}
.rx-advice-area {
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(240,244,255,0.6);
  border-left: 3px solid #3949ab;
  border-radius: 0 4px 4px 0;
}
.rx-advice-label {
  font-size: 0.65rem; color: #5c6bc0; font-family: 'Inter', sans-serif;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.rx-advice-text {
  font-family: 'Kalam', cursive; font-size: 0.88rem; color: #1a237e;
  line-height: 1.6;
}
.rx-followup-line {
  font-family: 'Kalam', cursive; font-size: 0.85rem; color: #3949ab;
  margin-top: 0.5rem; font-style: italic;
}

/* Rx footer */
.rx-footer {
  padding: 0.75rem 1.25rem 0.85rem 1.4rem;
  border-top: 1.5px solid #c5cae9;
  display: flex; justify-content: space-between; align-items: flex-end;
  background: rgba(240,244,255,0.3);
}
.rx-stamp-area {
  width: 68px; height: 68px; border: 2px dashed rgba(16,181,203,0.4);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: rgba(16,181,203,0.4); font-size: 0.55rem; font-weight: 700;
  text-align: center; line-height: 1.3; padding: 0.35rem;
  font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.04em;
}
.rx-sign-block { text-align: right; }
.rx-sign-line-area {
  width: 130px; border-bottom: 1.5px solid #3949ab;
  margin-bottom: 0.3rem; margin-left: auto;
  min-height: 28px;
}
.rx-sign-doc-name {
  font-size: 0.8rem; color: #1a237e; font-family: 'Kalam', cursive; font-weight: 700;
}
.rx-sign-reg {
  font-size: 0.68rem; color: #5c6bc0; font-family: 'Inter', sans-serif; margin-top: 0.1rem;
}
.rx-disclaimer-strip {
  text-align: center; font-size: 0.65rem;
  color: #ef4444; font-family: 'Inter', sans-serif; font-weight: 600;
  padding: 0.45rem 1rem; background: #fef2f2;
  border-top: 1px solid #fecaca; letter-spacing: 0.02em;
}

/* Print override for Rx pad */
@media print {
  #certificate-preview.rx-pad-mode {
    box-shadow: none !important;
  }
  .rx-pad-watermark { display: none !important; }
}

/* === CSS Variables === */
:root {
  --primary: #10b5cb;
  --primary-dark: #0d96a8;
  --primary-light: #e0f6f9;
  --primary-xlight: #f0fbfc;
  --bg: #e6f1f2;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --border: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(16,181,203,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(16,181,203,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(16,181,203,0.16), 0 4px 12px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Lora', Georgia, serif;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; overflow-x: hidden; width: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-dark);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
ul { list-style: none; }

/* === Typography === */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.2; color: var(--text-dark); }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.5rem); }
h4 { font-size: 1.1rem; }
p { color: var(--text-mid); margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* === Container === */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.6rem; border-radius: 50px;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none; white-space: nowrap; letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 14px rgba(16,181,203,0.35);
}
.btn-primary:hover {
  background: var(--primary-dark); transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,181,203,0.45); color: #fff;
}
.btn-secondary {
  background: #fff; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-secondary:hover {
  background: var(--primary); color: #fff; transform: translateY(-2px);
}
.btn-outline {
  background: transparent; color: var(--text-dark);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 0.95rem 2rem; font-size: 1.05rem; }
.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }

/* === Cards === */
.card {
  background: #fff; border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 1.75rem;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-flat { background: #fff; border-radius: var(--radius-md); padding: 1.5rem; border: 1px solid var(--border); }

/* === Form Elements === */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-dark); margin-bottom: 0.45rem; letter-spacing: 0.01em;
}
.form-group label span.required { color: var(--primary); margin-left: 2px; }
.form-control {
  width: 100%; padding: 0.75rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 0.92rem; color: var(--text-dark);
  background: #fff; transition: var(--transition); outline: none;
  appearance: none; -webkit-appearance: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,181,203,0.15); }
.form-control::placeholder { color: var(--text-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.5rem;
}
textarea.form-control { resize: vertical; min-height: 80px; }

/* === Badges === */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.85rem; border-radius: 50px; font-size: 0.78rem; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #d1fae5; color: #059669; }
.badge-warning { background: #fef3c7; color: #d97706; }

/* ===================================
   NAVBAR
=================================== */
#navbar {
  position: sticky; top: 0; z-index: 1000;
  background: #fff; border-bottom: 1px solid rgba(16,181,203,0.12);
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
#navbar.scrolled { box-shadow: var(--shadow-md); }
.nav-wrapper {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px; padding: 0 1.25rem; max-width: 1180px; margin: 0 auto;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.75rem; text-decoration: none;
}
.nav-brand img {
  height: 52px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}
.nav-brand-text { font-size: 1.05rem; font-weight: 700; color: var(--text-dark); }
.nav-brand-text span { color: var(--primary); }
.nav-links {
  display: flex; align-items: center; gap: 0.25rem;
}
.nav-links a {
  padding: 0.5rem 0.9rem; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; color: var(--text-mid);
  transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--primary); background: var(--primary-xlight);
}
.nav-cta { margin-left: 0.75rem; }
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 0.5rem; border: none; background: none;
}
.hamburger span {
  display: block; width: 24px; height: 2.5px;
  background: var(--text-dark); border-radius: 2px; transition: var(--transition);
}
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
.mobile-menu {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md); padding: 1rem; z-index: 999;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block; padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  font-weight: 500; color: var(--text-mid); transition: var(--transition);
}
.mobile-menu a:hover { color: var(--primary); background: var(--primary-xlight); }
.mobile-menu .btn { margin-top: 0.75rem; width: 100%; justify-content: center; }

/* ===================================
   HERO SECTION
=================================== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0d96a8 60%, #0a7a8a 100%);
  padding: 5rem 0 4rem; position: relative; overflow: hidden; color: #fff;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; z-index: 2; text-align: center; max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(255,255,255,0.18); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 50px;
  padding: 0.4rem 1.1rem; font-size: 0.82rem; font-weight: 600;
  color: #fff; margin-bottom: 1.5rem; letter-spacing: 0.03em; text-transform: uppercase;
}
.hero h1 { color: #fff; margin-bottom: 1.1rem; font-size: clamp(2rem, 5vw, 3.2rem); }
.hero p { color: rgba(255,255,255,0.88); font-size: 1.1rem; margin-bottom: 2rem; max-width: 580px; margin-left: auto; margin-right: auto; }
.hero-ctas { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-ctas .btn-white {
  background: #fff; color: var(--primary); font-weight: 700;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.hero-ctas .btn-white:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.18); }
.hero-ctas .btn-ghost {
  background: rgba(255,255,255,0.15); color: #fff;
  border: 2px solid rgba(255,255,255,0.4); backdrop-filter: blur(4px);
}
.hero-ctas .btn-ghost:hover { background: rgba(255,255,255,0.25); color: #fff; transform: translateY(-2px); }
.hero-stats {
  display: flex; gap: 2.5rem; justify-content: center; margin-top: 3rem;
  flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat .stat-number { font-size: 1.7rem; font-weight: 800; color: #fff; }
.hero-stat .stat-label { font-size: 0.8rem; color: rgba(255,255,255,0.75); margin-top: 0.15rem; }

/* ===================================
   SECTION COMMONS
=================================== */
.section { padding: 4.5rem 0; }
.section-sm { padding: 3rem 0; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { margin-bottom: 0.75rem; }
.section-header p { max-width: 560px; margin: 0 auto; font-size: 1.05rem; }
.section-label {
  display: inline-block; background: var(--primary-light);
  color: var(--primary); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.3rem 0.9rem; border-radius: 50px; margin-bottom: 0.75rem;
}

/* ===================================
   DISCLAIMER BANNER
=================================== */
.disclaimer-banner {
  background: linear-gradient(90deg, #fff7ed, #fef3c7);
  border: 1.5px solid #f59e0b; border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem; display: flex; gap: 0.75rem; align-items: flex-start;
  margin-bottom: 2rem;
}
.disclaimer-banner .icon { color: #d97706; font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.disclaimer-banner p { margin: 0; color: #92400e; font-size: 0.87rem; font-weight: 500; }
.disclaimer-banner strong { color: #78350f; }

/* ===================================
   TEMPLATE TABS
=================================== */
.template-tabs {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.template-tab {
  padding: 0.55rem 1.25rem; border-radius: 50px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; border: 2px solid var(--border); background: #fff;
  color: var(--text-mid); transition: var(--transition);
}
.template-tab:hover { border-color: var(--primary); color: var(--primary); }
.template-tab.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(16,181,203,0.3);
}

/* ===================================
   GENERATOR LAYOUT
=================================== */
.generator-section { background: var(--bg); padding: 3rem 0 5rem; }
.generator-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start;
}
.form-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.form-card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 1.25rem 1.75rem; color: #fff;
}
.form-card-header h3 { color: #fff; font-size: 1.1rem; margin-bottom: 0.2rem; }
.form-card-header p { color: rgba(255,255,255,0.8); font-size: 0.83rem; margin: 0; }
.form-card-body { padding: 1.5rem 1.75rem; }
.ai-assist-toggle {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem;
  background: var(--primary-xlight); border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary-light); margin-bottom: 1rem; cursor: pointer;
  transition: var(--transition);
}
.ai-assist-toggle:hover { background: var(--primary-light); }
.ai-assist-toggle .toggle-icon { font-size: 1.2rem; }
.ai-assist-toggle span { font-size: 0.88rem; font-weight: 600; color: var(--primary); flex: 1; }
.toggle-switch {
  width: 40px; height: 22px; background: var(--border); border-radius: 11px;
  position: relative; transition: var(--transition); flex-shrink: 0;
}
.toggle-switch::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; top: 3px; left: 3px;
  transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch.on::after { left: 21px; }
.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.form-actions .btn { flex: 1; justify-content: center; min-width: 140px; }

/* ===================================
   CERTIFICATE PREVIEW
=================================== */
.preview-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; position: sticky; top: 88px; }
.preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--bg);
}
.preview-header h3 { font-size: 1rem; color: var(--text-dark); margin: 0; }
.preview-actions { display: flex; gap: 0.5rem; }
.preview-body { padding: 1.5rem; overflow-y: auto; max-height: 700px; }

/* Certificate Paper — Handwritten Doctor Style */
#certificate-preview {
  background: #fffef9;
  background-image: linear-gradient(rgba(100,140,200,0.07) 1px, transparent 1px);
  background-size: 100% 1.9rem;
  border: none;
  border-radius: 0;
  padding: 0;
  font-family: 'Kalam', cursive;
  color: #1a237e;
  min-height: 500px;
  position: relative;
  overflow: visible;
  box-shadow: 0 3px 18px rgba(0,0,0,0.13), inset 0 0 0 1px rgba(0,0,0,0.05);
}
#certificate-preview::before { display: none; }

/* Handwritten certificate wrapper */
.cert-hw {
  position: relative;
  min-height: 500px;
}

/* Red left margin line */
.cert-hw::before {
  content: '';
  position: absolute;
  left: 54px;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(220, 38, 38, 0.3);
  pointer-events: none;
}

/* Diagonal TEMPLATE watermark */
.cert-hw-watermark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Kalam', cursive; font-size: 5rem; font-weight: 700;
  color: rgba(16,181,203,0.05);
  pointer-events: none; z-index: 0;
  transform: rotate(-20deg);
  user-select: none;
}
.cert-hw > *:not(.cert-hw-watermark) { position: relative; z-index: 1; }

/* Letterhead */
.cert-hw-letterhead {
  padding: 1rem 1.25rem 0.8rem 1.4rem;
  border-bottom: 3px double #1a237e;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem;
  background: linear-gradient(135deg, #f0f4ff 0%, #fffef9 60%);
}
.cert-hw-letterhead-left { flex: 1; }
.cert-hw-doc-name {
  font-family: 'Kalam', cursive; font-size: 1.3rem; font-weight: 700;
  color: #1a237e; line-height: 1.1;
}
.cert-hw-doc-quals {
  font-size: 0.76rem; color: #3949ab; font-family: 'Inter', sans-serif;
  font-weight: 500; margin-top: 0.15rem; letter-spacing: 0.02em;
}
.cert-hw-doc-reg {
  font-size: 0.7rem; color: #5c6bc0; font-family: 'Inter', sans-serif; margin-top: 0.25rem;
}
.cert-hw-letterhead-right { text-align: right; flex-shrink: 0; }
.cert-hw-clinic-name {
  font-family: 'Kalam', cursive; font-size: 1rem; font-weight: 700; color: var(--primary);
}
.cert-hw-clinic-addr {
  font-size: 0.7rem; color: #64748b; font-family: 'Inter', sans-serif; line-height: 1.5; margin-top: 0.2rem;
}
.cert-hw-clinic-phone {
  font-size: 0.7rem; color: var(--primary); font-family: 'Inter', sans-serif;
  margin-top: 0.15rem; font-weight: 600;
}

/* Certificate type title */
.cert-hw-title {
  text-align: center;
  font-family: 'Kalam', cursive; font-size: 1.1rem; font-weight: 700;
  color: #1a237e; letter-spacing: 0.05em;
  padding: 0.6rem 1rem 0.4rem;
  border-bottom: 1.5px solid #c5cae9;
  background: rgba(240,244,255,0.5);
  text-decoration: underline;
  text-decoration-color: rgba(26,35,126,0.3);
  text-underline-offset: 4px;
}

/* Patient info row */
.cert-hw-patient-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem 2rem;
  padding: 0.55rem 1.25rem 0.45rem 1.5rem;
  border-bottom: 1.5px solid #c5cae9;
  background: rgba(240,244,255,0.3);
  align-items: baseline;
}
.cert-hw-field-group { display: flex; align-items: baseline; gap: 0.3rem; }
.cert-hw-field-label {
  font-size: 0.68rem; font-weight: 700; color: #7986cb;
  font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.05em;
}
.cert-hw-field-val {
  font-family: 'Kalam', cursive; font-size: 0.92rem; color: #1a237e;
  border-bottom: 1.5px solid #9fa8da; min-width: 90px; padding: 0 0.1rem;
}
.cert-hw-field-val.wide { min-width: 155px; }
.cert-hw-date-right { margin-left: auto; }

/* Body — handwritten paragraphs */
.cert-hw-body {
  padding: 1rem 1.25rem 0.75rem 1.5rem;
  font-family: 'Kalam', cursive; font-size: 1rem; color: #1a237e; line-height: 2.05;
}
.cert-hw-body p { margin-bottom: 0.35rem; }
.cert-hw-inline-field {
  font-family: 'Kalam', cursive; font-weight: 700; color: #1a237e;
  border-bottom: 1.5px solid rgba(159,168,218,0.7);
  padding: 0 0.2rem; display: inline-block; min-width: 100px;
}
.cert-hw-section {
  margin: 0.6rem 0;
  padding: 0.5rem 0.85rem;
  background: rgba(240,244,255,0.5);
  border-left: 3px solid #3949ab;
  border-radius: 0 4px 4px 0;
  font-family: 'Kalam', cursive; font-size: 0.95rem; color: #1a237e; line-height: 1.7;
}

/* Footer signatures */
.cert-hw-footer {
  padding: 0.75rem 1.25rem 0.85rem 1.4rem;
  border-top: 1.5px solid #c5cae9;
  display: flex; justify-content: space-between; align-items: flex-end;
  background: rgba(240,244,255,0.25);
}
.cert-hw-sig-block { text-align: center; }
/* Patient signature — Pinyon Script: elegant, clean cursive */
.cert-hw-sig-name {
  font-family: 'Pinyon Script', cursive; font-size: 1.65rem; color: #1a237e;
  font-weight: 400; line-height: 1; margin-bottom: 0.15rem; min-width: 120px;
  letter-spacing: 0.02em;
}
/* Doctor signature — Mr Dafoe: elaborate, loopy, illegible doctor scrawl */
.cert-hw-sig-name.doctor {
  font-family: 'Mr Dafoe', cursive; font-size: 2.1rem; color: #1a237e;
  font-weight: 400; line-height: 1; margin-bottom: 0.05rem; min-width: 140px;
  transform: rotate(-3deg) skewX(-5deg);
  display: inline-block;
  letter-spacing: -0.03em;
  filter: drop-shadow(0.5px 0.5px 0px rgba(26,35,126,0.25));
}

.cert-hw-sig-line {
  width: 100%; border-bottom: 1.5px solid #3949ab; margin-bottom: 0.3rem;
}
.cert-hw-sig-label {
  font-size: 0.7rem; color: #5c6bc0; font-family: 'Inter', sans-serif;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.cert-hw-sig-block.right { text-align: right; }

/* Date line */
.cert-hw-date-line {
  text-align: right; font-size: 0.75rem; color: #7986cb;
  font-family: 'Kalam', cursive; margin-top: 0.5rem;
  padding-right: 1.25rem; padding-bottom: 0.1rem;
}

/* Disclaimer strip */
.cert-hw-disclaimer {
  text-align: center; font-size: 0.65rem; color: #ef4444;
  font-family: 'Inter', sans-serif; font-weight: 600;
  padding: 0.4rem 1rem; background: #fef2f2;
  border-top: 1px solid #fecaca; letter-spacing: 0.02em;
}

/* Legacy cert-disclaimer fallback */
.cert-disclaimer {
  text-align: center; font-size: 0.72rem; color: #ef4444;
  font-family: var(--font-sans); font-weight: 600; margin-top: 1.25rem;
  padding: 0.5rem; background: #fef2f2; border-radius: 4px; border: 1px solid #fecaca;
}


/* ===================================
   AI-POWERED TECHNOLOGY SECTION
=================================== */
.ai-section-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.ai-section-text .section-label { margin-bottom: 0.75rem; }
.ai-section-text h2 { margin-bottom: 1rem; }
.ai-section-text p  { font-size: 0.97rem; color: var(--text-mid); margin-bottom: 0.85rem; }
.ai-section-text em { color: var(--primary); font-style: normal; font-weight: 600; }

.ai-section-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.ai-highlight-card {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 1.1rem 1.15rem;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.ai-highlight-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.ai-highlight-icon {
  font-size: 1.5rem; flex-shrink: 0;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); border-radius: var(--radius-sm);
}
.ai-highlight-card h4 { font-size: 0.9rem; margin-bottom: 0.25rem; color: var(--text-dark); }
.ai-highlight-card p  { font-size: 0.82rem; color: var(--text-mid); margin: 0; line-height: 1.55; }

@media (max-width: 900px) {
  .ai-section-inner { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 520px) {
  .ai-section-cards { grid-template-columns: 1fr; }
}

/* ===================================
   FEATURES SECTION
=================================== */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feature-card {
  background: #fff; border-radius: var(--radius-md); padding: 1.75rem;
  box-shadow: var(--shadow-sm); transition: var(--transition); border: 1px solid transparent;
}
.feature-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); transform: translateY(-4px); }
.feature-icon {
  width: 52px; height: 52px; background: var(--primary-light); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 1.4rem; margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.88rem; color: var(--text-mid); margin: 0; }

/* ===================================
   BENEFITS SECTION
=================================== */
.benefits-section { background: #fff; }
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.benefit-card {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  border-left: 4px solid var(--primary);
  transition: var(--transition);
}
.benefit-card:hover {
  background: var(--primary-xlight);
  border-color: var(--primary-light);
  border-left-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.benefit-icon {
  font-size: 1.6rem; flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); border-radius: var(--radius-sm);
}
.benefit-card h4 { font-size: 0.97rem; margin-bottom: 0.3rem; color: var(--text-dark); }
.benefit-card p  { font-size: 0.86rem; color: var(--text-mid); margin: 0; line-height: 1.6; }

@media (max-width: 640px) {
  .benefits-grid { grid-template-columns: 1fr; }
}

/* ===================================
   FAQ SECTION
=================================== */
.faq-section { background: #fff; }
.faq-list { max-width: 780px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 0; font-family: var(--font-sans); font-size: 0.98rem;
  font-weight: 600; color: var(--text-dark); transition: var(--transition);
}
.faq-question:hover { color: var(--primary); }
.faq-icon { color: var(--primary); font-size: 1.1rem; flex-shrink: 0; transition: var(--transition); }
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none; padding-bottom: 1.2rem;
}
.faq-answer p { font-size: 0.92rem; color: var(--text-mid); line-height: 1.7; margin: 0; }
.faq-item.open .faq-answer { display: block; }

/* ===================================
   HOW-TO SECTION
=================================== */
.howto-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.howto-step { text-align: center; }
.howto-number {
  width: 56px; height: 56px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; color: #fff; margin: 0 auto 1rem;
  box-shadow: 0 4px 14px rgba(16,181,203,0.35);
}
.howto-step h4 { font-size: 0.95rem; margin-bottom: 0.4rem; }
.howto-step p { font-size: 0.83rem; color: var(--text-mid); margin: 0; }

/* ===================================
   BLOG SECTION
=================================== */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
.blog-card {
  background: #fff; border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: var(--transition); display: flex; flex-direction: column;
  border: 1px solid transparent;
}
.blog-card:hover { box-shadow: var(--shadow-md); transform: translateY(-5px); border-color: var(--primary-light); }
.blog-card-img {
  height: 180px; overflow: hidden; background: linear-gradient(135deg, var(--primary-light), var(--bg));
  display: flex; align-items: center; justify-content: center; font-size: 3rem;
}
.blog-card-body { padding: 1.35rem; flex: 1; display: flex; flex-direction: column; }
.blog-meta {
  display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem;
  font-size: 0.78rem; color: var(--text-light);
}
.blog-meta .dot { width: 3px; height: 3px; background: var(--border); border-radius: 50%; }
.blog-card h3 { font-size: 1rem; margin-bottom: 0.5rem; line-height: 1.35; }
.blog-card p { font-size: 0.85rem; color: var(--text-mid); flex: 1; }
.blog-card .read-more {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--primary); font-size: 0.85rem; font-weight: 600; margin-top: 1rem;
}
.blog-card .read-more:hover { gap: 0.55rem; }

/* ===================================
   CTA STRIP
=================================== */
.cta-strip {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 3.5rem 0; text-align: center; color: #fff;
}
.cta-strip h2 { color: #fff; margin-bottom: 0.75rem; }
.cta-strip p { color: rgba(255,255,255,0.85); margin-bottom: 2rem; font-size: 1.05rem; }
.cta-strip .btn-white {
  display: inline-block;
  background: #fff;
  color: var(--primary);
  padding: 0.9rem 2.2rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
}
.cta-strip .btn-white:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.25); }

/* ===================================
   FOOTER
=================================== */
footer {
  background: #0f1f2b; color: rgba(255,255,255,0.7); padding: 3.5rem 0 1.5rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem; margin-bottom: 3rem; }
.footer-logo { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }

.footer-logo img { height: 32px; width: auto; opacity: 0.95; }
.footer-logo span { font-size: 1rem; font-weight: 700; color: #fff; }
.footer-brand p { font-size: 0.86rem; line-height: 1.7; color: rgba(255,255,255,0.6); }
.footer-col h4 { color: #fff; font-size: 0.88rem; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 1rem; }
.footer-col ul li { margin-bottom: 0.6rem; }
.footer-col ul li a { font-size: 0.86rem; color: rgba(255,255,255,0.6); transition: var(--transition); }
.footer-col ul li a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08); padding-top: 1.5rem;
  text-align: center;
  font-size: 0.82rem; color: rgba(255,255,255,0.45);
}
.footer-bottom a { color: rgba(255,255,255,0.45); }
.footer-bottom a:hover { color: var(--primary); }
.footer-disclaimer {
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm); padding: 0.85rem 1.25rem; margin-bottom: 2.5rem;
  text-align: center;
}
.footer-disclaimer p { font-size: 0.83rem; color: rgba(255,180,180,0.9); margin: 0; }

/* ===================================
   INNER PAGE HERO
=================================== */
.page-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 3.5rem 0; text-align: center; color: #fff;
}
.page-hero h1 { color: #fff; font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin-bottom: 0.5rem; }
.page-hero p { color: rgba(255,255,255,0.85); font-size: 1rem; margin: 0; }
.breadcrumb {
  display: flex; gap: 0.5rem; align-items: center; justify-content: center;
  margin-top: 1rem; font-size: 0.82rem; color: rgba(255,255,255,0.65);
}
.breadcrumb a { color: rgba(255,255,255,0.75); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .sep { color: rgba(255,255,255,0.4); }

/* ===================================
   BLOG POST PAGE
=================================== */
.blog-post-layout { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; align-items: start; }
.blog-post-content { background: #fff; border-radius: var(--radius-md); padding: 2.5rem; box-shadow: var(--shadow-sm); word-wrap: break-word; overflow-wrap: break-word; }
.blog-post-content h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1rem; }
.blog-post-content h2 { font-size: 1.4rem; margin: 2rem 0 0.8rem; color: var(--primary); border-left: 4px solid var(--primary); padding-left: 0.75rem; }
.blog-post-content h3 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
.blog-post-content p { line-height: 1.8; margin-bottom: 1rem; }
.blog-post-content ul, .blog-post-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.blog-post-content li { margin-bottom: 0.5rem; line-height: 1.7; }
.blog-post-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.blog-post-content th { background: var(--primary); color: #fff; padding: 0.75rem 1rem; font-size: 0.88rem; }
.blog-post-content td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.blog-post-content tr:nth-child(even) td { background: var(--primary-xlight); }
.blog-sidebar { position: sticky; top: 88px; }
.sidebar-card { background: #fff; border-radius: var(--radius-md); padding: 1.5rem; box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; }
.sidebar-card h4 { font-size: 0.9rem; color: var(--text-dark); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary-light); }
.sidebar-card ul li { margin-bottom: 0.5rem; }
.sidebar-card ul li a { font-size: 0.85rem; color: var(--text-mid); }
.sidebar-card ul li a:hover { color: var(--primary); }

/* ===================================
   CONTACT FORM
=================================== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.contact-info h3 { margin-bottom: 1rem; }
.contact-info p { margin-bottom: 1.5rem; }
.contact-detail { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 1.25rem; }
.contact-detail .icon { color: var(--primary); font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.contact-detail p { margin: 0; font-size: 0.9rem; }

/* ===================================
   INNER CONTENT PAGE
=================================== */
.content-page { background: #fff; border-radius: var(--radius-md); padding: 2.5rem; box-shadow: var(--shadow-sm); max-width: 860px; margin: 0 auto; word-wrap: break-word; overflow-wrap: break-word; }
.content-page h2 { font-size: 1.4rem; color: var(--primary); margin: 2rem 0 0.75rem; }
.content-page h3 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.content-page p, .content-page li { line-height: 1.8; font-size: 0.94rem; }
.content-page ul, .content-page ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.content-page li { margin-bottom: 0.4rem; }

/* ===================================
   PRINT STYLES
=================================== */
@media print {
  body * { visibility: hidden !important; }
  #certificate-preview, #certificate-preview * { visibility: visible !important; }
  #certificate-preview { position: fixed !important; inset: 0 !important; width: 100% !important; height: 100% !important; border: none !important; box-shadow: none !important; padding: 2cm !important; }
  #certificate-preview::before { display: none !important; }
}

/* ===================================
   RESPONSIVE & MOBILE UX
=================================== */
.mobile-sticky-cta { display: none; }

@media (max-width: 1024px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .howto-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .hamburger { display: flex; }
  .generator-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-card { position: static; }
  
  /* Mobile UX: Horizontal Scroll for Live Preview */
  .preview-body { 
    padding: 0.75rem; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    background: #f8fafc;
  }
  #certificate-preview { 
    min-width: 580px; /* guarantees layout remains intact */
    margin: 0 auto; 
    border: 1px solid #e2e8f0;
  }

  /* Mobile UX: Form Inputs larger for tapping */
  .form-control, .form-select {
    padding: 0.9rem;
    font-size: 1rem;
  }

  .form-row { grid-template-columns: 1fr; }
  .hero-stats { gap: 1.5rem; }
  .features-grid { grid-template-columns: 1fr; }
  .howto-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-post-layout { grid-template-columns: 1fr; }
  
  /* Mobile UX: Blog Post adjustments */
  .blog-post-content, .content-page { padding: 1.25rem 1rem; }
  .blog-post-content table { 
    display: block; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    white-space: nowrap;
  }

  .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .hero-ctas { flex-direction: column; align-items: center; }
  
  /* Mobile UX: Sticky Bottom Action Bar */
  .mobile-sticky-cta {
    display: flex; position: fixed; bottom: 0; left: 0; width: 100%;
    background: #fff; padding: 12px 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 9999; justify-content: center;
  }
  .mobile-sticky-cta .btn { width: 100%; justify-content: center; font-size: 1.05rem; padding: 0.9rem; }
  footer { padding-bottom: 80px; } /* clearance for sticky CTA */
}

@media (max-width: 480px) {
  .section { padding: 3rem 0; }
  .card { padding: 1.25rem; }
  .howto-grid { grid-template-columns: 1fr 1fr; }
  .form-actions { flex-direction: column; }
  #certificate-preview { min-width: 520px; }
}

/* ===================================
   ANIMATIONS
=================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.animate-fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.animate-delay-1 { animation-delay: 0.15s; }
.animate-delay-2 { animation-delay: 0.3s; }
.animate-delay-3 { animation-delay: 0.45s; }

/* ===================================
   CERTIFICATE HISTORY PANEL
=================================== */
.history-section { padding-top: 1rem; padding-bottom: 3rem; }

.history-panel {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.history-panel-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-xlight), #fff);
  border-bottom: 1.5px solid var(--border);
}

.history-panel-title {
  display: flex; align-items: center; gap: 0.65rem;
}
.history-panel-title h3 {
  font-size: 1.05rem; margin: 0; color: var(--text-dark);
}
.history-icon { font-size: 1.2rem; }

.history-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 0.45rem;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 700; border-radius: 50px;
}

.history-panel-actions {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.history-hint {
  font-size: 0.78rem; color: var(--text-light);
  display: flex; align-items: center; gap: 0.3rem;
}
.history-hint::before { content: '🔒'; font-size: 0.8rem; }

.history-list { padding: 0.5rem 0; }

/* Each saved certificate row */
.history-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--primary-xlight); }

.history-item-info { flex: 1; min-width: 0; }
.history-item-name {
  font-size: 0.95rem; font-weight: 600; color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-item-meta {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  margin-top: 0.2rem; font-size: 0.78rem; color: var(--text-light);
}
.history-dot { opacity: 0.4; }
.history-badge {
  display: inline-flex; align-items: center;
  padding: 0.15rem 0.6rem; border-radius: 50px;
  background: var(--primary-light); color: var(--primary);
  font-size: 0.72rem; font-weight: 600;
}

.history-item-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.history-delete-btn { padding: 0.4rem 0.65rem; font-size: 0.9rem; min-width: unset; }

/* Empty state */
.history-empty {
  text-align: center; padding: 2.5rem 1.5rem;
}
.history-empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.5; }
.history-empty p { font-size: 0.9rem; color: var(--text-light); margin: 0 0 0.35rem; }
.history-empty strong { color: var(--primary); }

/* Toast notification */
.history-toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; color: #fff;
  background: var(--primary-dark);
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.history-toast.show { opacity: 1; transform: translateY(0); }
.history-toast.history-toast-warn { background: #d97706; }
.history-toast.history-toast-success { background: #059669; }

/* Responsive */
@media (max-width: 600px) {
  .history-panel-header { flex-direction: column; align-items: flex-start; }
  .history-item { flex-direction: column; align-items: flex-start; }
  .history-item-actions { width: 100%; justify-content: flex-end; }
}
