/* Medical Patient Dashboard Styles */

/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Medical Theme: Maroon, White, Red Color Palette */
  --primary-maroon: #800020;      /* Deep maroon */
  --primary-maroon-light: #A0522D;  /* Light maroon */
  --primary-maroon-dark: #5C0012;   /* Dark maroon */
  --primary-maroon-bg: #F5DEB3;    /* Wheat background */

  /* Accent Red */
  --accent-red: #DC143C;           /* Crimson red */
  --accent-red-light: #FF6B6B;     /* Light red */
  --accent-red-dark: #8B0000;      /* Dark red */

  /* Colors */
  --primary: var(--primary-maroon);
  --primary-dark: var(--primary-maroon-dark);
  --primary-light: var(--primary-maroon-light);
  --secondary: var(--accent-red);
  --success: #28A745;              /* Medical green */
  --error: #DC3545;                /* Medical red */
  --warning: #B22222;              /* Firebrick red - warnings (NOT YELLOW) */
  --info: #17A2B8;                 /* Medical blue */

  /* Neutrals */
  --background: #FFFFFF;           /* Pure white */
  --surface: #F8F9FA;              /* Light gray - no yellow */
  --surface-alt: #F8F9FA;          /* Very light gray */
  --text-primary: #212529;         /* Dark text */
  --text-secondary: #6C757D;       /* Medium gray */
  --text-light: #868E96;           /* Light gray */
  --divider: #DEE2E6;              /* Light border */
  --border-medium: #CED4DA;        /* Medium border */

  /* Spacing - Enhanced for Medical Theme */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 64px;

  /* Typography - Medical Theme */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  --font-size-4xl: 36px;

  /* Borders - Enhanced */
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  --border-radius-2xl: 24px;
  --border-width: 1px;
  --border-width-thick: 2px;

  /* Shadows - Enhanced for Medical Theme */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.19);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  --shadow-medical: 0 8px 16px rgba(128, 0, 32, 0.15); /* Maroon-tinted shadow */

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Medical Theme Button Styles */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--border-radius);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

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

/* Primary Button - Maroon Theme */
.btn-primary {
  background-color: var(--primary);
  color: white;
  border: var(--border-width-thick) solid var(--primary);
  box-shadow: var(--shadow-sm);
}

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

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

/* Secondary Button - Light Maroon/White Theme */
.btn-secondary {
  background-color: var(--surface);
  color: var(--primary);
  border: var(--border-width-thick) solid var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-medical);
  transform: translateY(-1px);
}

/* Accent Button - Red Theme */
.btn-accent {
  background-color: var(--accent-red);
  color: white;
  border: var(--border-width-thick) solid var(--accent-red);
}

.btn-accent:hover {
  background-color: var(--accent-red-dark);
  border-color: var(--accent-red-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Success Button - Medical Green */
.btn-success {
  background-color: var(--success);
  color: white;
  border: var(--border-width-thick) solid var(--success);
}

.btn-success:hover {
  background-color: #1e7e34;
  border-color: #1e7e34;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Danger Button - Medical Red */
.btn-danger {
  background-color: var(--error);
  color: white;
  border: var(--border-width-thick) solid var(--error);
}

.btn-danger:hover {
  background-color: #bd2130;
  border-color: #bd2130;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Warning Button - Medical Red */
.btn-warning {
  background-color: var(--warning);
  color: var(--text-primary);
  border: var(--border-width-thick) solid var(--warning);
}

.btn-warning:hover {
  background-color: #8B0000;
  border-color: #8B0000;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Outline Button Variations */
.btn-outline {
  background-color: transparent;
  border: var(--border-width-thick) solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-sm);
  border-radius: var(--border-radius-sm);
}

.btn-md {
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: var(--font-size-base);
  border-radius: var(--border-radius);
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-2xl);
  font-size: var(--font-size-lg);
  border-radius: var(--border-radius-lg);
}

.btn-xl {
  padding: var(--spacing-lg) var(--spacing-3xl);
  font-size: var(--font-size-xl);
  border-radius: var(--border-radius-xl);
  font-weight: 700;
}

/* Loading State */
.btn.loading {
  pointer-events: none;
  position: relative;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: btn-spinner 0.8s linear infinite;
}

@keyframes btn-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Layout Components */
.page-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  flex: 1;
}

/* Navigation */
.navbar {
  background-color: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  text-decoration: none;
  color: white;
}

.logo-text {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: var(--spacing-lg);
  margin: 0;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius);
  transition: background-color 0.2s;
}

.nav-link:hover {
  background-color: var(--primary-dark);
}

.nav-link.active {
  background-color: var(--primary-dark);
  font-weight: 600;
}

/* Footer */
.page-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--divider);
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.footer-content a {
  color: var(--primary);
  text-decoration: none;
}

.footer-content a:hover {
  text-decoration: underline;
}

/* Loading Spinner */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  gap: var(--spacing-md);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--divider);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: var(--text-secondary);
}

/* Alert Messages */
.alert {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-md);
}

.alert-icon {
  font-size: var(--font-size-lg);
  font-weight: bold;
}

.alert-success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid var(--success);
}

.alert-error {
  background-color: #ffebee;
  color: #c62828;
  border-left: 4px solid var(--error);
}

.alert-warning {
  background-color: #fff3e0;
  color: #e65100;
  border-left: 4px solid var(--warning);
}

.alert-info {
  background-color: #e3f2fd;
  color: #1565c0;
  border-left: 4px solid var(--info);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .nav-list {
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
  }

  .nav-link {
    display: block;
    text-align: center;
  }

  .container {
    padding: var(--spacing-md);
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Expandable Instructions Styles */
.instructions-expandable {
  margin: 1.5rem 0;
}

.instructions-toggle-btn {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 500;
  color: #495057;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.instructions-toggle-btn:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.instructions-toggle-btn:active {
  background-color: #dee2e6;
}

.instructions-toggle-btn.active {
  background-color: #e7f3ff;
  border-color: #4dabf7;
  color: #1971c2;
}

.button-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.instructions-content {
  margin-top: 1rem;
  padding: 1.25rem;
  background-color: #f8f9fa;
  border-left: 4px solid #4dabf7;
  border-radius: 4px;
  animation: slideDown 0.2s ease-out;
}

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

.instructions-title {
  font-size: 16px;
  font-weight: 600;
  color: #343a40;
  margin-bottom: 0.75rem;
}

.instructions-list {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.instructions-list li {
  margin-bottom: 0.5rem;
  color: #495057;
  line-height: 1.5;
}

.instructions-list li:last-child {
  margin-bottom: 0;
}

.instructions-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #dee2e6;
}

/* Video Tab Styles */
.video-tab-content {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #fff;
  border-radius: 8px;
  min-height: 400px;
  height: 100%;
  flex: 1;
}

.video-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #343a40;
  margin-bottom: 8px;
}

.video-description {
  color: #666;
  margin-bottom: 20px;
}

.video-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

.video-container {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 300px;
}

.video-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.video-embed-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #000;
  overflow: hidden;
}

.video-embed-container iframe {
  width: 100%;
  height: 100%;
  flex: 1;
  border: none;
}

.video-content video,
.video-list video {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-player-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.youtube-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.youtube-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.no-video-placeholder {
  text-align: center;
  padding: 60px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
}

.no-video-icon {
  opacity: 0.5;
}

.no-video-title {
  font-size: 1.2rem;
  color: #6c757d;
  margin-bottom: 10px;
}

.no-video-desc {
  color: #868e96;
  font-size: 0.9rem;
}

.video-grid {
  display: grid;
  gap: 20px;
}

.video-item {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  transition: box-shadow 0.2s ease;
}

.video-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.video-item h4 {
  margin: 0 0 15px 0;
  color: #343a40;
  font-size: 1.1rem;
}

.video-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #800020;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px auto;
}

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