:root {
  --red: #c62828;
  --dark: #1e1e1e;
  --light: #f5f5f5;
  --muted: #777;
}

* {
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

body {
  margin: 0;
  background: var(--light);
}

/* ---------- AUTH ---------- */

.auth-card {
  max-width: 360px;
  margin: 4rem auto;
  padding: 2rem;
  border-radius: 12px;
  background: white;
}

.auth-card input {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.6rem;
}

.auth-bg {
  background: linear-gradient(135deg, var(--red), #8e0000);
}

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

.brand {
  color: var(--red);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- COMMON ---------- */

.card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

input, select {
  width: 100%;
  padding: 0.7rem;
  border-radius: 8px;
  border: 1px solid #ccc;
}

button {
  width: 100%;
  padding: 0.8rem;
  border-radius: 8px;
  border: none;
  font-weight: bold;
}

.btn-primary {
  background: var(--red);
  color: white;
}

/* ---------- DASHBOARD ---------- */

.centered {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.dashboard-header {
  background: white;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.grid {
  padding: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.patient-card {
  background: white;
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  text-decoration: none;
  color: black;
}

.patient-card:hover {
  outline: 2px solid var(--red);
}

.avatar {
  background: var(--red);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
}

/* ---------- PATIENT ---------- */

body {
  font-family: Arial, sans-serif;
  background: #f6f6f6;
  margin: 0;
  padding: 20px;
}

.back-link {
  color: red;
  text-decoration: none;
  font-weight: bold;
}

.patient-layout {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

/* LEFT COLUMN */
.photo-column {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.photo-box {
  width: 140px;
  height: 100px;
  background: #e0e0e0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-size: 14px;
}

/* MAIN CARD */
.patient-layout {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.patient-card {
  width: 100%;
  max-width: 900px;
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
}


.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  margin: 0;
  color: #c00000;
}

.patient-id {
  background: #ffe5e5;
  color: #900;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin-top: 15px;
}

.badge {
  background: #c00000;
  color: white;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
}

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 20px 0;
}

h3 {
  margin-bottom: 10px;
  color: #444;
}

/* GALLERY */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.gallery-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gallery-image:hover {
  transform: scale(1.05);
}

.gallery-item {
  border-radius: 10px;
  overflow: hidden;
  background: #eee;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-images {
  color: #888;
  font-size: 14px;
}

/* METRICS */
.metrics {
  display: flex;
  gap: 15px;
  margin: 20px 0;
}

.metric-card {
  flex: 1;
  background: #ffecec;
  border-left: 4px solid #c00000;
  padding: 12px;
  border-radius: 10px;
}

.metric-label {
  font-size: 13px;
  color: #666;
}

.metric-value {
  font-size: 20px;
  font-weight: bold;
  color: #900;
}

/* NOTES */
.notes-box {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 12px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}

/* MOBILE */
@media (max-width: 768px) {
  .gallery {
    max-width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .metrics {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .patient-layout {
    flex-direction: column;
  }

  .photo-column {
    flex-direction: row;
    justify-content: space-between;
  }

  .photo-box {
    width: 100%;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1000;
}

.modal-image {
  max-width: 90%;
  max-height: 80%;
  border-radius: 8px;
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 32px;
  color: white;
  cursor: pointer;
}

.download-btn {
  margin-top: 16px;
  padding: 10px 16px;
  background: #b11226;
  color: white;
  text-decoration: none;
  border-radius: 6px;
}

/* SEARCH BAR & SORT */
.controls {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  min-width: 160px;
}

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.control-group input,
.control-group select {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

/* Mobile layout */
@media (max-width: 640px) {
  .controls {
    width: 100%;
    flex-direction: column;
  }

  .control-group {
    width: 100%;
  }
}

/* Logout Button */
.logout-btn {
  margin-left: 1rem;
  padding: 0.55rem 1.1rem;
  background-color: #b11226; /* deep red */
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.logout-btn:hover {
  background-color: #8f0f1f;
  transform: translateY(-1px);
}

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

@media (max-width: 768px) {
  .dashboard-header .right.controls {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .logout-btn {
    width: 100%;
    text-align: center;
  }
}
