/* App shell styles — matches theme.css design language */

/* Layout */
.app-body {
  background: var(--bg);
  font-family: 'Figtree', sans-serif;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 32px;
  border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--fg);
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 24px 12px;
  gap: 4px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  background: var(--bg-alt);
  color: var(--fg);
}

.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-link.active svg {
  stroke: var(--accent);
}

.sidebar-link.muted {
  font-size: 13px;
  color: var(--fg-muted);
  opacity: 0.6;
}

.sidebar-footer {
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
}

/* Main content */
.app-content {
  flex: 1;
  padding: 40px 48px;
  max-width: 900px;
}

/* Page title */
.page-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--fg-muted);
  margin-bottom: 40px;
}

/* Sections */
.section {
  margin-bottom: 48px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
  margin-bottom: 16px;
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-label span {
  font-weight: 400;
  color: var(--fg-muted);
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Figtree', sans-serif;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Figtree', sans-serif;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #e64400;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--fg-muted);
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-sent {
  background: var(--bg-alt);
  color: var(--fg-muted);
}

.badge-replied {
  background: #dcfce7;
  color: #16a34a;
}

.badge-bounced {
  background: #fef2f2;
  color: #dc2626;
}

.badge-active {
  background: #dcfce7;
  color: #16a34a;
}

.badge-draft {
  background: var(--bg-alt);
  color: var(--fg-muted);
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
  padding: 20px 24px;
  background: var(--fg);
  border-radius: 12px;
  color: white;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: #999;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value.green { color: var(--terminal-green); }

/* Activity feed */
.feed-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.dot-sent { background: var(--fg-muted); }
.dot-replied { background: var(--terminal-green); }
.dot-bounced { background: #dc2626; }

.feed-body {
  flex: 1;
}

.feed-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}

.feed-company {
  font-size: 13px;
  color: var(--fg-muted);
  margin-left: 6px;
}

.feed-subject {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 500px;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.feed-time {
  font-size: 12px;
  color: var(--fg-muted);
}

.feed-reply-preview {
  font-size: 13px;
  color: var(--terminal-green);
  margin-top: 4px;
  font-style: italic;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--fg-muted);
}

.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--fg);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 24px;
}

/* Campaign cards */
.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.campaign-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.campaign-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.campaign-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}

.campaign-meta {
  font-size: 12px;
  color: var(--fg-muted);
}

.campaign-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Contact list */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
}

.contact-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
}

.contact-title {
  font-size: 12px;
  color: var(--fg-muted);
}

.contact-email {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.tab-btn:hover { color: var(--fg); }

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

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: toastIn 0.2s ease;
  z-index: 1000;
}

.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--fg);
  margin-bottom: 24px;
}

/* Mobile */
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .app-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-logo { padding: 0 16px 0 0; border-bottom: none; }
  .sidebar-nav { flex-direction: row; padding: 0 16px; gap: 0; }
  .sidebar-link span { display: none; }
  .sidebar-footer { display: none; }
  .app-content { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-bar { flex-wrap: wrap; gap: 16px; }
}