/* ─────────────────────────────────────────────────────────
   Certificate Manager – Public Styles
   File: assets/css/public.css
───────────────────────────────────────────────────────── */

/* ── Base wrapper ── */
.cm-public-wrap {
    max-width: 860px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    line-height: 1.65;
}

.cm-section-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 6px;
    color: #1a1a2e;
}

.cm-section-desc {
    color: #666;
    margin: 0 0 22px;
    font-size: 15px;
}

/* ── Alert banners ── */
.cm-alert {
    padding: 13px 18px;
    border-radius: 7px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}
.cm-alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.cm-alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.cm-alert-error   { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }

/* ── Verification form ── */
.cm-verify-form .cm-field-row { margin-bottom: 0; }
.cm-verify-form label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 14px; color: #444; }

.cm-input-group {
    display: flex;
    gap: 10px;
    max-width: 560px;
}
.cm-input-group input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid #ddd;
    border-radius: 7px;
    font-size: 15px;
    transition: border-color .2s;
    outline: none;
    box-sizing: border-box;
}
.cm-input-group input:focus { border-color: #1a3a6e; }

/* ── Button ── */
.cm-btn {
    display: inline-block;
    padding: 11px 22px;
    background: #1a3a6e;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    text-decoration: none;
    white-space: nowrap;
}
.cm-btn:hover   { background: #122a54; color: #fff; }
.cm-btn-lg      { padding: 13px 30px; font-size: 15px; }

/* ─────────────────────────────────────────────
   STATUS BANNER
───────────────────────────────────────────── */
.cm-status-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    border-radius: 10px;
    padding: 20px 26px;
    margin: 28px 0 0;
    position: relative;
    overflow: hidden;
}

.cm-banner-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: #fff;
}

.cm-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cm-banner-text strong { font-size: 18px; font-weight: 800; display: block; }
.cm-banner-text span   { font-size: 13px; opacity: .85; }

/* VALID */
.cm-banner-active {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(40,167,69,.30);
}
.cm-banner-active .cm-banner-icon { background: rgba(255,255,255,.25); }

/* EXPIRED */
.cm-banner-expired {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
    color: #fff;
}
.cm-banner-expired .cm-banner-icon { background: rgba(255,255,255,.20); }

/* REVOKED */
.cm-banner-revoked {
    background: linear-gradient(135deg, #a71c2e 0%, #dc3545 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(220,53,69,.30);
}
.cm-banner-revoked .cm-banner-icon { background: rgba(255,255,255,.20); }

/* NOT FOUND */
.cm-banner-notfound {
    background: linear-gradient(135deg, #6c3d08 0%, #c87700 100%);
    color: #fff;
}
.cm-banner-notfound .cm-banner-icon {
    background: rgba(255,255,255,.20);
    font-size: 22px;
}

/* Verified seal (top-right corner on valid) */
.cm-banner-seal {
    position: absolute;
    right: 20px; top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 2px;
    color: rgba(255,255,255,.75);
    border: 2px solid rgba(255,255,255,.5);
    border-radius: 20px;
    padding: 4px 14px;
}

/* ─────────────────────────────────────────────
   CERTIFICATE EMBED (scaled real certificate)
───────────────────────────────────────────── */
.cm-cert-embed-outer {
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 6px 32px rgba(0,0,0,.18);
    margin: 22px 0 0;
    background: #e8e4dc;
    /* height is set dynamically by JS based on scale */
}

.cm-cert-embed-inner {
    /* transform + height set by JS */
    transform-origin: top left;
    line-height: 0; /* prevent extra whitespace */
}

/* ─────────────────────────────────────────────
   DETAILS CARD (below certificate)
───────────────────────────────────────────── */
.cm-details-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 22px 0 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.cm-details-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a3a6e;
    padding: 14px 20px;
    background: #f5f7fc;
    margin: 0;
    border-bottom: 1px solid #e0e0e0;
    letter-spacing: .3px;
}

.cm-result-table {
    width: 100%;
    border-collapse: collapse;
}
.cm-result-table th,
.cm-result-table td {
    padding: 11px 20px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}
.cm-result-table th {
    background: #fafafa;
    color: #777;
    font-weight: 600;
    width: 38%;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.cm-result-table tr:last-child th,
.cm-result-table tr:last-child td { border-bottom: none; }

/* Inline status badge inside table */
.cm-inline-badge {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.cm-badge-active   { background: #d4edda; color: #155724; }
.cm-badge-expired  { background: #e2e3e5; color: #383d41; }
.cm-badge-revoked  { background: #f8d7da; color: #721c24; }

/* ─────────────────────────────────────────────
   REGISTRATION FORM
───────────────────────────────────────────── */
.cm-form { max-width: 700px; }
.cm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.cm-field-row  { margin-bottom: 18px; }
.cm-field-full { grid-column: 1 / -1; }
.cm-field-submit { grid-column: 1 / -1; margin-top: 6px; }

.cm-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #444;
}
.cm-required { color: #dc3545; }

.cm-form input[type="text"],
.cm-form input[type="email"],
.cm-form input[type="tel"],
.cm-form select {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #ddd;
    border-radius: 7px;
    font-size: 15px;
    transition: border-color .2s;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}
.cm-form input:focus,
.cm-form select:focus { border-color: #1a3a6e; box-shadow: 0 0 0 3px rgba(26,58,110,.10); }

/* ─────────────────────────────────────────────
   Responsive
───────────────────────────────────────────── */
@media ( max-width: 600px ) {
    .cm-input-group { flex-direction: column; }
    .cm-btn { width: 100%; text-align: center; }
    .cm-form-grid { grid-template-columns: 1fr; }
    .cm-banner-seal { display: none; }
    .cm-status-banner { padding: 16px 18px; gap: 14px; }
    .cm-banner-text strong { font-size: 16px; }
    .cm-result-table th,
    .cm-result-table td { padding: 10px 14px; }
}

/* ═══════════════════════════════════════════════════════════════
   v1.5.0 — Certificate portal + share modal + 3-button toolbar
═══════════════════════════════════════════════════════════════ */

/* ─── 3-button toolbar (print / pdf / share) ──────────────── */
.cm-action-toolbar {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 18px 0 10px;
}

.cm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background .15s, transform .1s;
    font-family: inherit;
    line-height: 1.3;
}

.cm-btn:active { transform: scale(.97); }

.cm-btn-print {
    background: #1a2b5e;
    color: #fff;
}

.cm-btn-print:hover { background: #122048; }

.cm-btn-pdf {
    background: #c0392b;
    color: #fff;
}

.cm-btn-pdf:hover { background: #a93226; }

.cm-btn-share {
    background: #0a6;
    color: #fff;
}

.cm-btn-share:hover { background: #085; }

/* ─── Share modal ─────────────────────────────────────────── */
.cm-share-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cm-modal-open .cm-share-overlay {
    display: flex;
}

.cm-share-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
    padding: 28px 24px 20px;
    max-width: 380px;
    width: 100%;
    position: relative;
    animation: cmShareIn .18s ease;
}

@keyframes cmShareIn {
    from { transform: translateY(10px) scale(.97); opacity: 0; }
    to   { transform: translateY(0) scale(1);       opacity: 1; }
}

.cm-share-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 16px;
}

.cm-share-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.cm-share-close:hover { background: #f0f0f0; color: #333; }

.cm-share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.cm-share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background .13s, border-color .13s;
    text-decoration: none;
    background: #f6f8fc;
    color: #1a1a2e;
    font-family: inherit;
}

.cm-share-btn:hover {
    background: #eaf0ff;
    border-color: #1a3a6e;
    color: #1a3a6e;
}

.cm-share-btn-li-add  { background: #e8f0fe; color: #0a66c2; }
.cm-share-btn-li-add:hover { background: #d2e3fc; border-color: #0a66c2; color: #0a66c2; }

.cm-share-btn-li-share { background: #e8f0fe; color: #0a66c2; }
.cm-share-btn-li-share:hover { background: #d2e3fc; border-color: #0a66c2; color: #0a66c2; }

.cm-share-btn-wa  { background: #e7faf0; color: #25d366; }
.cm-share-btn-wa:hover { background: #c3f0d8; border-color: #25d366; color: #128c4a; }

.cm-share-btn-fb  { background: #e8f0fe; color: #1877f2; }
.cm-share-btn-fb:hover { background: #cfe2ff; border-color: #1877f2; }

.cm-share-btn-mail { background: #fef6e8; color: #c07000; }
.cm-share-btn-mail:hover { background: #fde8c0; border-color: #c07000; }

.cm-share-btn-copy { background: #f3f3f3; color: #444; }
.cm-share-btn-copy:hover { background: #e8e8e8; border-color: #aaa; }

.cm-share-btn-native { background: #f0f8ff; color: #1a3a6e; }
.cm-share-btn-native:hover { background: #daeeff; border-color: #1a3a6e; }

.cm-copy-feedback {
    font-size: 11.5px;
    color: #0a6;
    margin-top: 4px;
    text-align: center;
    min-height: 18px;
}

/* ─── Certificate portal ──────────────────────────────────── */
.cm-portal-wrap {
    max-width: 680px;
    margin: 0 auto;
    font-family: inherit;
}

.cm-portal-wrap h2 {
    font-size: 22px;
    color: #1a2b5e;
    margin-bottom: 8px;
}

.cm-portal-wrap p {
    color: #555;
    margin-bottom: 18px;
}

.cm-portal-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cm-portal-found {
    font-size: 13.5px;
    color: #555;
    margin-bottom: 14px;
}

.cm-portal-card {
    background: #fff;
    border: 1px solid #dde3f0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(26,43,94,.07);
    padding: 18px 20px 14px;
    transition: box-shadow .15s;
}

.cm-portal-card:hover {
    box-shadow: 0 4px 16px rgba(26,43,94,.13);
}

.cm-portal-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.cm-portal-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a2b5e;
    margin: 0;
}

.cm-portal-card-status {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    flex-shrink: 0;
}

.cm-portal-status-active   { background: #e6f9ef; color: #0a6; }
.cm-portal-status-expired  { background: #ffeaea; color: #c00; }
.cm-portal-status-revoked  { background: #f5f5f5; color: #888; }

.cm-portal-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    font-size: 12.5px;
    color: #666;
    margin-bottom: 12px;
}

.cm-portal-card-meta span strong {
    color: #333;
}

.cm-portal-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #edf0f7;
    padding-top: 12px;
}

.cm-portal-card-actions .cm-btn {
    font-size: 12.5px;
    padding: 6px 14px;
}

@media (max-width: 520px) {
    .cm-share-grid { grid-template-columns: 1fr; }
    .cm-portal-card-actions { flex-direction: column; }
    .cm-portal-card-actions .cm-btn { width: 100%; justify-content: center; }
    .cm-portal-card-head { flex-direction: column; gap: 6px; }
}
