* {
  box-sizing: border-box;
}

body {
  background: #1a1a1a;
  color: #f5f5f5;
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 16px;
  border-bottom: 1px solid #333;
}

header h1 {
  margin: 0;
  font-size: 24px;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

#record-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

#label-input {
  width: 100%;
  background: #2a2a2a;
  color: #f5f5f5;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  margin-bottom: 24px;
}

#label-input::placeholder {
  color: #666;
}

#record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #e53935;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  transition: transform 0.1s;
}

#record-btn:active {
  transform: scale(0.95);
}

#record-btn.recording {
  animation: pulse 2s infinite;
}

#record-icon {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s;
}

#record-btn.recording #record-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

#timer {
  font-size: 24px;
  font-family: 'Courier New', monospace;
  color: #999;
  text-align: center;
  margin-top: 8px;
}

#status-bar {
  margin-bottom: 24px;
}

#status-bar.hidden {
  display: none;
}

#status-text {
  font-size: 14px;
  color: #999;
  margin-bottom: 8px;
}

#progress-container {
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: #e53935;
  width: 0%;
  transition: width 0.3s;
}

#recordings-section h2 {
  font-size: 18px;
  color: #999;
  margin-bottom: 12px;
}

#recordings-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#empty-state {
  color: #666;
  text-align: center;
  padding: 32px;
  font-style: italic;
}

.recording-item {
  background: #2a2a2a;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recording-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.recording-label {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.recording-meta {
  font-size: 13px;
  color: #999;
}

.recording-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 12px;
}

.status-uploaded,
.status-done {
  background: #4caf50;
}

.status-uploading,
.status-processing {
  background: #ff9800;
}

.status-failed {
  background: #e53935;
}

.delete-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  padding: 4px 8px;
  margin-left: 8px;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
}

.delete-btn:active {
  background: #e53935;
  color: #fff;
}

.retry-btn {
  background: #e8f5e9;
  border: 1px solid #66bb6a;
  color: #2e7d32;
  font-size: 16px;
  padding: 4px 10px;
  margin-left: 8px;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  font-weight: bold;
}

.retry-btn:active {
  background: #66bb6a;
  color: #fff;
}

/* Summary preview in recording cards */
.recording-preview {
  font-size: 13px;
  color: #888;
  line-height: 1.4;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recording-status-text {
  font-size: 13px;
  color: #ff9800;
  margin-top: 6px;
}

.recording-item.tappable {
  cursor: pointer;
}

.recording-item.tappable:active {
  background: #333;
}

/* ── Detail View ── */
.detail-view {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.detail-view.hidden {
  display: none;
}

.detail-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.detail-back {
  background: none;
  border: none;
  color: #f5f5f5;
  font-size: 24px;
  padding: 4px 16px 4px 0;
  cursor: pointer;
}

.detail-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-title span:first-child {
  font-weight: 600;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-title span:last-child {
  font-size: 13px;
  color: #999;
  margin-top: 2px;
}

/* Scrollable markdown content */
.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  line-height: 1.6;
}

/* Markdown rendering — dark theme */
.detail-content h1 {
  font-size: 20px;
  margin: 24px 0 8px;
  color: #f5f5f5;
  border-bottom: 1px solid #333;
  padding-bottom: 6px;
}

.detail-content h1:first-child {
  margin-top: 0;
}

.detail-content h2 {
  font-size: 17px;
  margin: 18px 0 6px;
  color: #ddd;
}

.detail-content p {
  margin: 8px 0;
  color: #ccc;
}

.detail-content ul,
.detail-content ol {
  padding-inline-start: 24px;
  margin: 8px 0;
}

.detail-content li {
  margin: 6px 0;
  line-height: 1.5;
  color: #ccc;
}

.detail-content strong {
  color: #f5f5f5;
}

.detail-content em {
  color: #bbb;
}

.detail-content blockquote {
  border-inline-start: 3px solid #555;
  padding-inline-start: 12px;
  margin: 12px 0;
  color: #aaa;
}

/* Transcript link at bottom of summary */
.transcript-link {
  display: inline-block;
  margin-top: 32px;
  padding: 10px 0;
  color: #7ca8d6;
  font-size: 15px;
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.transcript-link:active {
  color: #9cc0e8;
}

/* Back-to-summary link (shown when viewing transcript) */
.back-to-summary {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 0;
  color: #7ca8d6;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
}

/* Action bar */
.detail-actions {
  display: flex;
  padding: 12px 16px;
  border-top: 1px solid #333;
  flex-shrink: 0;
}

.action-btn {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #f5f5f5;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  flex: 1;
  text-align: center;
}

.action-btn:active {
  background: #444;
}

/* ── Upload button ── */
#upload-btn {
  background: none;
  border: 1px solid #444;
  color: #999;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
}

#upload-btn:active {
  background: #2a2a2a;
  color: #f5f5f5;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.5);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(229, 57, 53, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229, 57, 53, 0);
  }
}

/* Refresh button in header */
header {
  position: relative;
}

#refresh-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid #444;
  border-radius: 6px;
  color: #888;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

#refresh-btn:hover {
  color: #ccc;
  border-color: #666;
}

#refresh-btn:active {
  color: #fff;
}

/* Edit/rename button */
.edit-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}
.edit-btn:hover {
  color: #1976d2;
  background: rgba(25, 118, 210, 0.1);
}

/* Share button (WhatsApp fallback) */
.share-btn {
  background: none;
  border: none;
  color: #25d366;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}
.share-btn:hover {
  background: rgba(37, 211, 102, 0.1);
}

/* Mode selector */
#mode-select {
  display: block;
  margin: 8px auto;
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: #333;
  cursor: pointer;
  text-align: center;
}

/* Chat drawer */
.chat-drawer {
  border-top: 1px solid #444;
  background: #1a1a1a;
  padding: 12px 16px;
  flex-shrink: 0;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
}
.chat-drawer.hidden {
  display: none;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 8px;
  min-height: 0;
}
.chat-msg {
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-user {
  background: #e3f2fd;
  color: #1565c0;
  text-align: right;
  margin-left: 20%;
}
.chat-ai {
  background: #f5f5f5;
  color: #333;
  margin-right: 10%;
}
.chat-ai p { margin: 4px 0; }
.chat-ai ul, .chat-ai ol { margin: 4px 0; padding-left: 20px; }
.chat-loading {
  color: #999;
  font-style: italic;
}
.chat-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
}
#chat-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid #444;
  border-radius: 20px;
  font-size: 1rem;
  outline: none;
  background: #2a2a2a;
  color: #f5f5f5;
}
#chat-input:focus {
  border-color: #1976d2;
}
#chat-input::placeholder {
  color: #888;
}
.chat-send-btn {
  background: #1976d2;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  min-width: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-send-btn:active {
  background: #1565c0;
}

/* ── Tab Navigation ── */
#tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-top: 8px;
}
.tab {
  background: none;
  border: 1px solid #444;
  color: #999;
  padding: 6px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab:first-child {
  border-radius: 6px 0 0 6px;
}
.tab:last-child {
  border-radius: 0 6px 6px 0;
}
.tab.active {
  background: #e53935;
  color: #fff;
  border-color: #e53935;
}

/* ── Zoom Capture Button ── */
#zoom-btn {
  background: none;
  border: 1px solid #2196f3;
  color: #2196f3;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
}
#zoom-btn:active {
  background: #2196f3;
  color: #fff;
}

/* ── Zoom Capture Bar ── */
#zoom-bar {
  background: #1b2838;
  border: 1px solid #2196f3;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#zoom-bar.hidden {
  display: none;
}
.zoom-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2196f3;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
#zoom-bar-label {
  flex: 1;
  font-size: 14px;
  color: #ccc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#zoom-bar-timer {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  color: #2196f3;
}
#zoom-stop-btn {
  background: #e53935;
  border: none;
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
#zoom-stop-btn:active {
  background: #c62828;
}

/* ── Section visibility (tab switching) ── */
#recordings-section.hidden,
#record-section.hidden,
#upcoming-section.hidden {
  display: none;
}
#schedule-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
#schedule-form input,
#schedule-form select {
  width: 100%;
  background: #2a2a2a;
  color: #f5f5f5;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
}
#schedule-form input::placeholder {
  color: #666;
}
#sched-submit-btn {
  background: #2196f3;
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 500;
}
#sched-submit-btn:active {
  background: #1976d2;
}
#schedules-empty {
  color: #666;
  text-align: center;
  padding: 24px;
  font-style: italic;
}

/* ── Zoom source badge ── */
.zoom-badge {
  display: inline-block;
  background: #1b2838;
  color: #2196f3;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Calendar Import ── */
#cal-import-btn {
  width: 100%;
  background: none;
  border: 1px dashed #444;
  color: #999;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
}
#cal-import-btn:hover {
  border-color: #2196f3;
  color: #2196f3;
}
#cal-import-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
#cal-events.hidden {
  display: none;
}
.cal-event-item {
  background: #2a2a2a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-schedule-btn {
  background: #2196f3;
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.zoom-link {
  font-size: 12px;
  color: #7ca8d6;
  text-decoration: none;
  margin-top: 4px;
  display: inline-block;
}
.zoom-link:hover {
  text-decoration: underline;
}
.cal-schedule-btn.scheduled {
  background: #4caf50;
  cursor: pointer;
}
.cal-schedule-btn.scheduled:active {
  background: #e53935;
}
.cal-schedule-btn:disabled {
  background: #4caf50;
  cursor: default;
}
