/* ==========================================================================
   PORTAL VERIFIKASI SERTIFIKAT DIGITAL RESMI - BRAIN IPB UNIVERSITY
   Compact 1-Screen (Single Viewport) Native CSS Stylesheet
   ========================================================================== */

:root {
  --primary: #0b1f3a;
  --primary-dark: #061325;
  --accent-blue: #0284c7;
  --accent-blue-dark: #0369a1;
  --accent-cyan: #06b6d4;
  --accent-emerald: #059669;
  --accent-emerald-light: #ecfdf5;
  --accent-emerald-border: #a7f3d0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  
  --bg-card: #ffffff;
  --border-light: #e2e8f0;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden; /* Strict 1-screen, no page scroll */
  font-family: var(--font-sans);
  background: radial-gradient(circle at 50% 15%, #183e6d 0%, #0b1f3a 55%, #050e1a 100%);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Wrapper: Fixed Full-Viewport Flex Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Background Subtle Grid Texture */
.app-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(rgba(56, 189, 248, 0.1) 1px, transparent 1px),
    radial-gradient(rgba(16, 185, 129, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  pointer-events: none;
  z-index: 0;
}

/* Header Navbar: Fixed Height */
.app-header {
  flex-shrink: 0;
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  position: relative;
  z-index: 10;
}

.header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-emerald {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.btn-outline:hover {
  background: #f0f9ff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Main Content: Flex Centered Single Screen Area */
.app-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1.5rem;
  position: relative;
  z-index: 2;
  overflow-y: auto; /* Fallback if viewport is extremely short */
}

.verifier-panel {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Compact Heading */
.panel-header {
  text-align: center;
  color: #ffffff;
}

.panel-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.25rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: #38bdf8;
  margin-bottom: 0.5rem;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  letter-spacing: -0.3px;
}

.text-gradient {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 60%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel-subtitle {
  font-size: 0.88rem;
  color: #cbd5e1;
  max-width: 600px;
  margin: 0 auto;
}

/* Compact Search Bar Card */
.search-card {
  background: rgba(15, 30, 54, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.5);
}

.search-form-row {
  display: flex;
  gap: 0.65rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: #94a3b8;
  font-size: 0.88rem;
}

.search-input:focus {
  border-color: #38bdf8;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.search-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-normal);
  flex-shrink: 0;
}

.search-btn:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

/* Dynamic Display Container (Compact) */
.display-card-container {
  width: 100%;
}

/* State 1: Standby Informational Card */
.standby-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  color: #cbd5e1;
  font-size: 0.8rem;
}

.standby-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.standby-icon {
  font-size: 1.1rem;
}

/* State 2: Valid Certificate Result Card (Compact & Dense) */
.cert-card-valid {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--accent-emerald);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: fadeInPop 0.3s ease;
}

@keyframes fadeInPop {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.cert-card-header {
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cert-status-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.cert-check-circle {
  width: 22px;
  height: 22px;
  background: #ffffff;
  color: #059669;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}

.cert-card-body {
  padding: 1.15rem 1.25rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

.cert-primary-details {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.field-value-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.field-value-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 1.3;
}

.field-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.field-value-sm {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
}

.field-value-grade {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.cert-secondary-meta {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 0.5rem;
}

.qr-mini-box {
  width: 72px;
  height: 72px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.qr-cert-code {
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

.meta-issuer-text {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Compact Hash Bar */
.cert-hash-strip {
  grid-column: 1 / -1;
  background: #0f172a;
  color: #38bdf8;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.hash-code-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-mini-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.68rem;
  cursor: pointer;
}

.copy-mini-btn:hover {
  background: var(--accent-blue);
}

.cert-card-footer {
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* State 3: Invalid Result Card (Compact) */
.cert-card-invalid {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1.5px solid #ef4444;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: fadeInPop 0.3s ease;
}

.invalid-icon {
  width: 44px;
  height: 44px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.invalid-details h4 {
  font-size: 0.95rem;
  color: #991b1b;
  margin-bottom: 2px;
}

.invalid-details p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* App Footer: Fixed Bottom Bar */
.app-footer {
  flex-shrink: 0;
  height: 38px;
  background: #040d18;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  font-size: 0.74rem;
  color: #64748b;
  position: relative;
  z-index: 10;
}

.app-footer a {
  color: #38bdf8;
  text-decoration: underline;
}

/* Modal Dialog for FAQ / Help (Doesn't cause page scroll!) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-light);
}

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

.modal-header h3 {
  font-size: 1.15rem;
  color: var(--primary);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-entry {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.75rem;
}

.faq-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.faq-entry h5 {
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 0.3rem;
}

.faq-entry p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2.5rem;
  right: 1.5rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #ffffff;
  border-left: 4px solid var(--accent-emerald);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  animation: slideRight 0.25s ease;
}

@keyframes slideRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Print Friendly */
@media print {
  body * { visibility: hidden; }
  .cert-card-valid, .cert-card-valid * { visibility: visible; }
  .cert-card-valid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
  .cert-card-footer { display: none !important; }
}

/* ==========================================================================
   Responsive & Mobile Optimization
   ========================================================================== */

/* Landscape or Short Screens */
@media (max-height: 640px) and (min-width: 681px) {
  .verifier-panel {
    gap: 0.75rem;
  }
  .panel-title {
    font-size: 1.5rem;
  }
  .panel-subtitle {
    display: none;
  }
  .standby-card {
    padding: 0.6rem 1rem;
  }
}

/* Tablet & Mobile Screens */
@media (max-width: 768px) {
  .verifier-panel {
    max-width: 100%;
  }
}

/* Mobile Screens (< 680px) */
@media (max-width: 680px) {
  html, body {
    overflow-x: hidden;
    overflow-y: auto; /* Enable smooth scrolling on mobile */
    height: auto;
    min-height: 100%;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .app-main {
    padding: 1.5rem 1rem;
    align-items: flex-start;
    overflow-y: visible;
  }

  .verifier-panel {
    gap: 1rem;
    width: 100%;
  }

  .panel-header {
    margin-bottom: 0.25rem;
  }

  .panel-pill {
    font-size: 0.7rem;
    padding: 0.2rem 0.65rem;
    margin-bottom: 0.4rem;
  }

  .panel-title {
    font-size: 1.45rem;
    line-height: 1.25;
    margin-bottom: 0.35rem;
  }

  .panel-subtitle {
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 0 0.25rem;
  }

  .search-card {
    padding: 0.85rem;
    border-radius: var(--radius-md);
  }

  .search-form-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-input {
    width: 100%;
    /* 16px prevents iOS Safari automatic input zoom */
    font-size: 16px !important;
    padding: 0.8rem 1rem;
    min-height: 46px;
    box-sizing: border-box;
  }

  .search-btn {
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    font-size: 0.95rem;
    min-height: 46px;
  }

  /* Standby Card Mobile */
  .standby-card {
    flex-direction: column;
    gap: 0.65rem;
    align-items: center;
    text-align: center;
    padding: 1rem 0.85rem;
    font-size: 0.78rem;
  }

  .standby-item {
    justify-content: center;
    gap: 0.4rem;
  }

  /* Certificate Valid Card Mobile */
  .cert-card-body {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .field-value-name {
    font-size: 1.15rem;
  }

  .field-value-title {
    font-size: 0.9rem;
  }

  .field-row-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .cert-secondary-meta {
    padding: 0.75rem;
    flex-direction: row;
    justify-content: space-around;
    text-align: left;
  }

  .qr-mini-box {
    width: 60px;
    height: 60px;
  }

  .meta-issuer-text {
    font-size: 0.72rem;
  }

  .cert-hash-strip {
    font-size: 0.68rem;
    padding: 0.35rem 0.5rem;
  }

  .cert-card-footer {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .cert-card-footer > button,
  .cert-card-footer > div {
    width: 100%;
  }

  .cert-card-footer > div {
    display: flex;
    gap: 0.5rem;
  }

  .cert-card-footer > div button {
    flex: 1;
    min-height: 38px;
  }

  /* Invalid Alert Mobile */
  .cert-card-invalid {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem 1rem;
    gap: 0.75rem;
  }

  .invalid-details h4 {
    font-size: 0.92rem;
  }

  .invalid-details p {
    font-size: 0.78rem;
  }

  .cert-card-invalid button {
    margin-left: 0 !important;
    width: 100%;
    min-height: 40px;
  }

  /* Toast Mobile */
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    align-items: center;
  }

  .toast {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Footer Mobile */
  .app-footer {
    height: auto;
    padding: 0.85rem 1rem;
    text-align: center;
    font-size: 0.7rem;
    line-height: 1.5;
  }

  /* Modal Popup Mobile */
  .modal-overlay {
    padding: 1rem;
  }

  .modal-box {
    max-height: 85vh;
  }

  .modal-header {
    padding: 0.85rem 1rem;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 1rem;
    gap: 0.85rem;
  }

  .faq-entry h5 {
    font-size: 0.85rem;
  }

  .faq-entry p {
    font-size: 0.78rem;
  }
}
