:root {
  --bg-main: #090d16;
  --bg-card: rgba(16, 24, 40, 0.75);
  --bg-card-hover: rgba(23, 34, 56, 0.85);
  --bg-toolbar: rgba(14, 21, 37, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.2);
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-rose: #f43f5e;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem 1.5rem;
}

/* Header */
.app-header {
  margin-bottom: 2rem;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px var(--accent-emerald-glow);
  color: #fff;
}

.brand-icon svg {
  width: 26px;
  height: 26px;
}

.brand h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

/* Cards Generales */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Search Form */
.input-card {
  padding: 1.5rem;
}

.input-group {
  display: flex;
  align-items: center;
  background: rgba(9, 13, 22, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  transition: var(--transition);
}

.input-group:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.input-icon {
  display: flex;
  align-items: center;
  color: var(--text-dim);
  margin-right: 0.75rem;
}

.input-icon svg {
  width: 20px;
  height: 20px;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.98rem;
  font-family: inherit;
}

.input-group input::placeholder {
  color: var(--text-dim);
}

.quick-examples {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.examples-label {
  color: var(--text-dim);
}

.btn-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-chip:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: #fff;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
}

.btn > * {
  pointer-events: none;
}

/* Encabezados de grupo por emisor */
.issuer-section-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-left: 4px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  margin-bottom: 0.25rem;
}

.issuer-section-header:first-child {
  margin-top: 0;
}

.issuer-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.issuer-header-left h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.issuer-count-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.issuer-header-right {
  display: flex;
  gap: 0.5rem;
}

.btn-issuer-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-issuer-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-emerald-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

.btn-success:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.btn-svg {
  width: 18px;
  height: 18px;
}

.count-pill {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Profile Card */
.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.avatar-wrapper {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-meta h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
}

.username-tag {
  color: var(--accent-emerald);
  font-size: 0.88rem;
  font-weight: 500;
}

.stats-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  min-width: 120px;
  text-align: center;
}

.stat-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-active .stat-value {
  color: var(--accent-emerald);
}

.stat-expired .stat-value {
  color: var(--accent-amber);
}

.stat-selected .stat-value {
  color: var(--accent-blue);
}

/* Toolbar & Filters */
.toolbar-section {
  background: var(--bg-toolbar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.segmented-control {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.segment-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.segment-btn:hover {
  color: var(--text-main);
}

.segment-btn.active {
  background: var(--bg-card-hover);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.badge-tag {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.custom-select, .custom-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.custom-select:focus, .custom-input:focus {
  border-color: var(--border-focus);
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Status Message */
.status-message {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

/* Badges Grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* Badge Card */
.badge-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  user-select: none;
}

.badge-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.badge-card.is-selected {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 1px var(--accent-emerald), 0 8px 24px var(--accent-emerald-glow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
}

.badge-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-emerald);
}

.badge-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.status-active-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-expired-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0 1rem 0;
}

.badge-art {
  width: 105px;
  height: 105px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
  transition: transform 0.25s ease;
}

.badge-card:hover .badge-art {
  transform: scale(1.05);
}

.badge-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.badge-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.badge-issuer {
  font-size: 0.85rem;
  color: var(--accent-emerald);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.badge-dates {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  margin-top: auto;
}

.date-row {
  display: flex;
  justify-content: space-between;
}

.date-label {
  color: var(--text-muted);
}

.date-val {
  color: var(--text-main);
  font-weight: 500;
}

.card-footer {
  margin-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.credly-link {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
}

.credly-link:hover {
  color: var(--accent-emerald);
}

.credly-link svg {
  width: 12px;
  height: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: var(--radius-full);
  transition: width 0.2s ease;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Responsive */
@media (max-width: 768px) {
  .app-layout {
    padding: 1rem;
  }
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group, .layout-group {
    flex-direction: column;
    align-items: stretch;
  }
  .segmented-control {
    width: 100%;
    justify-content: space-around;
  }
  .selection-actions {
    justify-content: space-between;
  }
  .stats-grid {
    width: 100%;
    justify-content: space-between;
  }
  .stat-box {
    flex: 1 1 45%;
  }
}
