*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0f17;
  --surface: #161929;
  --surface2: #1e2236;
  --border: #2a2f4a;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --red: #f87171;
  --green: #34d399;
  --text: #e2e8f0;
  --muted: #64748b;
  --pulse: #6c63ff;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Pastikan ini yang ada di styles.css */
.header-logo-img {
  height: 32px;
  width: 32px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface2);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  /* Kunci tinggi tetap */
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  white-space: nowrap;
  overflow: hidden;
  /* Mencegah elemen keluar jalur */
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#timer {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-width: 60px;
  text-align: right;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.3s;
}

.status-badge.active {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--green);
}

.status-badge.active .dot {
  background: var(--green);
  animation: blink 1.2s infinite;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.3
  }
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  height: calc(100vh - 65px);
  overflow: hidden;
}

.panel-left {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.transcript-area {
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

#transcript-box {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  overflow-y: auto;
  line-height: 1.8;
  font-size: 1rem;
  color: var(--text);
  scroll-behavior: smooth;
  outline: none;
  caret-color: var(--accent2);
  white-space: pre-wrap;
  word-break: break-word;
}

#transcript-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.edit-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.interim-text {
  color: var(--muted);
  font-style: italic;
}

.final-text {
  color: var(--text);
}

.timestamp {
  font-size: 0.7rem;
  color: var(--accent2);
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

.placeholder {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding-top: 60px;
}

.placeholder .mic-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  opacity: 0.3;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-record {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 28px;
  border-radius: 999px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 4px 24px rgba(108, 99, 255, 0.35);
}

.btn-record.recording {
  background: linear-gradient(135deg, #ef4444, #f97316);
  box-shadow: 0 4px 24px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent2);
  background: rgba(108, 99, 255, 0.1);
}

button:disabled, .btn-secondary:disabled, .btn-gen-summary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(100%);
}

.sidebar {
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 14px 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}

.tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
}

.tab-panel.active {
  display: flex;
}

#notes-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  resize: none;
  outline: none;
}

#summary-box {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.7;
}

.btn-gen-summary {
  margin-top: 10px;
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--accent2);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.waveform-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 40px;
  margin-left: auto;
}

.wave-bar {
  width: 4px;
  border-radius: 2px;
  background: var(--accent2);
  opacity: 0.3;
}

.recording-active .wave-bar {
  opacity: 0.9;
  animation: wave-anim 0.8s ease-in-out infinite alternate;
}

@keyframes wave-anim {
  from {
    height: 4px;
  }

  to {
    height: 32px;
  }
}

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.history-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.history-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.history-item .title {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .meta {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.history-item:hover .history-actions {
  opacity: 1;
}

.history-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.delete-btn,
.share-item-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.delete-btn {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
}

.share-item-btn {
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent2);
}

.delete-btn:hover,
.share-item-btn:hover {
  transform: scale(1.15);
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--muted);
}

.error-msg {
  padding: 16px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-size: 0.9rem;
  margin-top: 10px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.ai-section {
  margin-bottom: 12px;
}

.ai-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 6px;
}

.ai-section ul {
  padding-left: 16px;
}

.ai-section li {
  margin-bottom: 4px;
  font-size: 0.86rem;
  line-height: 1.6;
}

.lang-select {
  padding: 8px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.83rem;
  cursor: pointer;
  outline: none;
}

.dl-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.dl-overlay.show {
  display: flex;
}

.dl-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  width: min(620px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.dl-content {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
  font-size: 0.83rem;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: 'Inter', monospace;
  color: var(--text);
}

/* ── Footer ── */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 28px;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.footer-logo {
  font-size: 1rem;
}

.footer-center {
  flex: 1;
  text-align: center;
}

.footer-copy strong {
  color: var(--text);
}

.footer-copy a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.footer-copy a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* styles.css */

.api-key-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

#btn-reset-key {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 12px;
  height: 42px;
  /* Sesuaikan dengan tinggi input */
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-reset-key:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* ── Mobile Responsive (Aesthetics & Layout) ── */
@media (max-width: 768px) {
  /* Layout Stacking */
  main {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  .transcript-area {
    padding: 16px;
    height: calc(60vh - 64px);
    min-height: 400px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar {
    height: auto;
    border-left: none;
  }

  /* Header Optimization */
  header {
    height: 64px !important;
    padding: 0 12px !important;
  }

  .logo {
    gap: 8px !important;
  }

  .logo span {
    font-size: 0.9rem;
  }

  .header-logo-img {
    height: 28px;
    width: 28px;
  }

  .header-right {
    gap: 6px;
  }

  .lang-select {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  #timer {
    font-size: 0.9rem;
    min-width: auto;
    letter-spacing: 0.5px;
  }

  .status-badge {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  /* Transcript Area Optimization */
  #transcript-box {
    padding: 16px;
    font-size: 0.92rem;
    border-radius: 12px;
  }

  .section-label {
    font-size: 0.68rem;
    margin-bottom: 10px;
  }

  /* Controls (Finger Friendly & Premium Grid) */
  .controls {
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
  }

  .btn-record {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 0.95rem;
    border-radius: 12px;
  }

  .btn-secondary {
    flex: 1 1 calc(50% - 8px); /* Two buttons per row */
    padding: 12px 14px;
    font-size: 0.82rem;
    border-radius: 12px;
    min-width: 120px;
  }

  /* Mode Switcher styling */
  .mode-switcher {
    gap: 8px;
  }

  .mode-btn {
    padding: 8px 12px;
    border-radius: 8px;
  }

  .mode-btn .mode-title {
    font-size: 0.8rem;
  }

  .mode-btn .mode-desc {
    display: none; /* Hide descriptions on mobile to save height */
  }

  .mode-btn .mode-icon {
    font-size: 1rem;
  }

  /* Sidebar Optimization */
  .sidebar-tabs {
    background: var(--surface2);
  }

  .tab {
    padding: 14px 0;
    font-size: 0.78rem;
  }

  .tab-panel {
    padding: 12px;
    height: auto;
  }

  #notes-input {
    min-height: 250px;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.88rem;
  }

  #summary-box {
    min-height: 300px;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.88rem;
  }

  /* Tab AI specific */
  .tab-ai-steps {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .tab-ai-steps .arrow {
    display: none; /* Hide arrows on mobile */
  }

  .tab-ai-steps .step {
    background: var(--surface2);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
  }

  /* Modals */
  .dl-modal {
    padding: 20px;
    border-radius: 16px;
  }

  /* Footer */
  .app-footer {
    padding: 20px 16px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .footer-center {
    order: 3;
    width: 100%;
  }

  .footer-copy {
    order: 2;
  }

  .footer-brand {
    order: 1;
  }
}