/* ═══════════════════════════════════════════
   PAGE-SPECIFIC STYLES
   ═══════════════════════════════════════════ */

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: var(--space-4);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-elevated);
  animation: scale-in var(--duration-enter) var(--ease-out);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo img {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-4);
}

.login-logo h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-1);
}

.login-logo p {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-error {
  background: var(--red-subtle);
  color: var(--red);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
  display: none;
}

.login-error.visible { display: block; }

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
}

.login-btn {
  width: 100%;
  padding: 12px;
  margin-top: var(--space-2);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.remember-row input {
  accent-color: var(--cyan);
}

/* ─── DASHBOARD PAGE ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

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

.quick-actions {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.activity-feed {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.scan { background: var(--cyan); }
.activity-dot.status { background: var(--amber); }
.activity-dot.delivery { background: var(--mint); }
.activity-dot.alert { background: var(--red); }

.activity-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex: 1;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-bar-container {
  margin-top: var(--space-4);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.progress-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  width: 100px;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress-fill.cyan { background: var(--cyan); }
.progress-fill.mint { background: var(--mint); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }

.progress-value {
  font-size: var(--text-xs);
  color: var(--text-muted);
  width: 40px;
  text-align: right;
}

/* ─── ORDERS PAGE ─── */
.order-row-clickable {
  cursor: pointer;
}

.order-number {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--cyan);
}

.order-patient {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.order-type {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.order-due {
  font-size: var(--text-sm);
}

.order-due.overdue {
  color: var(--red);
  font-weight: var(--font-semibold);
}

/* ─── ORDER DETAIL ─── */
.order-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.order-detail-number {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

.order-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.info-item {
  padding: var(--space-3);
}

.info-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.info-value {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.order-notes {
  margin-top: var(--space-6);
}

.notes-list {
  max-height: 300px;
  overflow-y: auto;
}

.note-item {
  padding: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.note-item:last-child { border-bottom: none; }

.note-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.note-author {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.note-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.note-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.add-note-form {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.add-note-form .form-input { flex: 1; }

.qr-section {
  text-align: center;
  padding: var(--space-6);
}

.qr-code-display {
  width: 180px;
  height: 180px;
  margin: 0 auto var(--space-4);
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--neu);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-display canvas,
.qr-code-display img {
  width: 100%;
  height: 100%;
}

.scan-log {
  margin-top: var(--space-6);
}

.scan-log-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}

.scan-log-step {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.scan-log-action {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.scan-log-action.start { background: var(--cyan-subtle); color: var(--cyan); }
.scan-log-action.end { background: var(--mint-subtle); color: var(--mint); }
.scan-log-action.rework { background: var(--amber-subtle); color: var(--amber); }

/* ─── ORDER FORM ─── */
.order-form-container {
  max-width: 800px;
}

.form-section {
  margin-bottom: var(--space-8);
}

.form-section-title {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* ─── DELIVERY PAGE ─── */
.delivery-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  width: fit-content;
}

.delivery-tab {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-out);
}

.delivery-tab.active {
  background: var(--white);
  color: var(--cyan);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.delivery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu);
  margin-bottom: var(--space-3);
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.delivery-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--neu-hover);
}

.delivery-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
}

.delivery-order-num {
  font-family: var(--font-mono);
  font-weight: var(--font-semibold);
  color: var(--cyan);
}

.delivery-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.delivery-actions {
  display: flex;
  gap: var(--space-2);
}

/* ─── SERVERS PAGE ─── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
}

.server-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--neu);
}

.server-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.server-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-md);
}

.server-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.server-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.server-status-dot.online { background: var(--mint); animation: status-pulse 2s infinite; }
.server-status-dot.offline { background: var(--red); }
.server-status-dot.unknown { background: var(--slate); }

.server-details {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.server-detail-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.server-detail-row:last-child { border-bottom: none; }

.server-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* ─── USERS PAGE ─── */
.user-status-active {
  color: var(--mint);
}

.user-status-inactive {
  color: var(--slate);
}

/* ─── PORTAL ─── */
.portal-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-header {
  height: var(--header-height);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
}

.portal-content {
  flex: 1;
  padding: var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ─── RESPONSIVE PAGES ─── */
@media (max-width: 1200px) {
  .order-detail-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .quick-actions {
    flex-direction: column;
  }
  .quick-actions .btn {
    width: 100%;
  }
  .order-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .delivery-card {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .delivery-actions {
    width: 100%;
  }
  .delivery-actions .btn {
    flex: 1;
  }
  .login-card {
    padding: var(--space-6);
  }
}

/* ─── DOCUMENTATION PAGE ─── */
.docs-page {
  max-width: 1200px;
  margin: 0 auto;
}

.docs-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  width: fit-content;
}

.docs-tab {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  border: none;
  background: none;
}

.docs-tab:hover {
  color: var(--text-secondary);
}

.docs-tab.active {
  background: var(--white);
  color: var(--cyan);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-6);
  align-items: start;
}

/* TOC Sidebar */
.docs-toc {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
}

.docs-toc-item {
  display: block;
  padding: 6px 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  margin-bottom: 2px;
}

.docs-toc-item:hover {
  color: var(--cyan);
  background: rgba(0, 188, 212, 0.04);
}

.docs-toc-item.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(0, 188, 212, 0.06);
  font-weight: var(--font-medium);
}

/* Content area */
.docs-content {
  padding: var(--space-8);
  min-height: 400px;
}

.docs-section {
  margin-bottom: var(--space-10);
}

.docs-section:last-child {
  margin-bottom: 0;
}

.docs-section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  margin-bottom: var(--space-5);
  color: var(--text-primary);
}

.docs-heading {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

h4.docs-heading {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-top: var(--space-4);
}

.docs-paragraph {
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.docs-list {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
  color: var(--text-secondary);
}

.docs-list li {
  line-height: 1.7;
  margin-bottom: var(--space-2);
}

/* Info/Tip/Warning/Important boxes */
.docs-box {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border-left: 3px solid;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.docs-box strong {
  display: inline;
  margin-right: var(--space-1);
}

.docs-box-info {
  background: rgba(59, 130, 246, 0.06);
  border-left-color: #3b82f6;
  color: var(--text-secondary);
}

.docs-box-info strong { color: #3b82f6; }

.docs-box-tip {
  background: rgba(0, 188, 212, 0.06);
  border-left-color: var(--cyan);
  color: var(--text-secondary);
}

.docs-box-tip strong { color: var(--cyan); }

.docs-box-warning {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: var(--amber);
  color: var(--text-secondary);
}

.docs-box-warning strong { color: var(--amber); }

.docs-box-important {
  background: rgba(239, 68, 68, 0.06);
  border-left-color: var(--red);
  color: var(--text-secondary);
}

.docs-box-important strong { color: var(--red); }

/* Badge row */
.docs-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Production steps list */
.docs-step-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.docs-step-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.docs-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
}

.docs-step-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ─── RESPONSIVE DOCS ─── */
@media (max-width: 1024px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-toc {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
  }
  .docs-toc-item {
    border-left: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
  }
  .docs-toc-item.active {
    background: rgba(0, 188, 212, 0.1);
    border-left: none;
  }
}

@media (max-width: 768px) {
  .docs-tabs {
    width: 100%;
  }
  .docs-tab {
    flex: 1;
    text-align: center;
  }
  .docs-content {
    padding: var(--space-5);
  }
  .docs-step-list {
    grid-template-columns: 1fr;
  }
}

/* ─── PRINT STYLES ─── */
@media print {
  .sidebar, .header, .hamburger-btn, .mobile-overlay, .btn { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
  .qr-code-display { box-shadow: none !important; border: 1px solid #ddd; }
  .docs-tabs, .docs-toc { display: none !important; }
  .docs-layout { grid-template-columns: 1fr !important; }
  .docs-content { box-shadow: none !important; padding: 0 !important; }
}
