/* CitraX Mini - Medical PACS Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --bg-main: #121519;
  --bg-header: #171a1f;
  --bg-card: rgba(15, 20, 30, 0.25);
  --bg-input: rgba(20, 26, 36, 0.55);
  --border-color: rgba(255, 255, 255, 0.2);
  --border-light: rgba(255, 255, 255, 0.25);
  --accent-teal: #2dd4bf;
  --accent-teal-dark: #14b8a6;
  --accent-yellow: #facc15;
  --accent-green: #10b981;
  --text-main: #f1f5f9;
  --text-muted: #8492a6;
  --text-dim: #64748b;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ====================================================
   LOGIN PAGE STYLES
   ==================================================== */
.login-body {
  background: url('../images/priya_bg.jpg') no-repeat center 15% fixed;
  background-size: cover;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px 16px;
}

.login-backdrop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 22, 0.25);
}

.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 36px 32px 28px;
  background: var(--bg-card);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.12);
  text-align: center;
}

.login-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-logo-container img {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 26px;
}

.login-form {
  text-align: left;
}

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

.form-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.form-label svg {
  width: 15px;
  height: 15px;
  color: var(--text-dim);
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-input:focus {
  border-color: var(--accent-teal-dark);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.btn-login {
  width: 100%;
  padding: 12px 16px;
  margin-top: 8px;
  background: linear-gradient(135deg, #2dd4bf 0%, #14b8a6 100%);
  border: none;
  border-radius: 8px;
  color: #0d1e1c;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.35);
}

.btn-login:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(20, 184, 166, 0.45);
}

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

.login-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.login-footer .dept {
  font-weight: 600;
  color: #94a3b8;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  text-align: left;
}

/* ====================================================
   TOP NAVBAR (Studies & View Study)
   ==================================================== */
.navbar {
  height: 52px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.navbar-brand img {
  height: 32px;
  width: auto;
}

.navbar-title {
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.navbar-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1px;
}

.navbar-title .subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link-btn:hover {
  color: #ffffff;
}

.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.theme-toggle-btn:hover {
  color: #ffffff;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
}

.avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: #0f766e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.btn-sign-out {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}

.btn-sign-out:hover {
  color: #f87171;
}

.nav-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-color);
}

/* ====================================================
   STUDY LIST PAGE STYLES
   ==================================================== */
.studies-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px;
}

.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  max-width: 320px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--accent-teal-dark);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.auto-refresh-toggle input[type="checkbox"] {
  accent-color: var(--accent-teal-dark);
  cursor: pointer;
}

.select-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}

/* Study List Table */
.table-wrapper {
  background-color: #15181d;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow-x: auto;
}

.studies-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.studies-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.studies-table th.sortable {
  cursor: pointer;
}

.studies-table th.sortable:hover {
  color: #ffffff;
}

.sort-icon {
  font-size: 9px;
  margin-left: 3px;
  color: #64748b;
}

/* Table Filter Row */
.filter-row th {
  padding: 4px 10px 10px;
  background-color: #171b21;
}

.table-filter-input {
  width: 100%;
  padding: 4px 8px;
  background-color: #1e242c;
  border: 1px solid #2e3846;
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 12px;
  outline: none;
}

.table-filter-input::placeholder {
  color: #64748b;
  font-style: italic;
}

.table-filter-input:focus {
  border-color: var(--accent-teal-dark);
}

.table-filter-select {
  width: 100%;
  padding: 4px 6px;
  background-color: #1e242c;
  border: 1px solid #2e3846;
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* Table Data Rows */
.studies-table tbody tr {
  border-bottom: 1px solid #1e242d;
  transition: background-color 0.15s;
}

.studies-table tbody tr:nth-child(even) {
  background-color: #13161b;
}

.studies-table tbody tr:hover {
  background-color: #1b2129;
}

.studies-table td {
  padding: 11px 14px;
  vertical-align: middle;
}

.patient-name-cell {
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.patient-id-cell {
  font-family: var(--font-mono);
  font-style: italic;
  color: #94a3b8;
}

.patient-date-cell {
  font-style: italic;
  color: #94a3b8;
}

.modality-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 4px;
  color: #10b981;
  font-weight: 700;
  font-size: 11px;
}

.status-online {
  color: #10b981;
  font-weight: 600;
  font-size: 12px;
  background: rgba(16, 185, 129, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-view-study {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background-color: #1b2129;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-view-study:hover {
  background-color: #27313f;
  border-color: var(--accent-teal-dark);
  color: #ffffff;
}

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-page-arrow {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: #94a3b8;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
}

.btn-page-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-page-num {
  background-color: var(--accent-teal-dark);
  border: none;
  border-radius: 4px;
  color: #0f172a;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ====================================================
   VIEW STUDY (PACS DICOM VIEWER) STYLES
   ==================================================== */
.viewer-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: #000000;
}

/* Patient Metadata Banner */
.patient-metadata-bar {
  background-color: #15181d;
  border-bottom: 1px solid #242c38;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 20px;
}

.meta-group {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.meta-val-patient {
  color: var(--accent-teal);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.meta-val-id {
  font-family: var(--font-mono);
  font-style: italic;
  color: #cbd5e1;
}

.meta-val-text {
  color: #e2e8f0;
  font-weight: 500;
}

.meta-clinic {
  font-weight: 600;
  color: #94a3b8;
}

/* PACS Toolbar */
.pacs-toolbar {
  height: 44px;
  background-color: #171b21;
  border-bottom: 1px solid #262e3b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pacs-tool-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #94a3b8;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.pacs-tool-btn:hover {
  background-color: #222935;
  color: #ffffff;
}

.pacs-tool-btn.active {
  background-color: var(--accent-teal-dark);
  color: #0f172a;
  font-weight: 600;
}

.pacs-tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-divider {
  width: 1px;
  height: 20px;
  background-color: #2a3342;
  margin: 0 4px;
}

/* Main PACS Workspace */
.pacs-workspace {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Left Thumbnail Sidebar */
.studies-sidebar {
  width: 220px;
  background-color: #13171d;
  border-right: 1px solid #242c38;
  display: flex;
  flex-direction: column;
  transition: width 0.2s;
  user-select: none;
}

.studies-sidebar.collapsed {
  width: 0;
  display: none;
}

.sidebar-header {
  padding: 10px 14px;
  border-bottom: 1px solid #202733;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
}

.sidebar-view-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
}

.sidebar-view-icons svg {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.sidebar-view-icons svg:hover {
  color: #cbd5e1;
}

.sidebar-content {
  padding: 12px;
  overflow-y: auto;
}

.study-thumbnail-card {
  background-color: #1a2029;
  border: 1px solid #2b3543;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.study-thumbnail-card.active, .study-thumbnail-card:hover {
  border-color: var(--accent-teal-dark);
  background-color: #202733;
}

.thumb-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.thumb-title {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 12px;
  margin-bottom: 6px;
}

.thumb-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #000000;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.thumb-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--accent-teal-dark);
  color: #0f172a;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 2px;
}

.thumb-footer {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
}

/* Viewport Area */
.viewport-area {
  flex: 1;
  position: relative;
  background-color: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-teal-dark);
}

/* DICOM Canvas Container */
.dicom-canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pacsCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}

/* Medical HUD 4-Corner Overlays */
.hud-overlay {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  font-size: 12px;
  line-height: 1.45;
  color: #f1f5f9;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.95);
  font-family: var(--font-main);
}

.hud-top-left {
  top: 14px;
  left: 16px;
  text-align: left;
}

.hud-patient-name {
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.hud-patient-id {
  font-family: var(--font-mono);
  color: #e2e8f0;
}

.hud-top-right {
  top: 14px;
  right: 18px;
  text-align: right;
}

.hud-marker-pa {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.hud-marker-r {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  margin-top: 4px;
  line-height: 1;
}

.hud-clinic-text {
  color: #10b981;
  font-weight: 500;
  font-size: 12px;
  margin-top: 8px;
}

.hud-bottom-left {
  bottom: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #ffffff;
}

.hud-bottom-right {
  bottom: 14px;
  right: 18px;
  font-size: 12px;
  color: #ffffff;
}

/* Right Toolstrip */
.pacs-right-toolstrip {
  width: 36px;
  background-color: #13171d;
  border-left: 1px solid #242c38;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  gap: 12px;
}

.strip-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.strip-btn:hover {
  color: var(--accent-teal);
}

.strip-btn svg {
  width: 18px;
  height: 18px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .studies-sidebar {
    position: absolute;
    z-index: 40;
    height: 100%;
  }
}

@media (max-width: 640px) {
  .login-body {
    background-attachment: scroll;
    background-position: center top;
    background-size: cover;
    padding: 16px;
    align-items: flex-end;
    padding-bottom: 24px;
  }

  .login-backdrop-overlay {
    background: linear-gradient(180deg, rgba(10, 15, 22, 0.1) 0%, rgba(10, 15, 22, 0.5) 60%, rgba(10, 15, 22, 0.8) 100%);
  }

  .login-card {
    padding: 24px 20px 20px;
    border-radius: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(15, 20, 30, 0.25);
  }

  .login-title {
    font-size: 20px;
  }

  .login-subtitle {
    font-size: 12px;
    margin-bottom: 20px;
  }

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

  .form-input {
    padding: 10px 12px;
  }
}
