/* ============================================================
   ULTRA PREMIUM CORPORATE DESIGN
   Mobile-first, iOS optimized, Dark mode ready
============================================================ */

:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 0;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.verify-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* HEADER CARD */
.verify-header-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: var(--success);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.trust-badge i {
  font-size: 16px;
}

.profile-section {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

/* =========================================================
   PROFILE PHOTO — SINGLE / ID PAGE
   - Supports real profile image + placeholder fallback
   - Inline premium photo edit (pen overlay)
   - Keeps existing circular premium style
========================================================= */

.profile-photo {
  flex-shrink: 0;
  position: relative;
  width: 80px;
  height: 80px;
}

/* Placeholder (no photo uploaded) */
.photo-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid white;
  box-shadow: var(--shadow-md);
}

.photo-placeholder i {
  font-size: 48px;
  color: var(--gray-300);
}

/* Real profile image */
.profile-photo-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  transform: scale(calc(var(--crew-id-photo-zoom, 100) / 100));
  transform-origin: center center;
  border: 3px solid white;
  box-shadow: var(--shadow-md);
  display: block;
}

/* Editable state */
/* Click-to-upload (corporate): pointer + subtle motion + accessible focus */
.profile-photo-editable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* iOS: remove blue tap flash */
}

.profile-photo-img,
.photo-placeholder {
  transition: transform 160ms ease, box-shadow 160ms ease;
  will-change: transform;
}

/* Hover only on real hover devices (prevents iOS weirdness) */
@media (hover: hover) and (pointer: fine) {

  .profile-photo-editable:hover .profile-photo-img,
  .profile-photo-editable:hover .photo-placeholder {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
  }
}

/* Keyboard focus ring (premium + accessibility) */
.profile-photo-editable:focus-visible {
  outline: 2px solid rgba(15, 23, 42, 0.35);
  /* matches --primary */
  outline-offset: 4px;
  border-radius: 50%;
}

.photo-edit-btn i {
  font-size: 14px;
}

.photo-edit-btn:hover {
  background: #1e4ed8;
}

.profile-info {
  flex: 1;
}

.crew-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.crew-rank {
  font-size: 15px;
  color: var(--gray-600);
  margin: 0 0 8px 0;
  font-weight: 500;
}

.verification-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
}

.verification-meta i {
  color: var(--success);
  font-size: 14px;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-buttons .btn-action:nth-child(3) {
  grid-column: 1 / -1;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  /* iOS touch target */
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

/* QR CARD */
.qr-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.qr-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.qr-header i {
  font-size: 20px;
}

.qr-code-wrapper {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: inline-block;
  margin-bottom: 12px;
}

.qr-image {
  max-width: 200px;
  width: 100%;
  height: auto;
  display: block;
}

.qr-description {
  font-size: 13px;
  color: var(--gray-600);
  margin: 0;
}

/* CERTIFICATES SECTION */
.certificates-section {
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0;
}

.cert-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

/* CERTIFICATE GROUPS */
.cert-group {
  background: white;
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-700);
}

.group-header i {
  font-size: 18px;
}

.cert-group.critical .group-header {
  background: #fef2f2;
  color: var(--danger);
  border-bottom-color: #fecaca;
}

.cert-group.critical .group-header i {
  color: var(--danger);
}

.cert-group.valid .group-header {
  background: #ecfdf5;
  color: var(--success);
  border-bottom-color: #a7f3d0;
}

.cert-group.valid .group-header i {
  color: var(--success);
}

.cert-group.qualifications .group-header {
  background: #eff6ff;
  color: var(--info);
  border-bottom-color: #bfdbfe;
}

.cert-group.qualifications .group-header i {
  color: var(--info);
}

/* Collapsible header */
.collapsible {
  width: 100%;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.collapsible:hover {
  background: #e0f2fe;
}

.group-header-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-header-split {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-header-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  box-shadow: none;
  appearance: none;
}

.group-header-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.collapse-icon {
  transition: transform 0.3s ease;
  font-size: 16px;
}

.collapse-icon.rotated {
  transform: rotate(180deg);
}

.cert-group.qualifications .group-header-toggle:hover,
.cert-group.qualifications .group-header-toggle:focus-visible {
  background: transparent;
  box-shadow: none;
  outline: none;
}

/* CERTIFICATE CARDS */
.cert-list {
  padding: 0;
}

.cert-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s;
}

.cert-card:last-child {
  border-bottom: none;
}

.cert-card:active {
  background: var(--gray-50);
}

.cert-header {
  display: flex;
  gap: 12px;
  flex: 1;
}

.cert-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.cert-icon.status-danger {
  background: #fee2e2;
  color: var(--danger);
}

.cert-icon.status-warning {
  background: #fef3c7;
  color: var(--warning);
}

.cert-icon.status-success {
  background: #d1fae5;
  color: var(--success);
}

.cert-icon.status-info {
  background: #dbeafe;
  color: var(--info);
}

.cert-info {
  flex: 1;
}

.cert-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.cert-date {
  font-size: 13px;
  color: var(--gray-600);
  margin: 0;
}

.cert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-danger {
  background: #fee2e2;
  color: var(--danger);
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.btn-view-cert {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-view-cert:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  transform: translateY(-1px);
}

.btn-view-cert i {
  font-size: 18px;
  color: var(--gray-600);
}

/* FOOTER */
.verify-footer {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.security-badge i {
  font-size: 28px;
  color: var(--primary);
}

.security-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.security-text {
  font-size: 12px;
  color: var(--gray-600);
  margin: 0;
}

.footer-text {
  font-size: 12px;
  color: var(--gray-600);
  margin: 0;
  line-height: 1.5;
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .verify-container {
    max-width: 760px;
    padding: 28px 24px 40px;
  }

  .verify-header-card,
  .qr-card {
    padding: 28px;
  }

  .profile-section {
    align-items: center;
    gap: 20px;
  }

  .profile-photo,
  .photo-placeholder,
  .profile-photo-img {
    width: 96px;
    height: 96px;
  }

  .crew-name {
    font-size: 30px;
  }

  .crew-rank {
    font-size: 16px;
  }

  .action-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-buttons .btn-action:nth-child(3) {
    grid-column: auto;
  }

  .btn-action {
    min-height: 48px;
  }

  .group-header,
  .cert-card {
    padding: 18px 22px;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .section-header {
    align-items: flex-start;
    gap: 12px;
  }

  .cert-count {
    align-self: flex-start;
  }
}

/* RESPONSIVE */
@media (max-width: 375px) {
  .verify-container {
    padding: 16px 12px;
  }

  .crew-name {
    font-size: 20px;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here if needed */
}

/* PRINT STYLES */
@media print {
  body {
    background: white;
  }

  .verify-container {
    max-width: 100%;
  }

  .action-buttons,
  .btn-view-cert {
    display: none;
  }
}
