/* css/components.css - Reusable UI Elements */

/* 1. RESET & BASE */
body {
  font-family: var(--font-main);
  color: var(--color-text-main);
  background-color: var(--color-bg-app);
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-primary);
  margin-top: 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--color-primary-light);
  text-decoration: underline;
}

/* 2. CARDS */
.tvc-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.tvc-card-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tvc-card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-main);
}

/* 3. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none; /* Reset link styles */
  gap: 8px;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-primary-light);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background-color: white;
  border-color: var(--color-border);
  color: var(--color-text-main);
}

.btn-secondary:hover {
  background-color: #f8f9fa;
  border-color: #c6c7c8;
}

.btn-danger {
  background-color: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #bd2130;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-light);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text-main);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.85rem;
}

.btn-icon {
  padding: 8px;
  border-radius: 50%;
}

/* 4. BADGES */
.badge {
  display: inline-block;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 10rem; /* Pill shape */
}

.badge-primary {
  background-color: #fce4ec;
  color: var(--color-primary);
  border: 1px solid #f8bbd0;
}
.badge-success {
  background-color: var(--color-success-bg);
  color: #155724;
  border: 1px solid #c3e6cb;
}
.badge-warning {
  background-color: var(--color-warning-bg);
  color: #856404;
  border: 1px solid #ffeeba;
}
.badge-danger {
  background-color: var(--color-danger-bg);
  color: #721c24;
  border: 1px solid #f5c6cb;
}
.badge-info {
  background-color: var(--color-info-bg);
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* 5. FORMS */
.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text-main);
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-primary-light);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(134, 38, 51, 0.25);
}

/* 6. UTILITIES */
.text-muted {
  color: var(--color-text-light) !important;
}
.text-center {
  text-align: center !important;
}
.mt-1 {
  margin-top: 0.25rem !important;
}
.mt-2 {
  margin-top: 0.5rem !important;
}
.mt-3 {
  margin-top: 1rem !important;
}
.mb-1 {
  margin-bottom: 0.25rem !important;
}
.mb-2 {
  margin-bottom: 0.5rem !important;
}
.mb-3 {
  margin-bottom: 1rem !important;
}

/* Flex Utilities */
.d-flex {
  display: flex !important;
}
.flex-column {
  flex-direction: column !important;
}
.align-items-center {
  align-items: center !important;
}
.justify-content-between {
  justify-content: space-between !important;
}
.w-100 {
  width: 100% !important;
}
.gap-1 {
  gap: 0.5rem;
}
.gap-2 {
  gap: 1rem;
}

/* 7. GRID LAYOUTS */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}

/* 8. HOVER EFFECTS */
.hover-lift {
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-float);
}

/* 9. ADDITIONAL BUTTON VARIANTS */
.btn-outline {
  background: transparent;
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.btn-success {
  background-color: var(--color-success);
  color: white;
}

.btn-success:hover {
  background-color: var(--color-success-dark);
}

/* 10. PAGE HEADERS */
.page-header h2 {
  margin: 0 0 8px 0;
  color: var(--color-primary);
}

.page-header p {
  margin: 0;
}

/* 11. SECTION SPACING */
.mb-5 {
  margin-bottom: 2.5rem !important;
}
.mb-4 {
  margin-bottom: 1.5rem !important;
}
.mt-4 {
  margin-top: 1.5rem !important;
}
.mt-5 {
  margin-top: 2.5rem !important;
}
.p-3 {
  padding: 1rem !important;
}
.p-4 {
  padding: 1.5rem !important;
}

/* 12. CARD TITLE VARIANTS */
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 8px;
}

.card-text {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ========================================
   13. NAVIGATION BAR (Standalone Pages)
   ======================================== */
.top-nav {
  background: var(--color-bg-white);
  height: var(--header-height);
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-card);
  border-bottom: 3px solid var(--color-primary);
  z-index: 100;
}

.nav-brand {
  font-size: 1.4em;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-brand img {
  height: 35px;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 0.9em;
  font-weight: 600;
}

.nav-link {
  text-decoration: none;
  color: var(--color-text-light);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--border-radius);
}

.nav-link:hover {
  background: #f8f9fa;
  color: var(--color-primary);
  text-decoration: none;
}

.nav-link.admin {
  background: #e3f2fd;
  color: #0d47a1;
}

.nav-link.faculty {
  background: #fff3e0;
  color: #e65100;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  padding: 6px 15px;
  border-radius: 20px;
  border: 1px solid #e9ecef;
  color: var(--color-text-main);
  font-weight: 700;
  font-size: 0.9em;
}

/* ========================================
   14. HERO BANNER
   ======================================== */
.hero-banner {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  color: white;
  padding: 40px 60px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-banner h1 {
  margin: 0;
  font-size: 2em;
  font-weight: 700;
}

.hero-banner p {
  margin: 5px 0 0;
  opacity: 0.9;
  font-size: 1.1em;
}

.search-box {
  position: relative;
  width: 350px;
}

.search-input {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 30px;
  font-size: 1em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  outline: none;
}

.search-input:focus {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ========================================
   15. CASE CARDS (Dashboard Grid)
   ======================================== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
  padding: 0 60px 60px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.case-card {
  background: var(--color-bg-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

.case-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-float);
  border-color: var(--color-primary);
}

.card-head {
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  gap: 15px;
  align-items: center;
}

.avatar {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  background: #eee;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ========================================
   16. STATUS PILLS & PROGRESS BARS
   ======================================== */
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 15px;
  align-self: flex-start;
}

.st-new {
  background: #e9ecef;
  color: #495057;
}

.st-active {
  background: #e3f2fd;
  color: #0d47a1;
}

.st-done {
  background: #d1fae5;
  color: #065f46;
}

.progress-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.5s;
}

.progress-fill.complete {
  background: var(--color-success);
}

/* ========================================
   17. LOGIN PAGE COMPONENTS
   ======================================== */
.login-card {
  background: var(--color-bg-white);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-float);
  width: 360px;
  text-align: center;
  border-top: 5px solid var(--color-primary);
}

.login-card .brand {
  color: var(--color-primary);
  font-weight: 800;
  font-size: 1.8em;
  margin: 10px 0 5px;
}

.login-card .sub {
  color: var(--color-text-light);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 30px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-label {
  display: block;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-size: 1em;
  box-sizing: border-box;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--color-primary);
  outline: none;
  background: #fffcfc;
}

.btn-submit {
  width: 100%;
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px;
  font-weight: 700;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1em;
  transition: var(--transition-fast);
}

.btn-submit:hover {
  background: var(--color-primary-dark);
}

.err-box {
  background: var(--color-danger-bg);
  color: var(--color-danger-dark);
  padding: 10px;
  border-radius: var(--border-radius);
  font-size: 0.9em;
  margin-bottom: 20px;
  border: 1px solid var(--color-danger);
}

.logo {
  height: 60px;
  opacity: 0.9;
}

/* ========================================
   18. CENTERED LAYOUT (For Login/Special Pages)
   ======================================== */
.centered-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

/* ========================================
   19. EMR WORKSPACE COMPONENTS
   ======================================== */
.emr-header {
  height: var(--header-height);
  background: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
  justify-content: space-between;
  z-index: 20;
}

.pt-profile {
  display: flex;
  align-items: center;
  gap: 15px;
}

.pt-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pt-info-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pt-name {
  font-weight: 800;
  font-size: 1.25em;
  color: var(--color-text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.pt-meta {
  font-size: 0.85em;
  color: var(--color-text-light);
  font-weight: 500;
  margin-top: 3px;
}

.pt-meta span {
  margin-right: 8px;
  padding-right: 8px;
  border-right: 1px solid var(--color-border);
}

.pt-meta span:last-child {
  border: none;
}

/* Allergy Badges */
.alg-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alg-safe {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #d1fae5;
}

.alg-alert {
  background: var(--color-danger-bg);
  color: var(--color-danger-dark);
  border: 1px solid var(--color-danger);
  animation: pulse-alert 2s infinite;
}

@keyframes pulse-alert {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.stu-badge {
  text-align: right;
  border-right: 1px solid var(--color-border);
  padding-right: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stu-label {
  font-size: 0.7em;
  color: var(--color-text-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stu-name {
  font-size: 0.95em;
  color: var(--color-text-main);
  font-weight: 600;
}

.exit-btn {
  background: var(--color-bg-white);
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.85em;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.exit-btn:hover {
  background: #f3f4f6;
  color: var(--color-text-main);
  border-color: #9ca3af;
  text-decoration: none;
}

/* ========================================
   20. TAB BAR (Workspace Tabs)
   ======================================== */
.tab-bar {
  background: var(--color-bg-app);
  height: 44px;
  display: flex;
  align-items: flex-end;
  padding-left: 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow-x: auto;
  gap: 6px;
  z-index: 15;
}

.tab {
  background: transparent;
  color: var(--color-text-light);
  padding: 8px 16px;
  border-radius: 8px 8px 0 0;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-bottom: none;
  transition: var(--transition-fast);
  min-width: 120px;
  max-width: 220px;
  position: relative;
  top: 1px;
}

.tab:hover {
  background: #e5e7eb;
  color: var(--color-text-main);
}

.tab.active {
  background: var(--color-bg-white);
  color: var(--color-primary);
  border-color: var(--color-border);
  border-bottom: 1px solid var(--color-bg-white);
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.02);
}

.tab-icon {
  font-size: 1.1em;
  opacity: 0.7;
}

.tab-close {
  font-size: 1.1em;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-left: auto;
  opacity: 0;
  transition: var(--transition-fast);
}

.tab:hover .tab-close {
  opacity: 0.5;
}

.tab-close:hover {
  background: #fee2e2;
  color: var(--color-danger);
  opacity: 1 !important;
}

.tab-popout {
  font-size: 0.8em;
  opacity: 0;
  transform: rotate(-45deg);
  transition: var(--transition-fast);
  margin-left: 4px;
}

.tab:hover .tab-popout {
  opacity: 0.5;
}

.tab-popout:hover {
  opacity: 1 !important;
  color: #2563eb;
}

/* ========================================
   21. WORKSPACE CONTENT AREA
   ======================================== */
.workspace-content {
  flex: 1;
  position: relative;
  background: var(--color-bg-white);
  overflow: hidden;
}

.workspace-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  z-index: 0;
}

.workspace-content iframe.active {
  visibility: visible;
  z-index: 10;
}
/* ========================================
   20. LAB RESULT FLAGS
   ======================================== */
.res-H {
  color: #c0392b;
  font-weight: 800;
}

.res-L {
  color: var(--color-info);
  font-weight: 800;
}

.res-C {
  color: white;
  background: #c0392b;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
