/* ==========================================================================
   INSTITUTIONAL PORTAL + SAAS HUB (MODULAR UI DESIGN SYSTEM)
   Media Digital Publikasi Indonesia
   Multi-Device Responsive Layer: 320px Mobile -> Tablet -> Desktop -> 4K
   ========================================================================== */

:root {
  --hub-navy-950: #071426;
  --hub-navy-900: #0b1e3b;
  --hub-navy-800: #132c52;
  --hub-cobalt: #0284c7;
  --hub-cobalt-dark: #0369a1;
  --hub-cobalt-soft: #e0f2fe;
  --hub-gold: #d97706;
  --hub-gold-soft: #fef3c7;
  --hub-emerald: #059669;
  --hub-emerald-soft: #d1fae5;
  --hub-surface: #f4f7fb;
  --hub-card: #ffffff;
  --hub-border: #e2e8f0;
  --hub-border-strong: #cbd5e1;
  --hub-text: #0f172a;
  --hub-text-muted: #475569;
  --hub-text-subtle: #64748b;
  --hub-radius-sm: 8px;
  --hub-radius-md: 12px;
  --hub-radius-lg: 16px;
  --hub-radius-xl: 20px;
  --hub-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --hub-shadow-sm: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --hub-shadow-md: 0 14px 30px -10px rgba(11, 30, 59, 0.12), 0 4px 10px -4px rgba(11, 30, 59, 0.05);
  --hub-shadow-lg: 0 24px 48px -16px rgba(11, 30, 59, 0.22);
}

/* ==========================================================================
   1. UNIVERSAL MULTI-DEVICE SAFETY & FLUID BASE
   ========================================================================== */
html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip;
  background-color: var(--hub-surface);
  color: var(--hub-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
}

/* Safe fluid container across all viewports */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 3vw, 1.75rem);
  padding-right: clamp(1rem, 3vw, 1.75rem);
}

/* ==========================================================================
   2. INSTITUTIONAL TOP UTILITY BAR & GLASS NAVBAR
   ========================================================================== */
.top-announcement {
  background: linear-gradient(90deg, var(--hub-navy-950) 0%, var(--hub-navy-900) 60%, var(--hub-navy-800) 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
}

.navbar {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 2px 12px -4px rgba(11, 30, 59, 0.06);
}

.brand-emblem {
  background: linear-gradient(135deg, var(--hub-navy-900) 0%, var(--hub-cobalt) 100%) !important;
  box-shadow: 0 6px 14px -4px rgba(2, 132, 199, 0.45);
}

/* ==========================================================================
   3. INSTITUTIONAL HERO + SAAS HUB BENTO MODULE
   ========================================================================== */
.hero-section {
  background:
    radial-gradient(circle at 12% 18%, rgba(2, 132, 199, 0.24), transparent 44%),
    radial-gradient(circle at 88% 82%, rgba(217, 119, 6, 0.16), transparent 42%),
    linear-gradient(145deg, var(--hub-navy-950) 0%, var(--hub-navy-900) 52%, var(--hub-navy-800) 100%) !important;
  position: relative;
}

/* Modular SaaS Hub Section */
.saas-hub-strip {
  position: relative;
  z-index: 6;
  margin-top: -2.25rem;
  padding-bottom: 2.5rem;
}

.saas-hub-shell {
  background: var(--hub-card);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-xl);
  padding: clamp(1.15rem, 2.5vw, 1.75rem);
  box-shadow: var(--hub-shadow-md);
}

.saas-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.saas-hub-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.saas-hub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--hub-cobalt-soft);
  color: var(--hub-cobalt-dark);
}

.saas-hub-heading {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 700;
  color: var(--hub-navy-900);
  margin: 0;
}

.saas-hub-sub {
  font-size: 0.82rem;
  color: var(--hub-text-subtle);
  margin: 0;
}

/* 4-col Desktop -> 2-col Tablet -> 1-col / 2-col Compact Mobile Bento Grid */
.saas-hub-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.saas-module-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1.05rem;
  border-radius: var(--hub-radius-md);
  background: #f8fafc;
  border: 1px solid var(--hub-border);
  text-decoration: none;
  color: inherit;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s ease,
              border-color 0.22s ease,
              background-color 0.22s ease;
  position: relative;
}

.saas-module-card:hover {
  transform: translateY(-3px);
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.45);
  box-shadow: 0 12px 24px -10px rgba(2, 132, 199, 0.22);
}

.saas-module-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.saas-module-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.saas-module-icon svg {
  width: 18px;
  height: 18px;
}

.saas-mod-blue   { background: #e0f2fe; color: #0284c7; }
.saas-mod-amber  { background: #fef3c7; color: #d97706; }
.saas-mod-green  { background: #dcfce7; color: #15803d; }
.saas-mod-indigo { background: #e0e7ff; color: #4338ca; }
.saas-mod-teal   { background: #ccfbf1; color: #0f766e; }
.saas-mod-purple { background: #f3e8ff; color: #7c3aed; }
.saas-mod-slate  { background: #e2e8f0; color: #334155; }
.saas-mod-rose   { background: #ffe4e6; color: #be123c; }

.saas-module-tag {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid var(--hub-border);
  color: var(--hub-text-muted);
}

.saas-module-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--hub-navy-900);
  margin: 0;
  line-height: 1.3;
}

.saas-module-desc {
  font-size: 0.77rem;
  color: var(--hub-text-subtle);
  line-height: 1.45;
  margin: 0;
}

/* Modular Cards & Surfaces Across All Public Pages */
.service-card,
.journal-card,
.workflow-card-adaptive,
.turnitin-table-card,
.cert-preview-card,
.hub-panel {
  border-radius: var(--hub-radius-lg);
  border: 1px solid var(--hub-border);
  box-shadow: var(--hub-shadow-sm);
}

/* ==========================================================================
   4. MOBILE BOTTOM APP BAR (SAAS HUB NATIVE FEEL ON PHONES)
   ========================================================================== */
.hub-mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body.has-hub-bottom-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  .hub-mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--hub-border);
    box-shadow: 0 -6px 20px -6px rgba(11, 30, 59, 0.12);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .hub-bnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    text-decoration: none;
    color: var(--hub-text-subtle);
    font-size: 0.67rem;
    font-weight: 700;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 10px;
    transition: color 0.18s ease, background-color 0.18s ease;
  }

  .hub-bnav-item svg {
    width: 19px;
    height: 19px;
  }

  .hub-bnav-item.active,
  .hub-bnav-item:active {
    color: var(--hub-cobalt);
    background: rgba(2, 132, 199, 0.08);
  }

  /* Lift floating WA button above mobile bottom nav */
  .floating-wa-btn {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    right: 14px !important;
    padding: 10px 14px !important;
  }
}

/* ==========================================================================
   5. MULTI-DEVICE BREAKPOINTS (TABLET, MOBILE, SMALL PHONES)
   ========================================================================== */

/* Tablet Landscape & Compact Laptop (<= 1080px) */
@media (max-width: 1080px) {
  .saas-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  .hero-stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 2rem !important;
  }
}

/* Mobile & Tablet Portrait (<= 768px) */
@media (max-width: 768px) {
  .saas-hub-strip {
    margin-top: -1.25rem;
    padding-bottom: 1.75rem;
  }

  .saas-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .saas-module-card {
    padding: 0.85rem;
  }

  .saas-module-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .top-announcement-msg {
    display: none;
  }

  .top-announcement-inner {
    justify-content: space-between;
    gap: 0.5rem;
  }

  .top-links {
    gap: 0.45rem !important;
    flex-wrap: wrap;
  }

  /* Touch-friendly inputs (prevents iOS Safari auto-zoom) */
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  select,
  textarea,
  .search-input,
  .year-select,
  .form-control {
    font-size: 16px !important;
    min-height: 44px;
  }

  .btn {
    min-height: 42px;
  }

  .hero-cta-group {
    flex-direction: column;
    align-items: stretch !important;
  }

  .hero-cta-group .btn {
    width: 100%;
    justify-content: center;
  }

  .role-tabs-bar {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .role-tab-btn {
    font-size: 0.74rem !important;
    padding: 0.55rem 0.35rem !important;
    text-align: center;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.75rem !important;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }

  /* Universal responsive table scrolling */
  table {
    max-width: 100%;
  }

  .table-responsive,
  .table-responsive-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Narrow Mobile Phones (<= 640px) — auto-stack inline 2-col / multi-col form grids */
@media (max-width: 640px) {
  .hub-stack-mobile,
  form [style*="grid-template-columns: 1fr 1fr"],
  form [style*="grid-template-columns:1fr 1fr"],
  form [style*="grid-template-columns:1.2fr 1fr"],
  form [style*="grid-template-columns: 1.2fr 1fr"],
  .modal-body [style*="grid-template-columns:1fr 1fr"],
  .modal-body [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .sinta-dir-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Ultra-Small Phones (<= 400px, e.g. iPhone SE / 320px-375px) */
@media (max-width: 400px) {
  .saas-hub-grid {
    grid-template-columns: 1fr;
  }

  .brand-text h1 {
    font-size: 0.88rem !important;
  }

  .brand-text p {
    font-size: 0.66rem !important;
  }

  .hero-stats-row {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   6. UNIFIED INSTITUTIONAL SAAS POLISH FOR ADMIN & MITRA PORTALS
   ========================================================================== */
body.hub-portal-dashboard {
  background: var(--hub-surface);
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
}

.hub-portal-dashboard .admin-card-box,
.hub-portal-dashboard .card {
  border-radius: var(--hub-radius-lg);
  border-color: var(--hub-border);
  box-shadow: var(--hub-shadow-xs);
}

.hub-portal-dashboard .admin-table th {
  background: #f8fafc;
  color: var(--hub-navy-900);
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .hub-portal-dashboard .modal-content {
    width: calc(100vw - 1.5rem) !important;
    max-width: 100% !important;
    margin: 0.75rem auto !important;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }
}

/* Print Cleanliness */
@media print {
  .hub-mobile-bottom-nav,
  .floating-wa-btn,
  #editorialScrollProgress {
    display: none !important;
  }
}
