/* ═══════════════════════════════════════════════════════
   Visual Voicemail — Stylesheet
   Matches the project tracker aesthetic:
   system fonts, #f3f4f6 bg, white cards, #1e293b dark,
   #3b82f6 blue accents
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #f3f4f6;
  color: #1f2937;
  line-height: 1.5;
  min-height: 100vh;
}

.view {
  min-height: 100vh;
}

/* ── Login ─────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e293b 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-icon {
  width: 48px;
  height: 48px;
  color: #3b82f6;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}

.login-header p {
  font-size: 14px;
  color: #64748b;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-group input::placeholder {
  color: #9ca3af;
}

.form-error {
  background: #fef2f2;
  color: #dc2626;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  margin-bottom: 16px;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-primary:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 16px;
  font-size: 13px;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-action {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-action:hover {
  background: #e5e7eb;
}

.btn-action svg {
  width: 16px;
  height: 16px;
}

.btn-danger {
  color: #dc2626;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

/* ── App Header ────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-bottom: 3px solid #3b82f6;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.header-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.header-user {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
}

/* ── Main Content ──────────────────────────────────── */
.main-content {
  padding: 24px 0 80px;
}

.content-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Folder Tabs ───────────────────────────────────── */
.folder-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover {
  background: #f3f4f6;
  color: #374151;
}

.tab.active {
  background: #3b82f6;
  color: #fff;
}

.tab.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 11px;
  background: #e5e7eb;
  color: #64748b;
}

/* ── Voicemail List ────────────────────────────────── */
.voicemail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voicemail-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  border-left: 4px solid transparent;
}

.voicemail-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.voicemail-card.unread {
  border-left-color: #3b82f6;
  background: #fafbff;
}

.voicemail-card.unread .vm-caller-name {
  font-weight: 700;
}

.voicemail-card.urgent {
  border-left-color: #ef4444;
}

.vm-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.vm-caller-info {
  min-width: 0;
  flex: 1;
}

.vm-caller-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vm-caller-number {
  font-size: 13px;
  color: #64748b;
  margin-top: 1px;
}

.vm-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-align: right;
}

.vm-date {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

.vm-duration {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.vm-transcript-preview {
  font-size: 13px;
  color: #6b7280;
  margin-top: 8px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vm-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  flex-shrink: 0;
  margin-top: 6px;
}

/* ── Empty State ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.empty-subtitle {
  font-size: 14px;
  color: #9ca3af;
}

/* ── Loading State ─────────────────────────────────── */
.loading-state {
  text-align: center;
  padding: 60px 24px;
  color: #64748b;
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  color: #64748b;
  transition: background 0.15s;
}

.modal-close:hover {
  background: #e5e7eb;
  color: #1e293b;
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  padding: 24px;
}

/* ── Detail Meta Grid ──────────────────────────────── */
.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
}

/* ── Audio Player ──────────────────────────────────── */
.detail-audio {
  margin-bottom: 24px;
}

.detail-audio audio {
  width: 100%;
  border-radius: 8px;
  outline: none;
}

/* ── Transcript ────────────────────────────────────── */
.detail-transcript {
  margin-bottom: 24px;
}

.detail-transcript h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.transcript-text {
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  background: #f9fafb;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.transcript-text.no-transcript {
  color: #9ca3af;
  font-style: italic;
}

/* ── Detail Actions ────────────────────────────────── */
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner {
    padding: 12px 16px;
  }

  .header-title {
    font-size: 15px;
  }

  .header-user {
    display: none;
  }

  .content-inner {
    padding: 0 16px;
  }

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

  .folder-tabs {
    margin-bottom: 16px;
  }

  .tab {
    padding: 8px 12px;
    font-size: 13px;
  }

  .voicemail-card {
    padding: 14px 16px;
  }

  .vm-top-row {
    flex-direction: column;
    gap: 4px;
  }

  .vm-meta {
    text-align: left;
    justify-content: flex-start;
  }

  .vm-caller-name {
    font-size: 14px;
  }

  .login-card {
    padding: 28px 24px;
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    animation: modalSlideUp 0.25s ease-out;
  }

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

  .detail-meta {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-actions .btn-action {
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .tab {
    font-size: 12px;
    padding: 8px 8px;
    gap: 4px;
  }

  .tab-count {
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }
}
