/* Derma App Stylesheet */

:root {
  /* Colors */
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --sidebar-bg: rgba(15, 23, 42, 0.95);
  --content-bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  
  --teal: #0d9488;
  --teal-hover: #0f766e;
  --teal-light: #ccfbf1;
  
  --success: #10b981;
  --info: #0284c7;
  --secondary: #64748b;
  --danger: #ef4444;
  
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  
  --border: #cbd5e1;
  --border-focus: #4f46e5;
  
  /* Layout */
  --sidebar-width: 320px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.15);
  
  /* Fonts */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--content-bg);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

.login-screen.hidden,
.app-container.hidden {
  display: none !important;
}

.login-card {
  width: min(100%, 440px);
  padding: 32px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(16px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-size: 26px;
  color: var(--text-dark);
}

.login-brand p {
  color: var(--text-muted);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 600;
}

.login-field input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: var(--font-body);
}

.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.login-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.login-hint {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 600;
}

/* Application Container */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR TOGGLE BUTTON ===== */
.sidebar-toggle-btn {
  position: fixed;
  top: 20px;
  left: calc(var(--sidebar-width) - 16px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4f46e5;
  border: 2px solid rgba(255,255,255,0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(79, 70, 229, 0.5);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease, box-shadow 0.2s ease;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.sidebar-toggle-btn:hover {
  background: #4338ca;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.7);
}

.sidebar-toggle-btn .toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

/* When sidebar is collapsed, button slides left to sit on the collapsed edge */
.app-container.sidebar-collapsed .sidebar-toggle-btn {
  left: calc(60px - 16px);
}

/* Collapsed: icon flips direction */
.app-container.sidebar-collapsed .sidebar-toggle-btn .toggle-icon {
  transform: rotate(180deg);
}


/* 1. SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.1);
  padding: 24px;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 10px 0 30px rgba(0,0,0,0.2);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
  overflow: hidden;
}

/* === COLLAPSED STATE === */
.sidebar.collapsed {
  width: 60px;
  padding: 24px 14px;
}

/* Elements that fade out on collapse */
.sidebar-show-on-open {
  transition: opacity 0.2s ease, visibility 0.2s ease;
  opacity: 1;
  visibility: visible;
}

.sidebar.collapsed .sidebar-show-on-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Logo title fades out */
.sidebar-title {
  transition: opacity 0.2s ease, width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-title {
  opacity: 0;
  width: 0;
}

/* Logo icon remains visible, centered in collapsed mode */
.sidebar.collapsed .logo {
  justify-content: center;
}

.sidebar.collapsed .logo-icon {
  font-size: 26px;
}

/* Main content shifts when sidebar collapses - see .main-content below */


.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
}

.logo h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #38bdf8 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Database Connection Badges */
.db-badge {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.05);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.db-connecting .badge-dot {
  background: #eab308;
  box-shadow: 0 0 8px #eab308;
  animation: pulse 1.5s infinite;
}

.db-mysql .badge-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.db-fallback .badge-dot {
  background: #f97316;
  box-shadow: 0 0 8px #f97316;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-info {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.btn-info:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3);
}

/* Search Box */
.search-box {
  position: relative;
  margin-top: 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  pointer-events: none;
  z-index: 2;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px 10px 44px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #fef3c7 !important;
  -webkit-text-fill-color: #fef3c7 !important;
  caret-color: #fef3c7;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.search-box input::placeholder {
  color: #fde68a !important;
  opacity: 1;
  padding-left: 0;
}

.search-box input:focus {
  outline: none;
  padding: 12px 10px 10px 22px;
  border-color: #818cf8;
  background: rgba(241, 245, 10, 0.1);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.2);
}

/* History Section */
.history-section {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 12px;
}

.history-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 12px;
  font-weight: 700;
}

.history-list {
  list-style: none;
  overflow-y: auto;
  flex-grow: 1;
  margin-right: -10px;
  padding-right: 10px;
}

/* Custom Scrollbar for list */
.history-list::-webkit-scrollbar {
  width: 4px;
}
.history-list::-webkit-scrollbar-track {
  background: transparent;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.history-item {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

.history-item.active {
  background: rgba(79, 70, 229, 0.15);
  border-color: #6366f1;
}

.item-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 14px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.history-empty, .spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 10px;
  text-align: center;
  color: rgba(255,255,255,0.3);
}

.history-empty p {
  font-size: 13px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-footer .btn-secondary {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-footer .btn-secondary:hover {
  background: rgba(255,255,255,0.16);
}

/* 2. MAIN WORKSPACE */
.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  padding: 30px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1400px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When sidebar is collapsed, shift main content left */
.app-container.sidebar-collapsed .main-content {
  margin-left: 60px;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1.5px solid #e2e8f0;
}

.view-status-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

#page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
}

.view-badge {
  background: var(--teal-light);
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.date-display {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Form Wrapper & Cards */
.form-wrapper {
  flex-grow: 1;
  margin-bottom: 60px; /* space for sticky footer */
}

.derma-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h3 {
  font-size: 18px;
  margin-bottom: 18px;
  color: var(--text-dark);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-badge {
  position: absolute;
  top: -10px;
  left: 24px;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-title);
  box-shadow: 0 2px 5px rgba(79, 70, 229, 0.4);
}

/* Form Elements */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.required {
  color: var(--danger);
}

/* Input Fields */
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  font-family: var(--font-body);
  font-size: 14px;
  background: #f8fafc;
  color: var(--text-dark);
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background: white;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input:disabled, select:disabled, textarea:disabled {
  background: #e2e8f0;
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

/* Tiles Grid / Checkbox Card Styling */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

/* Hide Default Checkboxes and Radios */
.tile-check input[type="checkbox"],
.tile-check input[type="radio"],
.session-select-tile input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Visual Checkbox Tile Design */
.tile-check {
  display: block;
  cursor: pointer;
  user-select: none;
}

.tile-check-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  height: 100%;
}

.tile-check:hover .tile-check-card {
  border-color: var(--primary);
  background: #f1f5f9;
  transform: translateY(-1px);
}

/* Custom Checkbox Indicator */
.checkbox-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: white;
  flex-shrink: 0;
  position: relative;
}

.checkbox-box::after {
  content: "✓";
  color: white;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  transition: all 0.1s ease;
}

/* Checked States */
.tile-check input:checked + .tile-check-card {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-glow);
}

.tile-check input:checked + .tile-check-card .checkbox-box {
  border-color: var(--primary);
  background: var(--primary);
}

.tile-check input:checked + .tile-check-card .checkbox-box::after {
  opacity: 1;
}

.tile-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

/* Helper Utilities */
.mt-4 { margin-top: 16px; }
.hidden { display: none !important; }

/* Procedure Target Area section */
.procedure-target-area {
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.section-sublabel {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 10px;
}

.target-tiles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.target-other-input-wrapper {
  flex-grow: 1;
  min-width: 200px;
}

/* Next Appointment Layout */
.appointments-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.appointments-helper {
  font-size: 13px;
  color: var(--text-muted);
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.session-row:has(input[type="radio"]:checked) {
  border-color: var(--teal);
  background: var(--teal-light);
  box-shadow: 0 0 10px rgba(13, 148, 136, 0.1);
}

.session-select-tile {
  cursor: pointer;
  flex-shrink: 0;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.radio-indicator {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: inline-block;
  background: white;
  position: relative;
  transition: all 0.2s ease;
}

.radio-indicator::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--teal);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: all 0.15s cubic-bezier(0.12, 0.4, 0.29, 1.46);
}

.session-select-tile input:checked + .session-card .radio-indicator {
  border-color: var(--teal);
}

.session-select-tile input:checked + .session-card .radio-indicator::after {
  transform: translate(-50%, -50%) scale(1);
}

.session-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.session-date-wrapper {
  flex-grow: 1;
}

/* Sticky Actions Footer */
.form-actions-sticky {
  position: fixed;
  bottom: 0;
  right: 0;
  left: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px 40px;
  border-top: 1.5px solid #e2e8f0;
  z-index: 90;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Shift sticky bar left when sidebar is collapsed */
.app-container.sidebar-collapsed .form-actions-sticky {
  left: 60px;
}

.form-actions {
  max-width: 1320px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Locked Form Styling (Read-Only Mode) */
.read-only-form input,
.read-only-form textarea {
  pointer-events: none;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.read-only-form .tile-check,
.read-only-form .session-row {
  pointer-events: none;
}

/* In read-only mode, dim items that are NOT selected */
.read-only-form .tile-check input:not(:checked) + .tile-check-card {
  opacity: 0.4;
}

.read-only-form .session-row:not(:has(input[type="radio"]:checked)) {
  opacity: 0.4;
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease forwards;
}

.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-warning { background: #f59e0b; }
.toast-info { background: #0284c7; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive Scaling */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    position: relative;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    height: auto;
    box-shadow: none;
  }
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
  .form-actions-sticky {
    left: 0;
    padding: 16px 20px;
  }
  .grid-3, .grid-2, .sessions-grid {
    grid-template-columns: 1fr;
  }
}

/* Image Upload Section Styles */
.section-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -12px;
  margin-bottom: 16px;
}

.upload-buttons-container {
  display: flex;
  gap: 12px;
}

.image-previews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  min-height: 100px;
  align-items: center;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #000;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.preview-item:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

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

.preview-tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease;
  z-index: 10;
}

.preview-remove-btn:hover {
  background: #dc2626;
}

.form-control {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  font-family: var(--font-body);
  font-size: 14px;
  background: #f8fafc;
  color: var(--text-dark);
}

/* Modal Styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--danger);
}

.webcam-container {
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

#webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.webcam-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.lightbox-content {
  max-width: 800px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  align-items: center;
}

#lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.lightbox-caption {
  margin-top: 12px;
  color: white;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

/* PRINT MEDIA STYLESHEET */
@media print {
  body {
    background: white;
    color: black;
    font-size: 12px;
  }
  
  .sidebar,
  .sidebar-toggle-btn,
  .form-actions-sticky,
  .top-bar,
  .section-title-badge,
  .appointments-helper,
  #view-mode-badge,
  .image-upload-controls,
  .preview-remove-btn,
  .modal,
  .close-btn {
    display: none !important;
  }
  
  .image-previews-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
    gap: 12px !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
  }

  .preview-item {
    border: 1px solid #000 !important;
    border-radius: 4px !important;
    aspect-ratio: 1 !important;
    box-shadow: none !important;
    pointer-events: none !important;
  }

  .preview-tag {
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    font-size: 9px !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 10px 0 !important;
    margin-bottom: 10px;
  }
  
  .card h3 {
    font-size: 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
  }
  
  .print-header {
    display: block !important;
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
    margin-bottom: 20px;
  }
  
  .print-header h1 {
    font-size: 20px;
    font-weight: 700;
  }
  
  .print-subtitle {
    font-size: 11px;
    color: #475569;
  }

  .grid-3 {
    grid-template-columns: 2fr 1fr 2fr !important;
    gap: 10px !important;
  }

  .grid-2 {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  
  input[type="text"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  textarea {
    border: none !important;
    border-bottom: 1px solid #000 !important;
    background: transparent !important;
    padding: 2px 4px !important;
    border-radius: 0 !important;
  }

  /* Print representation of Checked Tiles */
  .tiles-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 16px !important;
  }

  .tile-check {
    display: block !important;
  }

  .tile-check-card {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    align-items: center !important;
  }

  /* Make unchecked items display as plain text with empty box */
  .checkbox-box {
    border: 1px solid #000 !important;
    width: 12px !important;
    height: 12px !important;
    border-radius: 0 !important;
  }
  
  .tile-check input:not(:checked) + .tile-check-card {
    opacity: 0.7;
  }

  .tile-check input:checked + .tile-check-card .checkbox-box {
    background: black !important;
    border-color: black !important;
  }

  .tile-check input:checked + .tile-check-card .checkbox-box::after {
    color: white !important;
  }

  /* Target Area Section in Print */
  .procedure-target-area {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-top: 8px !important;
  }
  
  .target-tiles {
    display: flex !important;
    gap: 16px !important;
  }

  /* Next Appointment Layout in Print */
  .sessions-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
  }

  .session-row {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
  }

  .session-row:not(:has(input[type="radio"]:checked)) {
    opacity: 0.4;
  }

  .radio-indicator {
    border: 1px solid #000 !important;
    width: 12px !important;
    height: 12px !important;
  }

  .session-select-tile input:checked + .session-card .radio-indicator {
    background: black !important;
  }

  /* Signature Block */
  .print-signature-section {
    display: flex !important;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 20px;
  }

  .signature-line {
    width: 250px;
    text-align: center;
  }

  .signature-line .line {
    border-bottom: 1px solid #000;
    margin-bottom: 6px;
    height: 20px;
  }

  .print-date {
    font-size: 12px;
    align-self: flex-end;
  }
}
