/* ============================================
   HOSPITAL MANAGEMENT SYSTEM - DESIGN SYSTEM
   ============================================ */

/* Import Modern Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

/* ============================================
   CSS VARIABLES & DESIGN TOKENS
   ============================================ */
:root {
  /* Color Palette - Medical Theme */
  --primary-hue: 200;
  --primary-50: hsl(var(--primary-hue), 95%, 95%);
  --primary-100: hsl(var(--primary-hue), 90%, 88%);
  --primary-200: hsl(var(--primary-hue), 85%, 75%);
  --primary-300: hsl(var(--primary-hue), 80%, 65%);
  --primary-400: hsl(var(--primary-hue), 75%, 55%);
  --primary-500: hsl(var(--primary-hue), 70%, 45%);
  --primary-600: hsl(var(--primary-hue), 65%, 38%);
  --primary-700: hsl(var(--primary-hue), 60%, 30%);
  --primary-800: hsl(var(--primary-hue), 55%, 22%);
  --primary-900: hsl(var(--primary-hue), 50%, 15%);

  /* Accent Colors */
  --accent-teal: hsl(180, 70%, 50%);
  --accent-green: hsl(145, 70%, 50%);
  --accent-orange: hsl(25, 85%, 60%);
  --accent-purple: hsl(270, 70%, 60%);

  /* Neutral Colors */
  --white: hsl(0, 0%, 100%);
  --gray-50: hsl(210, 20%, 98%);
  --gray-100: hsl(210, 20%, 95%);
  --gray-200: hsl(210, 20%, 90%);
  --gray-300: hsl(210, 15%, 80%);
  --gray-400: hsl(210, 12%, 65%);
  --gray-500: hsl(210, 10%, 50%);
  --gray-600: hsl(210, 12%, 40%);
  --gray-700: hsl(210, 15%, 30%);
  --gray-800: hsl(210, 18%, 20%);
  --gray-900: hsl(210, 20%, 12%);

  /* Semantic Colors */
  --success: hsl(145, 70%, 50%);
  --warning: hsl(45, 95%, 55%);
  --error: hsl(0, 75%, 60%);
  --info: hsl(200, 75%, 55%);

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-loader: 9999;
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loader);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--primary-100);
  border-top: 5px solid var(--primary-600);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

.loader-text {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--primary-700);
  font-size: var(--text-lg);
  letter-spacing: 0.5px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}


/* ============================================
   RESET & BASE STYLES
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--gray-800);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-4);
  }
}

.header {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-500) 50%, var(--accent-teal) 100%);
  color: var(--white);
  padding: var(--space-16) var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-xl);
  position: relative;
  /* overflow: hidden; REMOVED to allow dropdown to spill */
  z-index: 50;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  border-radius: inherit;
}

.header-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
  animation: slideBackground 20s linear infinite;
}

@keyframes slideBackground {
  0% {
    transform: translateX(0) translateY(0);
  }

  100% {
    transform: translateX(40px) translateY(40px);
  }
}

.header-content {
  position: relative;
  z-index: 1;
}

.hospital-name {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: fadeInDown 0.8s ease-out;
}

@media (max-width: 768px) {
  .hospital-name {
    font-size: var(--text-3xl);
  }

  .hospital-tagline {
    font-size: var(--text-lg);
  }
}

.hospital-tagline {
  font-size: var(--text-xl);
  font-weight: 300;
  opacity: 0.95;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   MODULE CARDS
   ============================================ */
.modules-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-8);
  padding: var(--space-12) 0;
  animation: fadeIn 0.8s ease-out 0.4s both;
}

@media (max-width: 640px) {
  .modules-container {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-6) 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.module-card {
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-teal));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.module-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-2xl);
  border-color: var(--primary-200);
}

.module-card:hover::before {
  transform: scaleX(1);
}

.module-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  margin-bottom: var(--space-5);
  transition: transform var(--transition-base);
}

.module-card:hover .module-icon {
  transform: scale(1.1) rotate(5deg);
}

.module-card.registration .module-icon {
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.module-card.consultation .module-icon {
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-green));
  box-shadow: 0 8px 16px rgba(20, 184, 166, 0.3);
}

.module-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-3);
}

.module-description {
  font-size: var(--text-sm);
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

.module-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: var(--white);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.module-button:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  box-shadow: var(--shadow-lg);
  transform: translateX(4px);
}

.module-button:active {
  transform: translateX(4px) scale(0.98);
}

/* ============================================
   FORM MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: var(--space-4);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-base);
  position: relative;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: var(--white);
  padding: var(--space-8);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  position: relative;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin: 0;
}

.modal-close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--white);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  font-size: var(--text-2xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: var(--space-8);
}

/* ============================================
   FORM COMPONENTS
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-label .required {
  color: var(--error);
}

.form-input,
.form-select,
.form-textarea {
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--white);
  transition: all var(--transition-fast);
  outline: none;
  box-sizing: border-box;
  /* Global Fix */
  width: 100%;
  /* Ensure width control */
  max-width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--gray-400);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-primary);
}

.radio-group {
  display: flex;
  gap: var(--space-6);
  padding: var(--space-2) 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-700);
  transition: color var(--transition-fast);
}

.radio-label:hover {
  color: var(--primary-600);
}

.radio-label input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-500);
}

/* Phone Input with Country Code */
.phone-input-wrapper {
  display: flex;
  align-items: center;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-fast);
  background: var(--white);
}

.phone-input-wrapper:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.phone-prefix {
  padding: var(--space-3) var(--space-4);
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 600;
  font-size: var(--text-sm);
  border-right: 2px solid var(--gray-200);
  white-space: nowrap;
  user-select: none;
}

.phone-input {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex: 1;
}

.phone-input:focus {
  border: none !important;
  box-shadow: none !important;
}

/* ============================================
   BUTTONS
   ============================================ */
.button-group {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-200);
}

.btn {
  padding: var(--space-4) var(--space-8);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: var(--white);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
  box-shadow: var(--shadow-md);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================
   SUCCESS MESSAGE
   ============================================ */
.success-message {
  background: linear-gradient(135deg, var(--success), hsl(145, 70%, 45%));
  color: var(--white);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  display: none;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  animation: slideInDown 0.4s ease-out;
}

.success-message.show {
  display: flex;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-message .icon {
  font-size: var(--text-2xl);
}

/* ============================================
   PATIENT INFO CARD
   ============================================ */
.patient-info-card {
  background: linear-gradient(135deg, var(--primary-50), var(--accent-teal) 0%, var(--primary-100) 100%);
  border: 2px solid var(--primary-200);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-top: var(--space-4);
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease-out;
}

.patient-info-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--primary-700);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--primary-200);
}

.patient-info-details {
  display: grid;
  gap: var(--space-3);
}

.patient-info-details p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.patient-info-details strong {
  color: var(--primary-700);
  min-width: 80px;
  font-weight: 600;
}

.patient-info-details span {
  color: var(--gray-800);
  font-weight: 500;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
/* Responsive styles moved to the end of file for better cascade management */

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-400);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-500);
}

/* Floats & Utilities */
.admin-float-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--white);
  color: var(--gray-700);
  padding: 12px 20px;
  border-radius: 50px;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  border: 1px solid var(--gray-200);
  transition: all var(--transition-fast);
}

.admin-float-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  color: var(--primary-600);
  border-color: var(--primary-200);
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.badge-care-prof {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-front-desk {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Tab Buttons */
.tab-btn {
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: #f8fafc !important;
}

/* Custom Dialog / Popup */
.custom-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  /* Dim backdrop */
  display: flex;
  align-items: flex-start;
  /* Chrome style usually top-centerish or center */
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding-top: 50px;
}

.custom-confirm-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.custom-confirm-box {
  background: var(--white);
  color: var(--gray-800);
  padding: 24px;
  border-radius: var(--radius-xl);
  width: 400px;
  max-width: 90%;
  box-shadow: var(--shadow-2xl);
  font-family: var(--font-primary);
  border: 1px solid var(--gray-100);
}

.confirm-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary-700);
}

.confirm-msg {
  font-size: var(--text-base);
  color: var(--gray-600);
  margin-bottom: 24px;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-confirm {
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  min-width: 90px;
  transition: all var(--transition-base);
}

.btn-confirm-cancel {
  background: var(--gray-100);
  color: var(--gray-600);
}

.btn-confirm-cancel:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-confirm-ok {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-confirm-ok:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Styled Input for Custom Prompt */
.confirm-input {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  margin-bottom: 24px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  color: var(--gray-800);
  font-size: 16px;
  outline: none;
  font-family: inherit;
  display: none;
  /* Hidden by default */
  box-sizing: border-box;
  transition: all var(--transition-fast);
}

.confirm-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Medication Section Styles */
.medication-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-top: 8px;
  width: 100%;
  overflow: hidden;
  /* Prevent internal overflow from breaking the box */
}

.medication-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 25px;
  padding-bottom: 25px;
  border-bottom: 1px solid #f1f5f9;
}

.med-row {
  display: grid;
  gap: 1rem;
  align-items: start;
}

/* Specific Row Layouts */
.medication-inputs .med-row:nth-child(1) {
  grid-template-columns: 1fr 140px;
}

.medication-inputs .med-row:nth-child(2) {
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
}

.medication-inputs .med-row:nth-child(3) {
  grid-template-columns: 1fr;
}

.dosage-triple-container {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.dosage-triple-container span {
  flex-shrink: 0;
  font-weight: bold;
}

.dosage-mini {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 8px 4px !important;
}

.medication-card .form-input,
.medication-card .form-select {
  width: 100%;
}

.med-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  /* Allow grid items to shrink below content size */
}

.med-actions {
  display: flex !important;
  /* Ensure it uses flex even with med-row class */
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

/* Added table responsive helper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
}

.med-list-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--primary-700);
  margin-bottom: 15px;
  font-family: var(--font-display);
}

.med-table {
  width: 100%;
  min-width: 600px;
  /* Ensure table has enough space even when scrolled */
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.med-table th {
  background: #f8fafc;
  padding: 12px;
  text-align: left;
  color: var(--gray-600);
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
}

.med-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--gray-700);
}

.med-table tr:hover {
  background: #f8fafc;
}

.btn-remove {
  color: var(--error);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.btn-remove:hover {
  background: #fee2e2;
}

/* ============================================
   RESPONSIVE LAYOUT CLASSES
   ============================================ */
.app-header {
  background: white;
  padding: 15px 30px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
}

.app-sidebar {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

.app-content {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 30px;
  height: calc(100vh - 100px);
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 300px 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 10px 15px;
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .app-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .app-sidebar {
    height: auto;
    max-height: 400px;
  }

  .app-content {
    height: auto;
    padding: 20px;
    overflow-y: initial;
  }
}

/* Modal Responsiveness */
@media (max-width: 640px) {
  .modal {
    width: 95%;
    margin: 10px;
  }

  .modal-body {
    padding: var(--space-4);
  }

  .modal-header {
    padding: var(--space-4);
  }
}

@media (max-width: 992px) {

  .medication-inputs .med-row:nth-child(1),
  .medication-inputs .med-row:nth-child(2) {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {

  .medication-inputs .med-row:nth-child(1),
  .medication-inputs .med-row:nth-child(2) {
    grid-template-columns: 1fr;
  }

  .med-actions {
    flex-direction: column-reverse;
  }

  .med-actions button {
    width: 100%;
  }
}

/* ============================================
   USER PROFILE DROPDOWN
   ============================================ */
.user-profile-widget {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast);
  user-select: none;
}

.user-profile-widget:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--white);
  color: var(--primary-600);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-sm);
}

.user-info {
  display: flex;
  flex-direction: column;
  color: var(--white);
}

.user-name {
  font-weight: 600;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.user-role {
  font-size: var(--text-xs);
  opacity: 0.8;
  font-weight: 400;
}

.dropdown-arrow {
  font-size: 0.8em;
  transition: transform var(--transition-fast);
}

.user-profile-widget.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 200px;
  padding: var(--space-2);
  display: none;
  z-index: var(--z-dropdown);
  border: 1px solid var(--gray-200);
  animation: dropdownFadeIn 0.2s ease-out;
}

.user-profile-widget.active .dropdown-menu {
  display: block;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--gray-100);
  color: var(--primary-700);
}

.dropdown-item.logout {
  color: var(--error);
  border-top: 1px solid var(--gray-100);
  margin-top: var(--space-2);
}

.dropdown-item.logout:hover {
  background: #fef2f2;
}

.dropdown-icon {
  width: 18px;
  text-align: center;
  font-size: 1.1em;
}