/* ===== Reset & Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #333;
}

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.viewer-container {
  max-width: 800px;
}

/* ===== Header ===== */
.header {
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.header-content {
  text-align: center;
  flex: 1;
}

.logo {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.tagline {
  font-size: 14px;
  color: #666;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

#user-email {
  font-size: 14px;
  color: #667eea;
  font-weight: 600;
}

/* ===== Status Bar ===== */
.status-bar {
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

#connection-status {
  font-size: 13px;
  color: #10b981;
  font-weight: 600;
}

/* ===== Main Content ===== */
.main-content {
  margin-bottom: 32px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 20px;
}

/* ===== App Grid ===== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.app-item {
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border: 2px solid transparent;
}

.app-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.3);
}

.app-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  object-fit: contain;
  border-radius: 8px;
}

.app-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  min-height: 34px;
}

/* ===== Loading & Empty States ===== */
.loading-state,
.empty-state,
.error-state {
  text-align: center;
  padding: 48px 20px;
  color: #666;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary,
.btn-back {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

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

.btn-secondary-small {
  padding: 8px 16px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-small:hover {
  background: #e5e7eb;
}

.btn-back {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  padding: 10px 20px;
}

.btn-back:hover {
  background: #667eea;
  color: white;
}

.btn-large {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  margin-top: 24px;
}

/* ===== Account Viewer Styles ===== */
.app-logo-large {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.app-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
}

.accounts-section {
  margin-top: 32px;
}

.accounts-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.account-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.account-card:hover {
  border-color: rgba(102, 126, 234, 0.2);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.12);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f0f0f0;
}

.account-number {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.field-group {
  margin-bottom: 16px;
}

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

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.field-value-container {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.field-value {
  flex: 1;
  background: #f8f9fa;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 15px;
  color: #1a1a2e;
  font-family: "Courier New", monospace;
  word-break: break-all;
  font-weight: 600;
}

.copy-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-btn.copied {
  background: #10b981;
}

.info-note {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 16px;
  margin-top: 24px;
  font-size: 14px;
  color: #856404;
}

.info-note strong {
  display: block;
  margin-bottom: 6px;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  color: #666;
  font-size: 13px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 32px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .header {
    flex-direction: column;
    text-align: center;
  }

  .user-info {
    width: 100%;
    justify-content: center;
  }

  .field-value-container {
    flex-direction: column;
  }

  .copy-btn {
    width: 100%;
  }
}
