﻿/* ==================== Certificate List Page ==================== */

.cert-details-strip {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
    padding: 14px 32px;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
    width: 100%;
    box-sizing: border-box;
}

.cert-details-stat {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 40px;
    flex: 1 1 0;
    min-width: 0;
}

.cert-details-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #6B7280;
    flex-shrink: 0;
    margin-top: 2px;
}

.cert-details-body {
    line-height: 1.25;
}

.cert-details-label {
    font-size: 11px;
    color: #6B7280;
    letter-spacing: 0.02em;
}

.cert-details-value {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-top: 2px;
}

.cert-details-divider {
    width: 1px;
    align-self: stretch;
    background: #E5E7EB;
    display: none !important;
}

.cert-details-strength {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.cert-details-strength-track {
    width: 80px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    overflow: hidden;
}

.cert-details-strength-fill {
    height: 100%;
    border-radius: 2px;
}

.cert-details-strength-label {
    font-size: 11px;
    font-weight: 500;
}

.cert-details-history-list {
    display: flex;
    flex-direction: column;
}

    .cert-details-history-list .cert-details-strip + .cert-details-strip {
        border-top: 1px solid #E5E7EB;
    }

/* --- Listing container: filter bar + grid share one rounded card --- */

.page-header.list-page-header {
    margin-bottom: 0 !important;
}

/* Grey-canvas redesign (Key Discovery style): grey page + a white header card
   above the filter/grid card. */
.page.page-wide.cp-certlist-page {
    display: block;
    overflow-y: auto;
    background: var(--cp-list-page-bg, #F3F4F6);
    --cp-page-gutter: 16px;
}

body:has(.cp-certlist-page) .app-body-inner {
    background: #FFFFFF;
}

.cp-certlist-headcard {
    background: #FFFFFF;
    border: 1px solid var(--cp-list-section-border, #E5E7EB);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    padding: 20px 24px;
    margin-bottom: 14px;
}

.cp-certlist-title {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: #111827;
}

.cp-certlist-subtitle {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: #6B7280;
}

.page-content.list-page-content {
    border: 1px solid #E5E7EB;
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    background: #FFFFFF;
    overflow: hidden;
}

.page-content.list-page-content .rz-tabview .rz-data-grid {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 290px);
}

    .page-content.list-page-content .rz-tabview .rz-data-grid .rz-data-grid-data {
        min-height: 0;
    }

.page-content.list-page-content:has(.rz-tabview) {
    overflow: auto;
}

.page-header.list-page-header > div:last-child {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: 0 !important;
}

.page-content.list-page-content .rz-data-grid,
.page-content.list-page-content .rz-datatable,
.page-content.list-page-content .rz-datatable-scrollable-header,
.page-content.list-page-content .rz-datatable-scrollable-view,
.page-content.list-page-content .rz-grid-table {
    border-top: none !important;
    border-top-width: 0 !important;
}

    .page-content.list-page-content .rz-grid-table thead tr:first-child th {
        border-top: none !important;
    }

    .page-content.list-page-content .rz-grid-table thead .rz-column-title,
    .page-content.list-page-content .rz-grid-table thead th {
        text-transform: none !important;
        letter-spacing: 0 !important;
        font-weight: 500 !important;
        color: #6B7280 !important;
        font-size: 13px !important;
    }

    .page-content.list-page-content .rz-grid-table thead th {
        background: #F9FAFB !important;
        border-bottom: 1px solid #E5E7EB !important;
        padding: 14px 12px !important;
    }

    .page-content.list-page-content .rz-grid-table tbody td {
        border-bottom: 1px solid #F3F4F6 !important;
        padding: 16px 12px !important;
        font-size: 13px;
        color: #374151;
    }

    /* Compact density — tighter rows for scanning long lists. Toggled app-wide by the
       Comfortable/Compact control (adds body.cp-density-compact). Keyed off the body
       class + this page's container so it out-specifies the comfortable rules above. */
    body.cp-density-compact .page-content.list-page-content .rz-grid-table tbody td {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    body.cp-density-compact .page-content.list-page-content .rz-grid-table thead th {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .page-content.list-page-content .rz-grid-table thead th,
    .page-content.list-page-content .rz-grid-table tbody td {
        border-left: none !important;
        border-right: none !important;
    }

/* NOTE: the column-resizer handle is intentionally left visible/grabbable so users can
   drag column dividers to resize on all list pages. (It was previously display:none,
   which disabled drag-to-resize.) Radzen renders it as a subtle strip at the column's
   right edge that highlights on hover. */

.page-content.list-page-content .rz-grid-table thead th:first-child,
.page-content.list-page-content .rz-grid-table tbody td:first-child {
    padding-left: 8px !important;
    padding-right: 4px !important;
}

.page-content.list-page-content .rz-grid-table tbody tr:hover td {
    background: #F0FDFA !important;
}

.page-content.list-page-content .rz-grid-table tbody tr.rz-state-highlight td,
.page-content.list-page-content .rz-grid-table tbody tr.rz-selected td {
    background: #F0FDFA !important;
}

.page-content.list-page-content .rz-grid-table thead th.cp-col-primary,
.page-content.list-page-content .rz-grid-table thead th.cp-col-primary .rz-column-title {
    color: #008D9E !important;
    font-weight: 600 !important;
}

.page-content.list-page-content .rz-grid-table tbody td.cp-col-primary {
    color: #008D9E !important;
    font-weight: 500;
}

.cp-subscribed-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.page-content.list-page-content .rz-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
}

    .page-content.list-page-content .rz-pager .rz-pager-summary {
        order: -1;
        margin-right: auto;
        font-size: 13px;
        color: #6B7280;
    }

/* ==================== Right-side details drawer ==================== */

.cert-drawer-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 20000;
    animation: cert-drawer-fade 0.15s ease-out;
}

.cert-drawer {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: min(520px, 100vw);
    background: #FFFFFF;
    z-index: 20001;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
    animation: cert-drawer-slide 0.22s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes cert-drawer-slide {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes cert-drawer-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cert-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    background: #FFFFFF;
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
}

.cert-drawer-body .rz-tabview-nav {
    position: sticky;
    top: 0;
    background: #FFFFFF;
    z-index: 1;
}

.cert-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.cert-drawer-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #F0FDFA;
}

.cert-drawer-close {
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
}

    .cert-drawer-close:hover {
        background: #F3F4F6;
    }

.cert-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    position: relative; /* anchors the CSR download progress overlay */
}

.cert-drawer-loading {
    padding: 24px 20px;
    color: #6B7280;
    font-size: 13px;
}

/* Semi-transparent overlay shown inside the drawer body while an async
   download (e.g. Download CSR) is in flight. */
.cert-drawer-progress-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    backdrop-filter: blur(1px);
}

.cert-drawer-progress-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.cert-drawer-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E5E7EB;
    border-top-color: #008D9E;
    border-radius: 50%;
    animation: cert-drawer-spin 0.7s linear infinite;
}

.cert-drawer-spinner--inline {
    width: 14px;
    height: 14px;
    border-width: 2px;
    border-top-color: #ffffff;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes cert-drawer-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Radzen dialog + its mask must sit above the drawer (20001), the app's
   top navbar (inline z-index: 10002), and anything else on the page. Use
   a very high z-index so the "Download certificate" prompt renders on top
   of every other layer. */
.rz-dialog-mask {
    z-index: 30000 !important;
    background: rgba(15, 23, 42, 0.55) !important;
}

.rz-dialog-wrapper,
.rz-dialog,
.rz-dialog-side {
    z-index: 30001 !important;
}

/* Floating overlay elements Radzen renders at the document body � dropdown
   panels, autocomplete panels, datepicker popups, tooltips � default to a
   z-index around 1050. When a dialog is open they must sit ABOVE the
   dialog (30001), otherwise the Certificate Format dropdown inside the
   Download prompt opens behind the popup card. */
.rz-popup,
.rz-dropdown-panel,
.rz-autocomplete-panel,
.rz-datepicker-popup,
.rz-tooltip {
    z-index: 30010 !important;
}

/* ===================== Drawer-styled prompt dialogs =====================
   Used by DrawerRequestPrompt.razor and DrawerRevokePrompt.razor. The
   parent hides the Radzen title bar (ShowTitle=false) and this component
   paints its own custom header (check icon + close X), title, subtitle,
   body, and Cancel/Confirm actions. */

.cp-prompt {
    /* Modal spec */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 32px;
    isolation: isolate;
    font-family: inherit;
}

.cp-prompt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin: 0;
    margin-bottom: -12px;
}

/* Group the title + subtitle so the 32px gap sits between visual sections
   (header / title-block / body / actions), not between title and subtitle. */
.cp-prompt-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-prompt-icon {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex: none;
    flex-grow: 0;
}

.cp-prompt-close {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .cp-prompt-close:hover {
        background: #F3F4F6;
    }

.cp-prompt-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.cp-prompt-subtitle {
    margin: 0;
    font-size: 13px;
    color: #6B7280;
}

.cp-prompt-body {
    margin: 0;
}

.cp-prompt-field-label {
    display: block;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
    font-weight: 500;
}

.cp-prompt-required {
    color: #DC2626;
    margin-left: 2px;
}

.cp-prompt-actions {
    display: flex;
    gap: 10px;
    justify-content: stretch;
}

.cp-prompt-btn {
    flex: 1 1 0;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.cp-prompt-btn--outline {
    background: #FFFFFF;
    color: #374151;
    border-color: #D1D5DB;
}

    .cp-prompt-btn--outline:hover {
        background: #F9FAFB;
    }

.cp-prompt-btn--primary {
    background: #008D9E;
    color: #FFFFFF;
    border-color: #008D9E;
}

    .cp-prompt-btn--primary:hover {
        background: #00707E;
        border-color: #00707E;
    }

/* Wrap the Radzen dialog to match the design spec exactly:
   400px wide, 12px radius, floating shadow, 24px padding around .cp-prompt. */
.rz-dialog:has(.cp-prompt) {
    border-radius: 12px !important;
    background: #FFFFFF !important;
    box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03) !important;
    overflow: hidden;
}

.rz-dialog-content:has(.cp-prompt) {
    padding: 24px !important;
}

/* Sanity override: pin the dialog to true viewport center in case an
   ancestor stacking context is throwing off Radzen's own positioning. */
body:has(.cert-drawer) .rz-dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
}

/* Also center the mask over the full viewport (top-left of the screen),
   including over the top navbar, so the whole page reads as inactive
   while the dialog is open. */
body:has(.cert-drawer) .rz-dialog-mask {
    position: fixed !important;
    inset: 0 !important;
}

.cert-drawer-tab {
    padding: 16px 20px 20px 20px;
}

.cert-drawer-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

    .cert-drawer-tab-header h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: #111827;
    }

.cert-drawer-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F3F4F6;
}

    .cert-drawer-section:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

.cert-drawer-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.cert-drawer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}

.cert-drawer-grid--three {
    grid-template-columns: 1fr 1fr 1fr;
}

.cert-drawer-user-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #6B7280;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.cert-drawer-user-section-title--mixed {
    text-transform: none;
    letter-spacing: 0;
    color: #111827;
    font-size: 13px;
}

.cert-drawer-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.cert-drawer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #99E4EB;
    color: #0B4F55;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cert-drawer-subscriber-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cert-drawer-subscriber {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Download split-button + floating menu */
.cert-drawer-download {
    position: relative;
}

.cert-drawer-download-chevron {
    transition: transform 0.15s ease-out;
}

.cert-drawer-download-chevron--open {
    transform: rotate(180deg);
}

.cert-drawer-download-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 210px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    padding: 4px 0;
    z-index: 10;
    animation: cert-drawer-download-fade 0.12s ease-out;
}

@keyframes cert-drawer-download-fade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cert-drawer-download-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 18px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    font-weight: 500;
}

    .cert-drawer-download-item:hover {
        background: #F3F4F6;
    }

.cert-drawer-download-divider {
    height: 1px;
    background: #E5E7EB;
    margin: 4px 12px;
}

.cert-drawer-label {
    font-size: 11px;
    color: #6B7280;
    margin-bottom: 3px;
}

.cert-drawer-value {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    word-break: break-word;
}

.cert-drawer-value--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

.cert-drawer-value--check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cert-drawer-status-pill {
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 2px 8px;
    gap: 6px;
    height: 22px;
    border-radius: 4px;
    mix-blend-mode: multiply;
    font-family: 'Open Sans', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    margin-top: 4px;
    flex: none;
    flex-grow: 0;
}

.cert-drawer-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cert-drawer-strength {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

.cert-drawer-strength-track {
    width: 90px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    overflow: hidden;
}

.cert-drawer-strength-fill {
    height: 100%;
    border-radius: 2px;
}

.cert-drawer-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cert-drawer-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: #F3F4F6;
    color: #374151;
    font-size: 12px;
}

.cert-drawer-actions {
    padding: 12px 20px 16px 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #FAFAFA;
}

.cert-drawer-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.cert-drawer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
}

.cert-drawer-btn--sm {
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 8px;
    font-weight: 600;
}

.cert-drawer-btn--wide {
    width: 100%;
}

.cert-drawer-btn--primary {
    background: #008D9E;
    color: #FFFFFF;
    border-color: #008D9E;
}

    .cert-drawer-btn--primary:hover {
        background: #00707E;
        border-color: #00707E;
    }

.cert-drawer-btn--outline {
    background: #FFFFFF;
    color: #374151;
    border-color: #D1D5DB;
}

    .cert-drawer-btn--outline:hover {
        background: #F9FAFB;
    }

/* Radzen tabs inside the drawer */
.cert-drawer-body .rz-tabview {
    border: none;
    background: transparent;
}

.cert-drawer-body .rz-tabview-nav {
    padding: 0 20px;
    border-bottom: 1px solid #E5E7EB;
    gap: 4px;
}

    .cert-drawer-body .rz-tabview-nav-link,
    .cert-drawer-body .rz-tabview-nav li a {
        color: #6B7280 !important;
        font-weight: 500 !important;
        font-size: 15px !important;
        padding: 14px 4px !important;
        margin-right: 16px !important;
        background: transparent !important;
        border: none !important;
        border-bottom: 2px solid transparent !important;
        white-space: nowrap !important;
    }

.cert-drawer-body li.rz-tabview-selected .rz-tabview-nav-link,
.cert-drawer-body li.rz-state-active .rz-tabview-nav-link,
.cert-drawer-body li.rz-tabview-selected a {
    color: #008D9E !important;
    border-bottom-color: #008D9E !important;
    font-weight: 600 !important;
}

.cert-drawer-body .rz-tabview-top > .rz-tabview-nav .rz-tabview-selected:after {
    content: none !important;
}
