﻿* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #222; background: #f9fafb; }
.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.auth-container { max-width: 400px; margin: 80px auto; padding: 32px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.auth-container h1 { margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 14px; color: #555; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; font-family: inherit; }
.form-group input:focus { outline: none; border-color: #0066ff; box-shadow: 0 0 0 3px rgba(0,102,255,0.1); }
.btn { display: inline-block; padding: 10px 24px; border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; }
.btn-primary { background: #0066ff; color: white; width: 100%; text-align: center; margin-top: 8px; }
.btn-primary:hover { background: #0052cc; }
.btn-secondary { background: #f3f4f6; color: #222; }
.btn-danger { background: #dc2626; color: white; }
.btn-link { background: none; color: #0066ff; padding: 0; text-decoration: underline; cursor: pointer; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-info { background: #dbeafe; color: #1e40af; }
.card { background: white; border-radius: 12px; padding: 24px; margin-bottom: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h1 { font-size: 24px; }
.day-group { margin-bottom: 32px; }
.day-group h3 { font-size: 16px; color: #555; margin-bottom: 12px; text-transform: capitalize; }
.slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.slot-card { background: white; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; text-align: center; text-decoration: none; color: #222; transition: border-color 0.2s; }
.slot-card:hover { border-color: #0066ff; }
.slot-time { font-size: 20px; font-weight: 600; }
.slot-duration { font-size: 12px; color: #888; margin-top: 4px; }
.muted { color: #6b7280; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.table th { font-size: 13px; color: #6b7280; text-transform: uppercase; font-weight: 600; }
.chat-messages { display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; }
.chat-msg--own { justify-content: flex-end; }
.chat-msg--other { justify-content: flex-start; }
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.chat-msg--own .chat-bubble { background: #0066ff; color: white; border-bottom-right-radius: 4px; }
.chat-msg--other .chat-bubble { background: #f3f4f6; color: #222; border-bottom-left-radius: 4px; }
.chat-text { margin: 0 0 4px 0; white-space: pre-wrap; word-break: break-word; }
.chat-time { font-size: 11px; opacity: 0.65; display: block; text-align: right; margin-top: 4px; }
.chat-file { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; text-decoration: none; margin-top: 4px; font-size: 13px; }
.chat-msg--own .chat-file { background: rgba(255,255,255,0.2); color: white; }
.chat-msg--other .chat-file { background: #e5e7eb; color: #222; }
.chat-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* Inline image in chat bubble */
.chat-img { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; cursor: pointer; margin-top: 4px; }

/* Delete button (doctor only) */
.chat-delete-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.15); border: none; border-radius: 6px; cursor: pointer; font-size: 14px; padding: 2px 5px; opacity: 0; transition: opacity 0.15s; }
.chat-bubble:hover .chat-delete-btn { opacity: 1; }
@media (hover: none) { .chat-delete-btn { opacity: 1; } }

/* Paste preview strip */
.paste-preview { display: none; align-items: center; gap: 8px; padding: 8px 0 4px 0; flex-wrap: wrap; }
.paste-preview.has-image { display: flex; }
.paste-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.paste-preview__remove { background: #dc2626; color: white; border: none; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; margin-left: -28px; margin-top: -70px; align-self: flex-start; }

/* Green chat button + unread badge */
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #0e9b6f; }
.badge-unread { background: #ef4444; color: white; font-size: 11px; padding: 2px 7px; border-radius: 999px; margin-left: 8px; vertical-align: middle; font-weight: 600; display: inline-block; }

/* Clients table — card layout on mobile */
@media (max-width: 640px) {
  .table-clients thead { display: none; }
  .table-clients, .table-clients tbody, .table-clients tr, .table-clients td { display: block; width: 100%; }
  .table-clients tr { border-bottom: 2px solid #e5e7eb; padding: 8px 0; }
  .table-clients td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 6px 16px; text-align: right; }
  .table-clients td::before { content: attr(data-label); font-weight: 600; color: #6b7280; text-align: left; }
}

/* Notes editor — user-resizable height (drag bottom edge) */
.notes-col .CodeMirror { resize: vertical; overflow: auto !important; min-height: 200px; }

/* Doctor chat + notes side-by-side */
.chat-notes-layout { display: flex; gap: 16px; align-items: flex-start; }
.chat-col { flex: 1 1 60%; min-width: 0; }
.notes-col { flex: 1 1 40%; min-width: 0; }
@media (max-width: 900px) {
  .chat-notes-layout { display: block; }
  .notes-col { display: none; }
}

/* Appointment row urgency tiers */
.row-now { background: #fef2f2; }
.row-today { background: #fffbeb; }
.row-future { background: #ffffff; }
.row-past { background: #f9fafb; color: #9ca3af; }
.row-pending td:first-child { border-left: 3px solid #f59e0b; }

/* Video call overlay */
#call-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: #0b1220; flex-direction: column;
  align-items: center; justify-content: center;
}
#remote-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#local-video {
  position: fixed; right: 16px; bottom: 96px; width: 160px; max-width: 32vw;
  border-radius: 10px; border: 2px solid rgba(255,255,255,0.5);
  object-fit: cover; background: #111; z-index: 1101;
}
.call-controls {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; z-index: 1101;
}
.call-btn {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.18); color: #fff; font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.call-btn:hover { background: rgba(255,255,255,0.3); }
.call-btn-end { background: #dc2626; }
.call-btn-end:hover { background: #b91c1c; }
.call-btn-off { background: #dc2626; }       /* выключено (микрофон/камера) */
.call-btn-off:hover { background: #b91c1c; }
.call-btn-active { background: #0066ff; }     /* активная демонстрация экрана */
.call-btn-active:hover { background: #0052cc; }
