@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;600;700&family=Google+Sans+Display:wght@400;500;700&family=Roboto:wght@300;400;500&display=swap');

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --secondary: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
  --warning-dark: #f29900;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #f1f3f4;
  --border: #e0e0e0;
  --border-focus: #1a73e8;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #9aa0a6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.10), 0 4px 10px rgba(0,0,0,0.06);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: cubic-bezier(0.2, 0, 0, 1);
}

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

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Roboto', sans-serif;
  background: var(--surface-2);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ── APP SHELL ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.app-logo svg { flex-shrink: 0; }

.app-logo-text {
  font-family: 'Google Sans', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.app-logo-text span { color: var(--primary); }

.header-spacer { flex: 1; }

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
}

/* ── MAIN LAYOUT ── */
.app-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .app-content { grid-template-columns: 1fr; }
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { color: var(--primary); }

.card-body { padding: 24px; }

/* ── FORM ELEMENTS ── */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Roboto', sans-serif;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.2s var(--transition), box-shadow 0.2s var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-control::placeholder { color: var(--text-tertiary); }

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

.input-prefix-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 14px;
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
  font-weight: 500;
}

.input-prefix + .form-control { padding-left: 38px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 3px rgba(26,115,232,0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(26,115,232,0.4);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 6px 12px;
}

.btn-ghost:hover { background: var(--primary-light); border-radius: 20px; }

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

.btn-full { width: 100%; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-icon:hover { background: var(--surface-3); color: var(--text-primary); }

/* ── LOADER ── */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── STATUS BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  letter-spacing: 0.2px;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-pago { background: #e6f4ea; color: #1e8e3e; }
.badge-pago .badge-dot { background: #34a853; }
.badge-pendente { background: #fef7e0; color: #b06000; }
.badge-pendente .badge-dot { background: var(--warning-dark); }
.badge-cancelado { background: #fce8e6; color: #c5221f; }
.badge-cancelado .badge-dot { background: var(--danger); }
.badge-erro { background: #fce8e6; color: #c5221f; }
.badge-erro .badge-dot { background: var(--danger); }

/* ── COBRANÇAS LIST ── */
.cobranca-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cobranca-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  background: transparent;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  font-family: inherit;
  color: inherit;
}

.cobranca-item:last-child { border-bottom: none; }

.cobranca-item:hover { background: var(--surface-2); }

.cobranca-item:active { background: var(--surface-3); }

.cobranca-info { min-width: 0; }

.cobranca-desc {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  font-family: 'Google Sans', sans-serif;
}

.cobranca-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cobranca-meta-dot { color: var(--border); }

.cobranca-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.cobranca-valor {
  font-size: 15px;
  font-weight: 600;
  font-family: 'Google Sans', sans-serif;
  color: var(--text-primary);
}

/* ── TAB LINK ── */
.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Google Sans', sans-serif;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.tab-link:hover { background: var(--primary-light); }

/* ── MODAL OVERLAY ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--transition);
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ── DETAIL ROWS ── */
.detail-group { margin-bottom: 20px; }

.detail-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-all;
}

.detail-value.large {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Google Sans Display', sans-serif;
  color: var(--text-primary);
}

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

/* ── LINK BOX ── */
.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.link-text {
  flex: 1;
  font-size: 13px;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Roboto Mono', monospace;
  font-family: monospace;
}

.copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Google Sans', sans-serif;
  transition: background 0.15s;
}

.copy-btn:hover { background: var(--primary-dark); }

.copy-btn.copied { background: var(--secondary); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.empty-state svg {
  margin: 0 auto 16px;
  opacity: 0.4;
  display: block;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
}

.empty-state-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #323232;
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-family: 'Google Sans', sans-serif;
  pointer-events: all;
  animation: slideUp 0.3s var(--transition) both;
  max-width: 360px;
}

.toast.success { background: #1e8e3e; }
.toast.error { background: #c5221f; }

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

.toast.hiding {
  animation: fadeOut 0.3s var(--transition) forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* ── TODAS COBRANÇAS VIEW ── */
.todas-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-3);
  border-radius: 24px;
  padding: 8px 14px;
}

.search-box svg { color: var(--text-tertiary); flex-shrink: 0; }

.search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  width: 100%;
  font-family: 'Roboto', sans-serif;
}

.search-input::placeholder { color: var(--text-tertiary); }

/* ── SKELETONS ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--surface);
  padding: 12px 16px;
  text-align: center;
}

.stat-num {
  font-family: 'Google Sans Display', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ── CAPTURE METHOD ICONS ── */
.capture-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Spinner inline */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 14px;
}
