/* ============================================= */
/*     ENHANCED MEDICAL DIAGNOSIS STYLES        */
/*   Beautiful + Functional + Accessible        */
/* ============================================= */

/* ==================== RESET & BASE ==================== */

/* Prevent scroll anchoring */
html {
  overflow-anchor: none;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #2e1065 50%, #7c3aed 100%);
  min-height: 100vh;
  padding: 0;
  color: #333;
  position: relative;
  overflow-x: hidden;
  scroll-behavior: auto;
}

/* App screen keeps its own breathing room */
#app-screen {
  padding: 40px 20px;
}

/* Animated background pattern - ENHANCED */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(45deg, transparent 48%, rgba(255,255,255,0.1) 49%, rgba(255,255,255,0.1) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(255,255,255,0.1) 49%, rgba(255,255,255,0.1) 51%, transparent 52%);
  background-size: 60px 60px;
  animation: moveBackground 25s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

@keyframes moveBackground {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 60px 60px, -60px 60px; }
}

/* ==================== SLIDE TRANSITION SYSTEM ==================== */

/* Auth form panels: slide in/out horizontally */
.auth-content {
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFromRight {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: translateX(0);    }
}
@keyframes slideInFromLeft {
  from { opacity: 0; transform: translateX(-48px); }
  to   { opacity: 1; transform: translateX(0);     }
}
@keyframes slideOutToLeft {
  from { opacity: 1; transform: translateX(0);     }
  to   { opacity: 0; transform: translateX(-48px); }
}
@keyframes slideOutToRight {
  from { opacity: 1; transform: translateX(0);    }
  to   { opacity: 0; transform: translateX(48px); }
}

.auth-slide-enter-right  { animation: slideInFromRight  0.38s cubic-bezier(0.4,0,0.2,1) forwards; }
.auth-slide-enter-left   { animation: slideInFromLeft   0.38s cubic-bezier(0.4,0,0.2,1) forwards; }
.auth-slide-exit-left    { animation: slideOutToLeft    0.28s cubic-bezier(0.4,0,0.2,1) forwards; }
.auth-slide-exit-right   { animation: slideOutToRight   0.28s cubic-bezier(0.4,0,0.2,1) forwards; }

/* Tab content slide transitions */
@keyframes tabSlideInRight {
  from { opacity: 0; transform: translateX(36px); }
  to   { opacity: 1; transform: translateX(0);    }
}
@keyframes tabSlideInLeft {
  from { opacity: 0; transform: translateX(-36px); }
  to   { opacity: 1; transform: translateX(0);     }
}
.tab-slide-in-right { animation: tabSlideInRight 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.tab-slide-in-left  { animation: tabSlideInLeft  0.35s cubic-bezier(0.4,0,0.2,1) both; }

/* Screen transition: auth ↔ app */
@keyframes screenFadeSlideIn {
  from { opacity: 0; transform: translateY(28px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes screenFadeSlideOut {
  from { opacity: 1; transform: translateY(0)     scale(1);    }
  to   { opacity: 0; transform: translateY(-20px) scale(0.98); }
}
.screen-enter { animation: screenFadeSlideIn  0.45s cubic-bezier(0.4,0,0.2,1) both; }
.screen-exit  { animation: screenFadeSlideOut 0.3s  cubic-bezier(0.4,0,0.2,1) both; }

/* Modal entrance refinement */
@keyframes modalBounceIn {
  0%   { opacity: 0; transform: translateY(-32px) scale(0.93); }
  60%  { opacity: 1; transform: translateY(4px)   scale(1.01); }
  100% { opacity: 1; transform: translateY(0)     scale(1);    }
}
.modal-bounce-in { animation: modalBounceIn 0.42s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ==================== CONTAINERS ==================== */

.auth-container,
.container {
  max-width: 1100px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.985);
  border-radius: 28px;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255,255,255,0.25),
    0 0 80px rgba(124,58,237,0.12) inset;
  backdrop-filter: blur(16px) saturate(1.4);
  position: relative;
  animation: containerFadeIn 0.6s ease-out;
}

@keyframes containerFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.auth-container {
  max-width: 560px;
  width: 100%;
}

/* Auth screen: full-viewport centered layout */
#auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

#auth-screen .auth-container {
  width: 100%;
}

.content {
  padding: 30px 40px 40px 40px;
}

.section {
  background: white;
  padding: 35px;
  border-radius: 20px;
  margin-bottom: 30px;
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #2e1065, #7c3aed) border-box;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(124,58,237,0.03) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.section:hover::before {
  opacity: 1;
}

.section:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.section h2 {
  color: #2e1065;
  font-size: 1.6em;
  margin-bottom: 25px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section h2::before {
  content: '';
  width: 5px;
  height: 28px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(46, 16, 101, 0.4);
}

/* Connection Status Banner - ENHANCED */
#connection-status {
  padding: 18px 24px;
  margin-bottom: 35px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  border: 2px solid #2e1065;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 15px rgba(46, 16, 101, 0.15);
  transition: all 0.3s ease;
  animation: slideIn 0.5s ease-out;
}

#connection-status.connected {
  background: linear-gradient(135deg, #e8f5e9 0%, #dff5e1 100%);
  border-color: #4caf50;
  color: #2e7d32;
}

#connection-status.error {
  background: linear-gradient(135deg, #ffebee 0%, #ffe5e8 100%);
  border-color: #d32f2f;
  color: #c62828;
}

.status-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2e1065;
  animation: pulse 2s infinite;
  box-shadow: 0 0 0 0 rgba(46, 16, 101, 0.7);
}

#connection-status.connected .status-indicator { 
  background: #4caf50;
  box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
}

#connection-status.error .status-indicator { 
  background: #d32f2f; 
  animation: none; 
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 16, 101, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(46, 16, 101, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 16, 101, 0); }
}

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

/* ==================== HEADER - ENHANCED ==================== */

.header {
  background: linear-gradient(135deg, #08091a 0%, #2e1065 45%, #7c3aed 100%);
  color: white;
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}

/* Luminous orb behind header content */
.header::after {
  content: '';
  position: absolute;
  top: -30%;
  right: 10%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(124,58,237,0.35) 0%, transparent 70%);
  pointer-events: none;
  animation: orbPulse 6s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1)   translateY(0);  opacity: 0.7; }
  50%       { transform: scale(1.2) translateY(10px); opacity: 1;  }
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 2px, transparent 2px);
  background-size: 40px 40px;
  animation: headerPattern 30s linear infinite;
}

@keyframes headerPattern {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.header-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 3em;
  font-weight: 800;
  margin-bottom: 15px;
  letter-spacing: -1px;
  text-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: fadeInUp 0.8s ease;
  display: flex;
  align-items: center;
  gap: 15px;
}



.header p {
  font-size: 1.2em;
  opacity: 0.95;
  font-weight: 500;
  text-shadow: 0 2px 10px rgba(0,0,0,0.1);
  animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.15);
  padding: 12px 20px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.user-info:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.user-info span {
  font-weight: 600;
  font-size: 0.95em;
}

.logout-btn {
  padding: 10px 20px;
  border: 2px solid white;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.logout-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.logout-btn:hover::before {
  width: 300px;
  height: 300px;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==================== AUTH FORMS ==================== */

.auth-header {
  background: linear-gradient(135deg, #0a0f2c 0%, #2e1065 45%, #7c3aed 100%);
  color: white;
  padding: 54px 44px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Animated shimmer ribbon */
.auth-header::after {
  content: '';
  position: absolute;
  top: -40%;
  left: -60%;
  width: 60%;
  height: 180%;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.08) 50%, transparent 60%);
  animation: authShimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes authShimmer {
  0%   { left: -60%; }
  100% { left: 130%; }
}

.auth-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.3) 0%, transparent 60%);
  pointer-events: none;
}

.auth-header h1 {
  font-size: 2.4em;
  margin-bottom: 12px;
  font-weight: 800;
  position: relative;
  z-index: 1;
  letter-spacing: -0.5px;
}

.auth-header p {
  font-size: 1.05em;
  opacity: 0.88;
  position: relative;
  z-index: 1;
  font-weight: 500;
}

.auth-content {
  padding: 48px 50px 44px;
}

/* ── Google Sign-In button: animation isolation ──────────────────────────────
 * GIS measures #g_id_signin_container's offsetWidth at renderButton() time.
 * If any ancestor is mid-animation (containerFadeIn, screen-enter, slideIn…)
 * the layout engine may report 0 px or a fractional width, causing GIS to
 * fall back to the oversized "G" icon and then re-render — visible as flicker.
 *
 *  contain: layout style  — isolates this subtree's layout from ancestor
 *                           reflows caused by CSS animations on .auth-container.
 *  will-change: transform — promotes to its own compositor layer so ancestor
 *                           opacity/transform animations don't force re-layout.
 *  opacity/animation      — explicitly opt out of any inherited animation so
 *                           the container is never invisible when GIS reads it.
 * ──────────────────────────────────────────────────────────────────────────── */
#g_id_signin_container {
  width: 400px !important;
  min-width: 400px !important;
  max-width: 400px !important;
  margin: 12px auto 0;
  overflow: hidden;
  contain: layout style;
  will-change: transform;
  opacity: 1 !important;
  animation: none !important;
  transition: none !important;
}

/* GIS button: shrink to fit on tablet */
@media (max-width: 768px) {
  #g_id_signin_container {
    width: 340px !important;
    min-width: 340px !important;
    max-width: 340px !important;
  }
}

/* GIS button: shrink further on small mobile */
@media (max-width: 480px) {
  #g_id_signin_container {
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
  }
}

/* GIS button: minimum safe size for very small screens (320px) */
@media (max-width: 360px) {
  #g_id_signin_container {
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
  }
}

.google-signin-divider {
  animation: none !important;
  transition: none !important;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2e1065;
  font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 16px 20px;
  font-size: 1em;
  border-radius: 12px;
  border: 2px solid #e8e8f4;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8f7ff 100%);
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(46,16,101,0.04) inset;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow:
    0 0 0 4px rgba(124, 58, 237, 0.12),
    0 8px 24px rgba(0,0,0,0.08),
    0 2px 8px rgba(46,16,101,0.04) inset;
  transform: translateY(-2px);
  background: white;
}

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

/* Auth button - ENHANCED */
.auth-btn {
  width: 100%;
  padding: 18px;
  font-size: 1.1em;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: 700;
  margin-top: 10px;
  box-shadow: 0 8px 20px rgba(46, 16, 101, 0.3);
  position: relative;
  overflow: hidden;
}

.auth-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.auth-btn:hover:not(:disabled)::before {
  width: 400px;
  height: 400px;
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(46, 16, 101, 0.5);
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auth links */
.auth-links {
  text-align: center;
  margin-top: 25px;
  font-size: 0.95em;
}

.auth-links a {
  color: #2e1065;
  text-decoration: none;
  font-weight: 600;
  position: relative;
}

.auth-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  transition: width 0.3s ease;
}

.auth-links a:hover::after {
  width: 100%;
}

/* Auth screen footer */
.auth-screen-footer {
  text-align: center;
  margin-top: 28px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.88em;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Messages - ENHANCED */
.error-message,
.success-message {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 0.95em;
  font-weight: 500;
  animation: messageSlideIn 0.4s ease-out;
}

@keyframes messageSlideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.error-message {
  background: linear-gradient(135deg, #ffebee 0%, #ffe5e8 100%);
  color: #c62828;
  border-left: 4px solid #d32f2f;
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.2);
}

.success-message {
  background: linear-gradient(135deg, #e8f5e9 0%, #dff5e1 100%);
  color: #2e7d32;
  border-left: 4px solid #4caf50;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================== TABS & BUTTONS - ENHANCED ==================== */

.tab-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  padding: 6px;
  background: linear-gradient(135deg, #f4f2ff 0%, #ede9ff 100%);
  border-radius: 18px;
  box-shadow:
    inset 0 2px 10px rgba(46, 16, 101, 0.09),
    0 2px 8px rgba(46,16,101,0.06);
  border: 1px solid rgba(124,58,237,0.1);
}

.tab-btn {
  padding: 14px 28px;
  background: white;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex: 1;
  text-align: center;
  font-size: 1em;
  color: #64748b;
  position: relative;
  overflow: hidden;
}

.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  transition: left 0.4s ease;
  z-index: -1;
}

.tab-btn:hover:not(.active)::before {
  left: 0;
}

.tab-btn:hover:not(.active) {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 16, 101, 0.3);
}

.tab-btn.active {
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(46, 16, 101, 0.4);
  transform: translateY(-2px);
}

.dataset-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.dataset-btn {
  padding: 16px 24px;
  font-size: 1.05em;
  border: 2px solid transparent;
  border-radius: 14px;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #2e1065, #7c3aed) border-box;
  color: #2e1065;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.dataset-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  transition: left 0.4s ease;
  z-index: -1;
}

.dataset-btn:hover:not(:disabled):not(.selected)::before {
  left: 0;
}

.dataset-btn:hover:not(:disabled):not(.selected) {
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(46, 16, 101, 0.4);
}

.dataset-btn.selected {
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 8px 20px rgba(46, 16, 101, 0.5);
  transform: scale(1.02);
}

.dataset-btn.selected::after {
  content: '✓';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3em;
  font-weight: bold;
}

.dataset-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #e0e0e0;
  color: #999;
  background: #f5f5f5;
}

/* ==================== SKELETON LOADING ==================== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-card {
  height: 200px;
  margin-bottom: 20px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==================== RESULT ROWS - ENHANCED ==================== */

.expandable-result {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, rgba(46, 16, 101, 0.2), rgba(124, 58, 237, 0.2)) border-box;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.expandable-result:hover {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #2e1065, #7c3aed) border-box;
  box-shadow: 0 8px 25px rgba(46, 16, 101, 0.2);
  transform: translateX(8px);
}

.result-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  scroll-margin-top: 0;
  position: relative;
}

.result-main:hover {
  background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.result-info h4 {
  font-size: 1.3em;
  color: #333;
  margin-bottom: 10px;
  font-weight: 700;
}

.result-info p {
  color: #666;
  font-size: 0.95em;
  margin: 0;
}

.result-meta {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 0.95em;
  color: #666;
  margin-top: 8px;
}

.result-meta span {
  background: rgba(46, 16, 101, 0.1);
  padding: 5px 12px;
  border-radius: 8px;
  font-weight: 500;
}

.expand-arrow {
  font-size: 1em;
  color: #7c3aed;
  font-weight: bold;
  transition: transform 0.3s ease;
  display: inline-block;
  width: 22px;
  text-align: center;
}

.score-badge {
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 1.3em;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(46, 16, 101, 0.4);
  min-width: 110px;
  text-align: right;
  margin-left: 20px;
  flex-shrink: 0;
}

/* ==================== SYMPTOM DETAILS TABLE - ENHANCED ==================== */

.symptom-details {
  overflow: hidden;
  transition: all 0.3s ease;
  border-top: 2px solid #e0e0e0;
}

@keyframes slideDownEnhanced {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    max-height: 1000px;
    transform: translateY(0);
  }
}

.symptom-details[style*="display: block"] {
  animation: slideDownEnhanced 0.4s ease-out;
}

.symptom-scores-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.symptom-scores-table table th {
  padding: 14px 16px;
  text-align: left;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 1.05em;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%) !important;
  border-bottom: 2px solid #7c3aed;
  position: relative;
}

.symptom-scores-table table th::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.symptom-scores-table table td {
  padding: 14px 16px;
  font-size: 0.95em;
  border-bottom: 1px solid #e0e0e0;
  transition: all 0.2s ease;
}

.symptom-scores-table table tbody tr {
  transition: all 0.2s ease;
}

.symptom-scores-table table tbody tr:hover {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
  transform: translateX(4px);
}

.symptom-scores-table table th:nth-child(3),
.symptom-scores-table table td:nth-child(3) {
  text-align: right !important;
  padding-right: 20px !important;
  width: 130px;
  font-weight: 600;
}

.symptom-scores-table table tbody tr:nth-child(even) {
  background: #f8f9ff;
}

/* ==================== RECOMMENDATION BANNER - ENHANCED ==================== */

.recommendation-banner {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 3px solid #f59e0b;
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 35px;
  box-shadow: 0 10px 35px rgba(245, 158, 11, 0.3);
  animation: slideInEnhanced 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.recommendation-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
  animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

/* ==================== MODAL SYSTEM - ENHANCED ==================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.show {
  display: flex;
}

#prescription-modal {
  z-index: 1000;
}

#prescription-modal .modal-content {
  max-width: 820px;
  width: 92%;
}

#prescription-modal .modal-body {
  padding: 36px 40px 40px;
}

#prescription-modal .form-group input,
#prescription-modal .form-group select,
#prescription-modal .form-group textarea {
  padding: 18px 22px;
  font-size: 1.05em;
}

#prescription-modal .form-group label {
  font-size: 1em;
  margin-bottom: 10px;
}

#prescription-modal .form-group {
  margin-bottom: 28px;
}

#prescription-modal textarea {
  min-height: 160px;
}

#prescription-modal .primary-btn {
  width: 100%;
  padding: 20px;
  font-size: 1.15em;
  margin-top: 6px;
}

#patient-detail-modal {
  z-index: 1050;
}

#followup-modal {
  z-index: 1100;
}

.modal-content {
  background: white;
  border-radius: 22px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255,255,255,0.15);
  animation: modalBounceIn 0.42s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* Custom scrollbars for modals */
.modal-content::-webkit-scrollbar,
.patient-detail-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track,
.patient-detail-content::-webkit-scrollbar-track {
  background: #f0f0f8;
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb,
.patient-detail-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2e1065, #7c3aed);
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.patient-detail-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #1e0a47, #5b21b6);
}

#followup-modal .modal-content {
  max-width: 1200px;
  min-height: 80vh;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

#followup-modal .modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#followup-modal .followup-split-container {
  flex: 1;
  min-height: 0;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 24px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-body {
  padding: 30px;
}

.close-modal {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Patient detail modal */
#patient-detail-modal.patient-detail-view {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1050;
}

.patient-detail-content {
  background: white;
  border-radius: 22px;
  width: 92%;
  max-width: 1000px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255,255,255,0.15);
  animation: modalBounceIn 0.42s cubic-bezier(0.34,1.56,0.64,1) both;
}

.patient-detail-header {
  padding: 24px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Back to List button — sits in the dark gradient patient-detail-header */
.back-to-list-btn {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
}

.back-to-list-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateX(-3px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* Submit Feedback button — sits in the dark gradient follow-up modal header */
.feedback-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #1c1917;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 0.88em;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.feedback-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.5);
  transform: translateY(-2px);
}

.modal.show::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

/* Patient detail body content */
#patient-detail-body {
  padding: 30px 35px;
}

/* Patient info grid inside detail modal */
.patient-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  padding: 24px;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
  border-radius: 16px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.patient-info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.patient-info-label {
  font-size: 0.8em;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.patient-info-value {
  font-size: 1.05em;
  font-weight: 700;
  color: #2e1065;
}

/* Prescription section in detail */
.prescription-section {
  margin-top: 24px;
  padding: 24px;
  background: white;
  border-radius: 16px;
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, rgba(46, 16, 101, 0.2), rgba(124, 58, 237, 0.2)) border-box;
}

.prescription-section h3 {
  color: #2e1065;
  font-size: 1.1em;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8eeff;
}

/* Action buttons row in detail modal */
#patient-detail-modal .action-buttons-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin: 0 35px 30px;
  padding-top: 20px;
  border-top: 2px solid #e0e0e0;
}

/* ==================== STAGGERED ENTRY ANIMATIONS ==================== */

@keyframes cardCascadeIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.patient-card {
  animation: cardCascadeIn 0.38s cubic-bezier(0.4,0,0.2,1) both;
}

/* Stagger each card by index (up to 10) */
.patient-card:nth-child(1)  { animation-delay: 0.03s; }
.patient-card:nth-child(2)  { animation-delay: 0.08s; }
.patient-card:nth-child(3)  { animation-delay: 0.13s; }
.patient-card:nth-child(4)  { animation-delay: 0.18s; }
.patient-card:nth-child(5)  { animation-delay: 0.22s; }
.patient-card:nth-child(6)  { animation-delay: 0.26s; }
.patient-card:nth-child(7)  { animation-delay: 0.30s; }
.patient-card:nth-child(8)  { animation-delay: 0.33s; }
.patient-card:nth-child(9)  { animation-delay: 0.36s; }
.patient-card:nth-child(10) { animation-delay: 0.38s; }

.expandable-result {
  animation: cardCascadeIn 0.35s cubic-bezier(0.4,0,0.2,1) both;
}
.expandable-result:nth-child(1)  { animation-delay: 0.04s; }
.expandable-result:nth-child(2)  { animation-delay: 0.10s; }
.expandable-result:nth-child(3)  { animation-delay: 0.16s; }
.expandable-result:nth-child(4)  { animation-delay: 0.21s; }
.expandable-result:nth-child(5)  { animation-delay: 0.26s; }
.expandable-result:nth-child(6)  { animation-delay: 0.30s; }
.expandable-result:nth-child(7)  { animation-delay: 0.33s; }
.expandable-result:nth-child(8)  { animation-delay: 0.36s; }
.expandable-result:nth-child(9)  { animation-delay: 0.38s; }
.expandable-result:nth-child(10) { animation-delay: 0.40s; }

/* ==================== PATIENT CARDS & RECORDS - ENHANCED ==================== */

.patient-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, rgba(46, 16, 101, 0.2), rgba(124, 58, 237, 0.2)) border-box;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.patient-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.1), transparent);
  transition: left 0.6s ease;
}

.patient-card:hover::before {
  left: 100%;
}

.patient-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #2e1065, #7c3aed) border-box;
}

/* Patient name clickable indicator */
.patient-card .patient-name,
.patient-card h3,
.patient-card h4 {
  color: #2e1065;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: color 0.2s ease;
}

.patient-card .patient-name::after,
.patient-card h3::after,
.patient-card h4::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #2e1065, #7c3aed);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.patient-card:hover .patient-name::after,
.patient-card:hover h3::after,
.patient-card:hover h4::after {
  width: 100%;
}

.patient-card:hover .patient-name,
.patient-card:hover h3,
.patient-card:hover h4 {
  color: #7c3aed;
}

/* Click-here affordance badge on card */
.patient-card::after {
  content: 'Open →';
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%) translateX(8px);
  font-size: 0.75em;
  font-weight: 700;
  color: #7c3aed;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  pointer-events: none;
}

.patient-card:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Follow-up layout */
.followup-split-container {
  display: flex;
  gap: 30px;
  padding: 20px;
  flex: 1;
  min-height: 0;
}

.followup-left-panel,
.followup-right-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Make the symptoms textarea in follow-up taller */
#followup-symptoms {
  min-height: 200px;
  flex: 1;
}

/* Make the followup results area scrollable and taller */
#followup-results {
  min-height: 160px;
  max-height: 340px;
  overflow-y: auto;
}

/* Feedback form - ENHANCED */
.feedback-form {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f5ff 100%);
  border: 2px solid #7c3aed;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.15);
  transition: all 0.3s ease;
}

.feedback-form:hover {
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.25);
  transform: translateY(-2px);
}

.outcome-buttons {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.outcome-btn {
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  flex: 1;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.outcome-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.outcome-btn:hover::before {
  width: 300px;
  height: 300px;
}

.outcome-btn.better {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.outcome-btn.worse {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.outcome-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.outcome-btn.better:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.outcome-btn.worse:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

/* Primary button - ENHANCED */
.primary-btn {
  padding: 18px 36px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1em;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 20px rgba(46, 16, 101, 0.3);
  position: relative;
  overflow: hidden;
}

.primary-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.primary-btn:hover:not(:disabled)::before {
  width: 400px;
  height: 400px;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(46, 16, 101, 0.5);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.primary-btn.loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 12px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Action buttons - ENHANCED */
.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.action-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.action-btn:hover::before {
  width: 300px;
  height: 300px;
}

.followup-btn {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.followup-btn:hover {
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.5);
  transform: translateY(-2px);
}

.export-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.export-btn:hover {
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
}

.delete-btn {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.delete-btn:hover {
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.5);
  transform: translateY(-2px);
}

/* Button groups */
.button-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 25px;
}

#analyze-btn, #download-pdf-btn {
  padding: 18px 36px;
  font-size: 1.1em;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: 700;
  flex: 1;
  min-width: 220px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(46, 16, 101, 0.3);
}

#analyze-btn::before, #download-pdf-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

#analyze-btn:hover::before, #download-pdf-btn:hover::before {
  width: 400px;
  height: 400px;
}

#analyze-btn:hover:not(:disabled), #download-pdf-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(46, 16, 101, 0.5);
}

#analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#analyze-btn.loading::after {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 12px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

#download-pdf-btn {
  display: none;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
}

/* Results display */
#results-div {
  display: none;
  animation: slideUpResults 0.5s ease;
}

@keyframes slideUpResults {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 3px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #2e1065, #7c3aed) border-box;
  border-image: linear-gradient(135deg, #2e1065, #7c3aed) 1;
}

.results-header h3 {
  font-size: 1.8em;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
}

.result-count {
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95em;
  box-shadow: 0 4px 15px rgba(46, 16, 101, 0.3);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state p {
  font-size: 1.2em;
  font-weight: 500;
}

/* Selected dataset display */
#selected-dataset {
  font-size: 1em;
  color: #2e1065;
  font-weight: 600;
  padding: 15px 20px;
  border-top: 2px solid #e0e0e0;
  margin-top: 20px;
  padding-top: 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f0e8ff 100%);
}

/* ==================== SEARCH INPUT (standalone, no form-group wrapper) ==================== */

.search-input {
  flex: 1;
  padding: 14px 20px;
  font-size: 1em;
  border-radius: 14px;
  border: 2px solid #e8e8f4;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8f7ff 100%);
  font-family: inherit;
  color: #333;
  box-shadow: 0 2px 8px rgba(46,16,101,0.04) inset;
}

.search-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow:
    0 0 0 4px rgba(124, 58, 237, 0.12),
    0 8px 20px rgba(0,0,0,0.06),
    0 2px 8px rgba(46,16,101,0.04) inset;
  background: white;
  transform: translateY(-1px);
}

/* ==================== TIP BANNER ==================== */

.tip-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  padding: 15px 22px;
  border-radius: 14px;
  margin-bottom: 20px;
  border-left: 4px solid #3b82f6;
  box-shadow:
    0 2px 10px rgba(59, 130, 246, 0.12),
    0 0 0 1px rgba(59,130,246,0.08);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tip-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, rgba(255,255,255,0.3) 80%, transparent 100%);
  animation: tipShimmer 3.5s ease-in-out infinite;
}

@keyframes tipShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.tip-banner:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.22);
  transform: translateY(-1px);
}

.tip-banner p {
  margin: 0;
  color: #1e40af;
  font-weight: 600;
  font-size: 0.95em;
}

/* ==================== APP FOOTER ==================== */

.app-footer {
  text-align: center;
  padding: 24px 20px;
  color: rgba(46, 16, 101, 0.55);
  font-size: 0.85em;
  font-weight: 500;
  border-top: 1px solid rgba(46, 16, 101, 0.08);
  margin-top: 10px;
  letter-spacing: 0.3px;
}

/* ==================== CONSENT MODAL ==================== */

#consent-modal {
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
}

#consent-modal.show {
  display: flex;
}

.consent-modal .consent-modal-content {
  background: white;
  border-radius: 24px;
  width: 92%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255,255,255,0.12);
  animation: modalBounceIn 0.42s cubic-bezier(0.34,1.56,0.64,1) both;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
.consent-modal-content::-webkit-scrollbar { width: 5px; }
.consent-modal-content::-webkit-scrollbar-track { background: #f5f3ff; border-radius: 10px; }
.consent-modal-content::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #7c3aed, #2e1065); border-radius: 10px; }

/* Header */
.consent-header {
  background: linear-gradient(135deg, #0f172a 0%, #2e1065 55%, #7c3aed 100%);
  color: white;
  padding: 28px 32px;
  border-radius: 24px 24px 0 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.consent-header-icon {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6em;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.consent-header h2 {
  font-size: 1.25em;
  font-weight: 800;
  margin-bottom: 4px;
  /* override section h2 gradient text */
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: white !important;
  background-clip: unset !important;
  color: white !important;
}

.consent-header p {
  font-size: 0.85em;
  opacity: 0.7;
  font-weight: 400;
  margin: 0;
}

/* Body */
.consent-body {
  padding: 28px 32px 24px;
  flex: 1;
}

.consent-intro {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1.5px solid #ddd6fe;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 0.92em;
  color: #3b0764;
  line-height: 1.65;
  margin-bottom: 24px;
}

/* Consent points */
.consent-points {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.consent-point {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.consent-point:hover {
  border-color: #ddd6fe;
  background: #fdfbff;
}

.consent-point-icon {
  font-size: 1.3em;
  flex-shrink: 0;
  margin-top: 1px;
}

.consent-point strong {
  display: block;
  font-size: 0.88em;
  font-weight: 700;
  color: #2e1065;
  margin-bottom: 4px;
}

.consent-point p {
  font-size: 0.83em;
  color: #6b7280;
  line-height: 1.55;
  margin: 0;
}

/* Checkbox row */
.consent-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  padding: 16px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 0.88em;
  color: #374151;
  line-height: 1.55;
  transition: all 0.25s ease;
  user-select: none;
}

.consent-checkbox-row:hover {
  border-color: #7c3aed;
  background: #fdf9ff;
}

.consent-checkbox-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.consent-checkbox-custom {
  width: 22px;
  height: 22px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}

.consent-checkbox-row input:checked ~ .consent-checkbox-custom {
  background: linear-gradient(135deg, #7c3aed, #2e1065);
  border-color: #7c3aed;
}

.consent-checkbox-row input:checked ~ .consent-checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 0.85em;
  font-weight: 800;
}

.consent-checkbox-row input:checked ~ span:last-child {
  color: #2e1065;
}

.consent-checkbox-row:has(input:checked) {
  border-color: #7c3aed;
  background: #fdf9ff;
}

/* Actions */
.consent-actions {
  display: flex;
  gap: 12px;
  padding: 20px 32px 28px;
  border-top: 1.5px solid #f0f0f0;
}

.consent-decline-btn {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid #e5e7eb;
  background: white;
  color: #6b7280;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92em;
  transition: all 0.25s ease;
  font-family: inherit;
}

.consent-decline-btn:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fff5f5;
}

.consent-accept-btn {
  flex: 2;
  padding: 14px 20px;
  border: none;
  background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92em;
  transition: all 0.3s ease;
  box-shadow: 0 6px 18px rgba(46, 16, 101, 0.3);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.consent-accept-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none !important;
}

.consent-accept-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(46, 16, 101, 0.45);
}

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

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

/* ── LARGE / DESKTOP (1200px+) ── */
@media (min-width: 1200px) {
  .container {
    max-width: 1100px;
  }
}

/* ── MEDIUM / TABLET (769px – 1024px) ── */
@media (max-width: 1024px) and (min-width: 769px) {
  .container {
    margin: 16px;
  }

  .content {
    padding: 28px 24px;
  }

  .section {
    padding: 28px 24px;
  }

  /* Auth */
  .auth-container {
    max-width: 500px;
  }

  /* Tabs */
  .tab-buttons {
    gap: 6px;
  }

  .tab-btn {
    padding: 12px 18px;
    font-size: 0.92em;
  }

  /* Patient cards */
  .patient-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Modals */
  .patient-detail-content {
    width: 96%;
    max-width: 860px;
  }

  /* Consent modal */
  .consent-modal .consent-modal-content {
    max-width: 520px;
  }

  /* Follow-up split */
  .followup-split-container {
    gap: 16px;
  }
}

/* ── TABLET & MOBILE (≤768px) ── */
@media (max-width: 768px) {

  /* ── Body & layout ── */
  body {
    padding: 0;
  }

  #app-screen {
    padding: 12px 8px;
  }

  .auth-container,
  .container {
    margin: 8px;
    border-radius: 16px;
  }

  /* ── App header ── */
  .header {
    padding: 28px 20px 24px;
  }

  .header h1 {
    font-size: 1.7em;
  }

  .header p {
    font-size: 0.95em;
  }

  .header-content {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }

  .logout-btn {
    align-self: center;
  }

  /* ── Content & sections ── */
  .content {
    padding: 20px 16px;
  }

  .section {
    padding: 20px 16px;
  }

  /* ── Tab navigation ── */
  .tab-buttons {
    flex-direction: column;
    gap: 6px;
  }

  .tab-btn {
    width: 100%;
    text-align: center;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: 0.95em;
  }

  /* ── Forms ── */
  .form-group {
    margin-bottom: 16px;
  }

  .form-group label {
    font-size: 0.88em;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  /* ── Buttons ── */
  .button-group {
    flex-direction: column;
    gap: 10px;
  }

  .button-group .btn,
  #analyze-btn,
  #save-patient-btn,
  #download-pdf-btn {
    width: 100%;
    min-width: unset;
    text-align: center;
  }

  /* ── Datasets ── */
  .dataset-buttons {
    grid-template-columns: 1fr;
  }

  .dataset-btn {
    min-width: 100%;
  }

  /* ── Analysis results ── */
  .result-main {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .score-badge {
    margin-left: 0;
    align-self: flex-end;
    min-width: 80px;
    font-size: 1.1em;
  }

  .symptom-scores-table {
    font-size: 0.85em;
  }

  .symptom-scores-table table th:nth-child(3),
  .symptom-scores-table table td:nth-child(3) {
    padding-right: 10px !important;
  }

  /* ── Patient cards ── */
  .patient-card {
    padding: 16px;
  }

  .patient-info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* ── Upgrade modal — tablet ── */
  .upgrade-modal-content {
    width: 98%;
    max-height: 92vh;
  }
  /* 2-col grid stays 2-col on tablet — no change needed */

  /* ── Patient detail modal ── */
  .modal-content,
  .patient-detail-content {
    width: 98%;
    max-height: 90vh;
    border-radius: 16px;
    margin: 10px auto;
  }

  #patient-detail-body {
    padding: 20px 16px;
  }

  .patient-detail-actions {
    flex-direction: column;
    gap: 8px;
    margin: 0 16px 20px;
  }

  .patient-detail-actions .btn {
    width: 100%;
    text-align: center;
  }

  /* ── Follow-up modal ── */
  .followup-split-container {
    flex-direction: column;
    gap: 16px;
  }

  /* ── Consent modal ── */
  .consent-modal .consent-modal-content {
    width: 98%;
    max-width: 100%;
    border-radius: 16px;
    max-height: 92vh;
  }

  .consent-header {
    padding: 20px;
    gap: 12px;
  }

  .consent-header-icon {
    width: 42px;
    height: 42px;
    font-size: 1.3em;
  }

  .consent-header h2 {
    font-size: 1.05em !important;
  }

  .consent-body {
    padding: 18px 16px 14px;
  }

  .consent-points {
    gap: 10px;
  }

  .consent-point {
    padding: 12px;
    gap: 10px;
  }

  .consent-actions {
    flex-direction: column-reverse;
    padding: 14px 16px 20px;
    gap: 10px;
  }

  .consent-decline-btn,
  .consent-accept-btn {
    width: 100%;
    text-align: center;
  }

  /* ── Tip banner ── */
  .tip-banner {
    font-size: 0.88em;
    padding: 12px 16px;
  }

  /* ── App footer ── */
  .app-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8em;
  }

  /* ── Auth screen ── */
  #auth-screen {
    padding: 20px 12px;
  }

  .auth-container {
    max-width: 100%;
  }

  .auth-header {
    padding: 30px 24px 26px;
  }

  .auth-header h1 {
    font-size: 1.8em;
  }

  .auth-content {
    padding: 28px 24px 28px;
  }
}

/* ── SMALL MOBILE (≤480px) ── */
@media (max-width: 480px) {

  body {
    font-size: 14px;
  }

  #app-screen {
    padding: 8px 4px;
  }

  .container,
  .auth-container {
    margin: 4px;
    border-radius: 12px;
  }

  /* ── Header ── */
  .header {
    padding: 22px 16px 20px;
  }

  .header h1 {
    font-size: 1.45em;
  }

  .header p {
    font-size: 0.88em;
  }

  /* ── Content ── */
  .content {
    padding: 16px 12px;
  }

  .section {
    padding: 16px 12px;
  }

  .section h2 {
    font-size: 1.1em;
  }

  /* ── Tab buttons ── */
  .tab-btn {
    padding: 12px;
    font-size: 0.88em;
  }

  /* ── Patient info grid — single column on tiny screens ── */
  .patient-info-grid {
    grid-template-columns: 1fr;
  }

  /* ── Analysis result score badge ── */
  .score-badge {
    font-size: 1em;
    min-width: 70px;
    padding: 8px 12px;
  }

  /* ── Upgrade modal — mobile (centred, not bottom-sheet) ── */
  .upgrade-modal-content {
    width: 96%;
    max-height: 90vh;
    border-radius: 16px;
    position: relative;
    bottom: auto;
    left: auto;
  }
  .upgrade-plan-cards-2 {
    grid-template-columns: 1fr;   /* stack cards on tiny screens */
  }
  .upgrade-modal-body {
    padding: 18px 16px 20px;
  }

  /* ── Modal ── */
  .modal-content,
  .patient-detail-content {
    width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 94vh;
    position: fixed;
    bottom: 0;
    left: 0;
    margin: 0;
  }

  #patient-detail-body {
    padding: 16px 14px;
  }

  /* ── Consent modal — bottom sheet on tiny screens ── */
  .consent-modal .consent-modal-content {
    width: 100%;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    max-height: 96vh;
  }

  .consent-header {
    padding: 18px 16px;
    border-radius: 20px 20px 0 0;
  }

  .consent-body {
    padding: 14px 14px 10px;
  }

  .consent-intro {
    font-size: 0.85em;
    padding: 12px 14px;
  }

  .consent-point strong {
    font-size: 0.85em;
  }

  .consent-point p {
    font-size: 0.8em;
  }

  .consent-actions {
    padding: 12px 14px 24px;
  }

  /* ── Auth ── */
  .auth-header {
    padding: 24px 18px 20px;
  }

  .auth-header h1 {
    font-size: 1.55em;
  }

  .auth-content {
    padding: 22px 18px 24px;
  }

  /* ── Symptom table — hide less important columns ── */
  .symptom-scores-table table th:nth-child(3),
  .symptom-scores-table table td:nth-child(3) {
    display: none;
  }

  /* ── Search bar ── */
  .search-input {
    font-size: 0.9em;
  }

  /* ── Tip banner ── */
  .tip-banner {
    font-size: 0.82em;
  }
}

/* ==================== PRINT STYLES ==================== */

@media print {
  body::before {
    display: none;
  }

  .symptom-scores-table {
    max-height: none;
    overflow: visible;
  }

  .expand-arrow {
    display: none;
  }

  .symptom-details {
    display: block !important;
  }

  .logout-btn,
  .action-btn {
    display: none;
  }
}

/* ==================== ACCESSIBILITY ==================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  .symptom-scores-table table th,
  .symptom-scores-table table td {
    border: 1px solid black;
  }

  .section {
    border: 2px solid #2e1065;
  }
}

@media (prefers-color-scheme: dark) {
  .symptom-scores-table {
    background: #1a1a2e;
    border-color: #4a4a6a;
  }

  .symptom-scores-table table th {
    background: linear-gradient(135deg, #1e0a47 0%, #3b0c79 100%) !important;
    color: white !important;
  }

  .symptom-scores-table table td {
    color: #e0e0e0;
    border-bottom-color: #4a4a6a;
  }

  .symptom-scores-table table tr:hover {
    background: #2a2a4e !important;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 3px solid #7c3aed;
  outline-offset: 2px;
}

/* ============================================================ */
/*                  PLAN / TIER SYSTEM STYLES                   */
/* ============================================================ */

/* ── Locked dataset button ───────────────────────────────────── */
.dataset-btn.plan-locked {
  position: relative;
  opacity: 0.75;
  cursor: pointer;
  border-style: dashed !important;
}

.dataset-btn.plan-locked:hover {
  opacity: 1;
  border-color: #7c3aed !important;
}

/* Badge shown on locked buttons (e.g. "⭐ Pro") */
.plan-lock-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 0.72em;
  font-weight: 700;
  background: #ede9fe;
  color: #7c3aed;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Upgrade modal ───────────────────────────────────────────── */
.upgrade-modal-content {
  max-width: 820px;        /* wide enough for 3 cards side-by-side */
  width: 95%;
  border-radius: 20px;
  overflow: hidden;
  max-height: 92vh;        /* never taller than the viewport */
  display: flex;
  flex-direction: column;
  padding: 0;
}

.upgrade-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 28px 18px;
  background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 100%);
  color: white;
  position: relative;
}

.upgrade-modal-icon {
  font-size: 1.8em;
  line-height: 1;
}

.upgrade-modal-header h2 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 700;
  flex: 1;
  color: white;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close-btn:hover {
  background: rgba(255,255,255,0.4);
}

.upgrade-modal-body {
  padding: 24px 28px 28px;
  overflow-y: auto;        /* scroll when content is taller than viewport */
  flex: 1;                 /* fill remaining height inside the flex column */
}

/* Scrollbar for upgrade modal body */
.upgrade-modal-body::-webkit-scrollbar { width: 6px; }
.upgrade-modal-body::-webkit-scrollbar-track { background: #f0f0f8; border-radius: 10px; }
.upgrade-modal-body::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #2e1065, #7c3aed); border-radius: 10px; }
.upgrade-modal-body::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #1e0a47, #5b21b6); }

.upgrade-modal-msg {
  font-size: 1.05em;
  margin: 0 0 6px;
  color: #1f2937;
}

.upgrade-modal-current {
  font-size: 0.9em;
  color: #6b7280;
  margin: 0 0 20px;
}

.upgrade-current-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.95em;
  background: #f3f4f6;
  color: #374151;
  margin-left: 4px;
}

/* ── Plan comparison cards (3-tier: Free / Premium / Advanced) ── */
/* Pricing: Free ₹0 | Premium ₹10,999 Lifetime | Advanced ₹24,999 Lifetime */

.upgrade-plan-cards-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  overflow: visible;       /* let .upc-badge (position:absolute, top:-12px) show */
}

@media (max-width: 500px) {
  .upgrade-plan-cards-2 {
    grid-template-columns: 1fr;   /* stack on small mobile */
  }
}

.upgrade-plan-card {
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 24px 16px 20px;  /* extra top for the badge */
  position: relative;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  overflow: visible;         /* badge sits above card top edge */
  transition: box-shadow 0.2s, border-color 0.2s;
}

.upgrade-plan-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* Premium — most popular */
.upgrade-plan-premium {
  border-color: #7c3aed;
  background: #faf5ff;
}

.upgrade-plan-premium.upc-featured {
  box-shadow: 0 0 0 2px #7c3aed, 0 8px 24px rgba(124,58,237,0.15);
}

/* Advanced — top tier */
.upgrade-plan-advanced {
  border-color: #0369a1;
  background: #f0f9ff;
}

.upc-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  font-size: 0.72em;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.upgrade-plan-advanced .upc-badge {
  background: linear-gradient(135deg, #0369a1, #0284c7);
}

.upc-name {
  font-weight: 700;
  font-size: 1.05em;
  margin: 8px 0 4px;
  color: #111827;
  text-align: center;
}

/* Price display */
.upc-price {
  font-size: 1.35em;
  font-weight: 700;
  color: #111827;
  text-align: center;
  margin: 4px 0 2px;
}

.upc-price span {
  font-size: 0.6em;
  font-weight: 400;
  color: #6b7280;
}

.upc-original {
  font-size: 0.78em;
  color: #9ca3af;
  text-decoration: line-through;
  text-align: center;
  opacity: 0.8;
  margin-bottom: 2px;
}

.upc-discount {
  display: block;
  width: fit-content;
  margin: 4px auto 10px;
  padding: 2px 10px;
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #059669;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 20px;
  text-align: center;
}

.upc-features {
  list-style: none;
  padding: 0;
  margin: 12px 0 16px;
  font-size: 0.83em;
  color: #374151;
  line-height: 1.75;
  flex: 1;
}

.upc-features li {
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 3px 0;
}

.upc-features li.upc-locked {
  color: #9ca3af;
}

.upc-cta {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88em;
  cursor: pointer;
  margin-top: auto;
  transition: opacity 0.2s, transform 0.1s;
}

.upc-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.upc-cta-premium {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
}

.upc-cta-advanced {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  color: white;
}

.upgrade-modal-note {
  text-align: center;
  font-size: 0.82em;
  color: #9ca3af;
  margin: 0;
}

/* ── Dark mode adjustments ───────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .upgrade-modal-body {
    background: #1a1a2e;
  }
  .upgrade-modal-msg { color: #e5e7eb; }
  .upgrade-plan-card {
    background: #252540;
    border-color: #3f3f6a;
  }
  .upgrade-plan-premium {
    background: #1e1040;
    border-color: #7c3aed;
  }
  .upgrade-plan-advanced {
    background: #0c1a2e;
    border-color: #0369a1;
  }
  .upc-name  { color: #f9fafb; }
  .upc-price { color: #f9fafb; }
  .upc-features { color: #d1d5db; }
  .upc-features li { border-bottom-color: rgba(255,255,255,0.06); }
  .upc-features li.upc-locked { color: #6b7280; }
  .upgrade-modal-current { color: #9ca3af; }
  .upgrade-current-badge { background: #374151; color: #d1d5db; }
  .plan-lock-badge { background: #2d1b69; color: #c4b5fd; }
}
