/* =========================================
   certStyles.css
   ONLY extra styles for Certificate Manager
   ========================================= */

/* -------------------------
   Panel fixes (CRITICAL)
   ------------------------- */

.panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;     /* FORCE full width */
}

/* -------------------------
   Recommended box
   ------------------------- */

.recommended-box {
  width: 100%;
  margin-bottom: 14px;
  border-radius: 12px;
  padding: 1px 10px;
  background: linear-gradient(
    90deg,
    rgba(78, 229, 255, 0.15),
    rgba(139, 92, 246, 0.12)
  );
  border: 1px solid var(--border);
  font-weight: 500;
  flex-shrink: 0;
}
.recommended-box h3 {
   margin-bottom: 0;
}
.recommended-box p {
   margin-top: 0;
}

/* -------------------------
   Cert list container
   (OWN SCROLL AREA)
   ------------------------- */

.cert-list {
  width: 100%;              /* KEY FIX */
  min-width: 0;             /* flex/grid overflow fix */
  flex: 1;

  overflow-y: auto;
  overflow-x: hidden;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;

  padding-right: 6px;
}

/* Ensure cards don't shrink grid */
.cert-card {
  min-width: 0;
}

/* -------------------------
   Individual cert card
   ------------------------- */

.cert-card {
  background: var(--panel);
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.cert-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.1);
}

.card-title {
  font-weight:600;
  font-size:15px;
  color:var(--text);
  line-height:1.2;
}
.card-meta {
  font-size:13px;
  color:var(--muted);
}
.badge {
  padding:6px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  display:inline-block;
}
.badge.revoked {
  background: rgba(239,68,68,0.08);
  color: var(--revoked);
  border: 1px solid rgba(239,68,68,0.12);
}
.badge.valid {
  background: rgba(16,185,129,0.08);
  color: var(--valid);
  border: 1px solid rgba(16,185,129,0.12);
}
.badge.signed {
  background: rgba(16,185,129,0.08);
  color: var(--valid);
  border: 1px solid rgba(16,185,129,0.12);
}

/* small footer row inside card */
.card-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top:6px;
}
.card-footer .small {
  font-size:12px;
  color:var(--muted);
}
/* -------------------------
   Updates dropdown (DROP-UP)
   ------------------------- */

.updates-box {
  width: 100%;              /* KEY FIX */
  position: sticky;
  bottom: 16px;
  margin-top: 16px;

  background: var(--panel);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);

  overflow: visible;
  z-index: 60;
  flex-shrink: 0;
}

/* Header row */
.updates-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}

.updates-title {
  margin: 0;
  font-size: 15px;
}

/* Caret */
.updates-toggle {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.18s ease;
}

/* -------------------------
   Updates content (START CLOSED)
   ------------------------- */

.updates-inner {
  width: 100%;              /* KEY FIX */
  min-width: 0;

  position: absolute;
  bottom: 100%;
  left: 0;

  max-height: 0;
  overflow: hidden;

  background: var(--panel);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.14);

  transition: max-height 0.28s ease;
}

/* Expanded state */
.updates-box.expanded .updates-inner {
  max-height: 80vh;
  overflow-y: auto;
}

/* Rotate caret */
.updates-box.expanded .updates-toggle {
  transform: rotate(180deg);
}

.updates-inner > * {
  padding: 12px 14px;
}

/* -------------------------
   Modal (cert details)
   ------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 120;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px;
  width: min(520px, 92vw);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.25);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.modal-meta,
.modal-dates,
.modal-download {
  margin-top: 12px;
}
