/* cert-renewals.css — Renewal Tracking Timeline */

.cert-renew-page {
    max-width: 1200px;
}

/* ── Header Actions ─────────────────────────────── */
.cert-renew-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cert-renew-range-select {
    padding: 7px 32px 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ── Summary Stats ──────────────────────────────── */
.cert-renew-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.cert-renew-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.cert-renew-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.cert-renew-stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cert-renew-stat-danger .cert-renew-stat-value { color: #ef4444; }
.cert-renew-stat-warning .cert-renew-stat-value { color: #eab308; }

/* ── Legend ──────────────────────────────────────── */
.cert-renew-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.cert-renew-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cert-renew-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.cert-renew-dot-expired { background: #991b1b; }
.cert-renew-dot-critical { background: #ef4444; }
.cert-renew-dot-warning { background: #eab308; }
.cert-renew-dot-safe { background: #22c55e; }

.cert-renew-legend-diamond {
    width: 10px;
    height: 10px;
    background: #8b5cf6;
    display: inline-block;
    transform: rotate(45deg);
}

/* ── Timeline ───────────────────────────────────── */
.cert-renew-timeline {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.cert-renew-header {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.cert-renew-domain-header {
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cert-renew-timeline-header {
    position: relative;
    height: 34px;
    border-left: 1px solid var(--border-color);
}

.cert-renew-month-label {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-left: 1px solid var(--border-color);
    box-sizing: border-box;
}

.cert-renew-month-label:first-child {
    border-left: none;
}

.cert-renew-today-label {
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 0.65rem;
    color: #3b82f6;
    font-weight: 600;
    transform: translateX(-50%);
    display: none; /* hidden since today is at left edge */
}

/* ── Timeline Rows ──────────────────────────────── */
.cert-renew-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--border-color);
    min-height: 38px;
    align-items: center;
}

.cert-renew-row:last-child {
    border-bottom: none;
}

.cert-renew-row:hover {
    background: var(--bg-tertiary);
}

.cert-renew-domain-cell {
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.cert-renew-domain-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cert-renew-domain-name:hover {
    color: var(--accent);
    text-decoration: underline;
}

.cert-renew-grade {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    flex-shrink: 0;
}

.cert-renew-grade-aplus, .cert-renew-grade-a { background: rgba(34,197,94,0.15); color: #22c55e; }
.cert-renew-grade-b { background: rgba(234,179,8,0.15); color: #eab308; }
.cert-renew-grade-c { background: rgba(249,115,22,0.15); color: #f97316; }
.cert-renew-grade-d { background: rgba(239,68,68,0.15); color: #ef4444; }
.cert-renew-grade-f { background: rgba(153,27,27,0.15); color: #991b1b; }

/* ── Timeline Cell ──────────────────────────────── */
.cert-renew-timeline-cell {
    position: relative;
    height: 26px;
    border-left: 1px solid var(--border-color);
    margin: 0 8px 0 0;
}

/* Expiry bar */
.cert-renew-bar {
    position: absolute;
    top: 6px;
    left: 0;
    height: 14px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
    min-width: 2px;
}

.cert-renew-bar-label {
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 4px;
}

.cert-renew-bar-expired {
    background: rgba(153,27,27,0.35);
    color: #fca5a5;
}

.cert-renew-bar-critical {
    background: rgba(239,68,68,0.3);
    color: #fca5a5;
}

.cert-renew-bar-warning {
    background: rgba(234,179,8,0.25);
    color: #fde68a;
}

.cert-renew-bar-safe {
    background: rgba(34,197,94,0.2);
    color: #86efac;
}

/* Expiry end marker */
.cert-renew-expiry-marker {
    position: absolute;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translateX(-50%);
}

.cert-renew-expiry-marker.cert-renew-bar-expired { background: #991b1b; }
.cert-renew-expiry-marker.cert-renew-bar-critical { background: #ef4444; }
.cert-renew-expiry-marker.cert-renew-bar-warning { background: #eab308; }
.cert-renew-expiry-marker.cert-renew-bar-safe { background: #22c55e; }

/* Predicted renewal diamond */
.cert-renew-diamond {
    position: absolute;
    top: 7px;
    width: 10px;
    height: 10px;
    transform: translateX(-50%) rotate(45deg);
    border: 2px solid;
    z-index: 2;
}

.cert-renew-confidence-high {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.cert-renew-confidence-medium {
    background: rgba(139,92,246,0.5);
    border-color: #8b5cf6;
}

.cert-renew-confidence-low {
    background: transparent;
    border-color: #8b5cf6;
}

/* ── History Section ────────────────────────────── */
.cert-renew-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 12px;
}

.cert-renew-history {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.cert-renew-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
}

.cert-renew-history-item:last-child {
    border-bottom: none;
}

.cert-renew-history-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
    min-width: 100px;
    flex-shrink: 0;
}

.cert-renew-history-domain {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 140px;
    flex-shrink: 0;
}

.cert-renew-history-detail {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* ── Empty State ────────────────────────────────── */
.cert-renew-page .cert-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.cert-renew-page .cert-empty svg { color: var(--text-tertiary); margin-bottom: 16px; }
.cert-renew-page .cert-empty h3 { font-size: 1.1rem; color: var(--text-primary); margin: 0 0 8px; }
.cert-renew-page .cert-empty p { margin: 0 0 20px; font-size: 0.9rem; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    .cert-renew-header,
    .cert-renew-row {
        grid-template-columns: 140px 1fr;
    }
    .cert-renew-stats { gap: 8px; }
    .cert-renew-stat { padding: 8px 12px; }
    .cert-renew-history-item { flex-wrap: wrap; gap: 4px 8px; }
}

@media (max-width: 500px) {
    .cert-renew-header,
    .cert-renew-row {
        grid-template-columns: 110px 1fr;
    }
    .cert-renew-domain-name { font-size: 0.75rem; }
    .cert-renew-actions { flex-direction: column; align-items: flex-end; }
}
