/* ================================================================
   Activity Tracker — Design System
   Modern minimal. Compact. Readable. Brand: #dc2626
   ================================================================ */

:root {
  /* Colors */
  --color-white:      #ffffff;
  --color-bg:         #f8fafc;
  --color-border:     #e8ecf0;
  --color-brand:      #dc2626;
  --color-brand-bg:   #fef2f2;

  /* Text */
  --text-primary:     #111827;
  --text-secondary:   #6b7280;
  --text-muted:       #9ca3af;

  /* Layout */
  --sidebar-w:        256px;
  --header-h:         60px;
  --radius:           6px;
  --shadow:           0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg:        0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ================================================================
   Reset & Base
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   App Shell
   ================================================================ */
.act-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ================================================================
   Sidebar
   ================================================================ */
.act-sidebar {
  width: var(--sidebar-w);
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.act-sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.act-sidebar-header span { color: var(--color-brand); }

.act-mobile-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.act-nav-list {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.act-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.act-nav-link:hover {
  background: var(--color-bg);
  color: var(--text-primary);
}
.act-nav-link.is-active {
  background: var(--color-brand-bg);
  color: var(--color-brand);
  font-weight: 600;
}

.act-nav-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.wip-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.act-sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
}
.act-user-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.act-user-role {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-brand);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* ================================================================
   Main Layout
   ================================================================ */
.act-main-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
}

.act-main-header {
  height: var(--header-h);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  flex-shrink: 0;
  gap: 12px;
}
.act-main-header h1 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.act-mobile-menu {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.act-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ================================================================
   Cards & Grid
   ================================================================ */
.act-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.act-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Doctor Cards */
.act-doctor-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.act-doctor-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-brand);
}
.act-doctor-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px 0;
}
.act-doctor-card p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* View Header & Empty States */
.act-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.act-view-info p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.act-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  background: var(--color-white);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
}
.act-empty-state .material-icons-round {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.act-empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px 0;
}
.act-empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}
.act-doctor-card p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.act-avatar {
  width: 40px;
  height: 40px;
  background: var(--color-brand-bg);
  color: var(--color-brand);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
}

/* ================================================================
   Forms (Activity Reporting Flow)
   ================================================================ */
.act-report-container {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 80px;
}

/* Card with section header (like "CLINICAL TARGET") */
.act-form-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.act-card-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--color-brand-bg);
  border-bottom: 1px solid #fecaca;
  color: var(--color-brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.act-card-section-header .material-icons-round {
  font-size: 16px;
}

.act-card-body {
  padding: 20px;
}

/* Form groups */
.act-form-group {
  margin-bottom: 18px;
}
.act-form-group:last-child { margin-bottom: 0; }

label, .act-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.required { color: var(--color-brand); }

/* Inputs */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--color-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

/* Custom Select — chevron baked in */
.act-select-wrap {
  position: relative;
}
.act-select-wrap select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--color-white);
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.act-select-wrap select:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}
.act-select-wrap::after {
  content: 'expand_more';
  font-family: 'Material Icons Round';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  pointer-events: none;
  line-height: 1;
}

/* Segmented YES / NO */
.act-segmented {
  display: inline-flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}
.act-segmented button {
  padding: 7px 28px;
  border: none;
  background: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.act-segmented button.active {
  background: var(--color-brand);
  color: var(--color-white);
}

/* Rx entry box */
.act-rx-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
}

/* Section label (subtle, not header) */
.act-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: block;
}

/* Doctor search dropdown */
.act-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.act-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.act-dropdown-item:hover { background: var(--color-bg); }
.act-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.act-item-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Selection confirmation tag */
.act-selection-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  color: #16a34a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.act-selection-tag .material-icons-round { font-size: 13px; }

/* Upload buttons */
.act-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.act-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s;
  font-family: inherit;
}
.act-upload-btn .material-icons-round { font-size: 16px; }
.act-upload-btn:hover { border-color: var(--color-brand); color: var(--color-brand); }
.act-upload-status { font-size: 11px; color: var(--text-muted); }

/* Add brand link */
.act-add-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-brand);
  font-size: 13px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.act-add-link .material-icons-round { font-size: 18px; }

/* Divider */
.act-divider {
  border: none;
  border-top: 1px dashed var(--color-border);
  margin: 20px 0;
}

/* Spacer */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

/* ================================================================
   Sticky Footer (Activity Form)
   ================================================================ */
.act-form-sticky-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 14px 28px;
  z-index: 100;
}
.act-footer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
}
.act-footer-inner > * { flex: 1; }

/* ================================================================
   Buttons
   ================================================================ */
.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}
.act-btn-outline {
  background: var(--color-white);
  border-color: var(--color-border);
  color: var(--text-primary);
}
.act-btn-primary {
  background: var(--color-brand);
  color: var(--color-white);
  border-color: var(--color-brand);
}
.act-btn-primary:hover { background: #b91c1c; }
.act-btn-primary:disabled,
.act-btn-submit:disabled {
  background: var(--color-border);
  border-color: var(--color-border);
  color: var(--text-muted);
  cursor: not-allowed;
}
.act-btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-brand);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.act-btn-submit .material-icons-round { font-size: 16px; }
.act-btn-block { width: 100%; display: flex; }


/* ================================================================
   Login Page
   ================================================================ */
.act-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 24px;
}
.act-login-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 40px;
}
.act-login-header {
  text-align: center;
  margin-bottom: 32px;
}
.act-logo { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.act-logo span { color: var(--color-brand); }
.act-login-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 8px 0 0;
}
.act-login-error {
  background: var(--color-brand-bg);
  color: var(--color-brand);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
}
.act-login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 28px;
}

/* ================================================================
   Mobile Responsive
   ================================================================ */
@media (max-width: 768px) {
  .act-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: var(--sidebar-w);
  }
  .act-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }
  .act-mobile-menu { display: flex; }
  .act-mobile-close { display: flex; }

  .act-main-header { padding: 0 16px; }
  .act-content { padding: 16px; }

  .act-form-sticky-footer {
    left: 0;
    padding: 12px 16px;
  }
  .act-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   Lightbox Modal
   ================================================================ */
.act-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: zoom-out;
}

.act-lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.act-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(100% - 100px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.act-lightbox-close {
  position: fixed;
  bottom: max(32px, env(safe-area-inset-bottom, 32px));
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: background 0.2s;
}
.act-lightbox-close:active {
  background: rgba(255, 255, 255, 0.4);
}
.act-lightbox-close .material-icons-round {
  font-size: 32px;
}

/* Preview Thumbnail */
.act-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  cursor: zoom-in;
  border: 2px solid var(--color-white);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}
.act-preview-thumb:hover {
  transform: scale(1.05);
}
/* ================================================================
   Table & Data Display
   ================================================================ */
.act-table-container {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

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

.act-table th {
  background: var(--color-bg);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.act-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--text-primary);
  vertical-align: middle;
}

.act-table tr:last-child td {
  border-bottom: none;
}

.act-table tr:hover td {
  background: rgba(220, 38, 38, 0.02);
}

.act-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.act-badge-neutral { background: var(--color-bg); color: var(--text-secondary); }
.act-badge-brand { background: var(--color-brand-bg); color: var(--color-brand); }

@media (max-width: 640px) {
  .act-table th:nth-child(3), .act-table td:nth-child(3),
  .act-table th:nth-child(4), .act-table td:nth-child(4) {
    display: none;
  }
}
