﻿/* Punti di emissione page — classi dedicate, indipendenti da quelle di Certificati. */

.pem-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.pem-page-header h1 {
    margin-bottom: 8px;
}

.pem-page-intro {
    color: #8b949e;
    font-size: .95rem;
    line-height: 1.5;
}

/* Bottoni */
.pem-btn {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .2s ease, transform .2s ease;
}

.pem-btn-primary {
    background-color: #238636;
    color: #fff;
}

.pem-btn-primary:hover {
    background-color: #2ea043;
    transform: translateY(-1px);
}

.pem-btn-secondary {
    background-color: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
}

.pem-btn-secondary:hover {
    background-color: #30363d;
}

.pem-btn-danger {
    background-color: #21262d;
    border: 1px solid #ad2c2c;
    color: #ff7b72;
    width: 100%;
}

.pem-btn-danger:hover {
    background-color: #3d1213;
}

/* Griglia e card PEM */
.pem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.pem-card {
    background: linear-gradient(180deg, #161b22 0%, #10141a 100%);
    border: 1px solid #30363d;
    border-radius: 14px;
    padding: 24px 26px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    display: flex;
    flex-direction: column;
}

.pem-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
    border-color: #3d4552;
}

.pem-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #30363d;
    margin-bottom: 16px;
}

.pem-card-heading {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    min-width: 0;
}

.pem-card-icon {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: #0d1117;
    border: 1px solid #30363d;
}

.pem-card-heading-text {
    min-width: 0;
}

.pem-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f0f6fc;
    line-height: 1.4;
    word-break: break-word;
}

.pem-card-desc {
    font-size: .82rem;
    color: #8b949e;
    margin-top: 4px;
    line-height: 1.4;
}

.pem-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.pem-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    font-size: .88rem;
    line-height: 1.5;
}

.pem-info-label {
    color: #8b949e;
    white-space: nowrap;
}

.pem-info-value {
    color: #c9d1d9;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.pem-card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #30363d;
}

/* Badge di stato */
.pem-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    border: 1px solid transparent;
    flex: none;
}

.pem-status-not-registered {
    background: #21262d;
    color: #8b949e;
    border-color: #30363d;
}

.pem-status-pending {
    background: #1c2e4a;
    color: #58a6ff;
    border-color: #2f5a8f;
}

.pem-status-active {
    background: #10361f;
    color: #3fb950;
    border-color: #238636;
}

.pem-status-in-service {
    background: #0d3323;
    color: #56d364;
    border-color: #1c7a3e;
}

.pem-status-failed {
    background: #3d1213;
    color: #ff7b72;
    border-color: #ad2c2c;
}

/* Alert di feedback (per card e per dialog) */
.pem-alert {
    display: none;
    padding: .55rem .85rem;
    border-radius: 8px;
    font-size: .8rem;
    margin-top: 14px;
    line-height: 1.4;
}

.pem-alert.show {
    display: block;
}

.pem-alert.ok {
    background: #10361f;
    color: #3fb950;
    border: 1px solid #238636;
}

.pem-alert.err {
    background: #3d1213;
    color: #ff7b72;
    border: 1px solid #ad2c2c;
}

.pem-alert.inf {
    background: #1c2e4a;
    color: #58a6ff;
    border: 1px solid #2f5a8f;
}

/* Dialog "Aggiungi PEM" */
.pem-dialog {
    border: 1px solid #30363d;
    border-radius: 14px;
    background: linear-gradient(180deg, #161b22 0%, #10141a 100%);
    color: #c9d1d9;
    padding: 28px 32px;
    width: min(480px, 92vw);
    max-height: 85vh;
    overflow-y: hidden;
    overflow-x: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    position: fixed;
    inset: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.pem-dialog::backdrop {
    background: rgba(1, 4, 9, .7);
}

.pem-form {
    display: flex;
    flex-direction: column;
    max-width: none;
}

.pem-form h2 {
    color: #f0f6fc;
    margin-bottom: 8px;
    font-size: 1.3rem;
}

.pem-form label {
    margin-top: 15px;
    margin-bottom: 5px;
    color: #8b949e;
    font-size: .9rem;
}

.pem-form input,
.pem-form select {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #30363d;
    background-color: #0d1117;
    color: #c9d1d9;
    font-size: 16px;
}

.pem-form input:focus,
.pem-form select:focus {
    outline: none;
    border-color: #238636;
}

.pem-form-hint {
    margin: -4px 0 4px;
    color: #8b949e;
    font-size: .8rem;
}

.pem-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
    .pem-grid {
        grid-template-columns: 1fr;
    }

    .pem-card {
        padding: 18px;
    }
}
