/* ═══════════════════════════════════════════════════════
   CTM Monitor Frontend [ct_monitor_frontend]
   Tabella globale certificati in evidenza
   ═══════════════════════════════════════════════════════ */

.ctmf {
    --brand: #008572;
    --brand-hover: #006e5e;
    --brand-light: #e6f5f2;
    --brand-ultra-light: #f4faf8;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --yellow: #d97706;
    --yellow-bg: #fefce8;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --dark: #1a1a2e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --radius: 0.3em;

    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
}

/* ─── Mini header ────────────────────────────────────── */

.ctmf__header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
}

/* Su desktop l'header mobile è nascosto */
.ctmf__header--mobile {
    display: none;
}

.ctmf__update-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-500);
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.ctmf__dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: ctmf-blink 2.5s infinite;
    flex-shrink: 0;
}

@keyframes ctmf-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── Semaforo cards ─────────────────────────────────── */

.ctmf__semaforo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.ctmf__sem-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--color-content-border);
}

.ctmf__sem-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ctmf__sem-card--verde .ctmf__sem-icon { background: var(--green-bg); color: var(--green); }
.ctmf__sem-card--giallo .ctmf__sem-icon { background: var(--yellow-bg); color: var(--yellow); }
.ctmf__sem-card--rosso .ctmf__sem-icon { background: var(--red-bg); color: var(--red); }

.ctmf__sem-icon svg {
    width: 20px;
    height: 20px;
}

.ctmf__sem-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.ctmf__sem-info strong {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.ctmf__sem-card--verde .ctmf__sem-info strong { color: var(--green); }
.ctmf__sem-card--giallo .ctmf__sem-info strong { color: var(--yellow); }
.ctmf__sem-card--rosso .ctmf__sem-info strong { color: var(--red); }

.ctmf__sem-info span {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 500;
    line-height: 1.3;
}

/* ─── Filtri ─────────────────────────────────────────── */

.ctmf__filters {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--color-content-border);
}

.ctmf__filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ctmf__select {
    box-sizing: border-box;
}

/* Badge verde per il contatore risultati */
.ctmf__results {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-light);
    padding: 4px 12px;
    border-radius: var(--radius);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Tabella ────────────────────────────────────────── */

.ctmf__table-wrap {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: none !important;
}

.ctmf__table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ctmf__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    line-height: 1.5;
    background: #fff;
}

/* Thead - bordi tutti verdi */
.ctmf__table thead {
    background: #008572;
}

.ctmf__table thead th {
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
    border-top: 1px solid #008572;
    border-bottom: 1px solid #008572;
}

.ctmf__table thead th:first-child {
    border-left: 1px solid #008572;
}

.ctmf__table thead th:last-child {
    border-right: 1px solid #008572;
}

/* Colonne numeriche header: dalla 4a in poi */
.ctmf__table thead th:nth-child(n+4) {
    text-align: right;
}

/* Tbody - bordi grigi su sinistra, destra e sotto */
.ctmf__table tbody tr {
    transition: background 0.12s;
}

.ctmf__table tbody tr:hover {
    background: var(--brand-ultra-light);
}

.ctmf__table tbody td {
    padding: 13px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.ctmf__table tbody td:first-child {
    border-left: 1px solid var(--color-content-border);
}

.ctmf__table tbody td:last-child {
    border-right: 1px solid var(--color-content-border);
}

.ctmf__table tbody tr:last-child td {
    border-bottom: 1px solid var(--color-content-border);
}

/* Celle numeriche (dalla 4a in poi) */
.ctmf__table tbody td:nth-child(n+4) {
    text-align: right;
}

/* Celle */
.ctmf__isin {
    font-size: 14px;
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
}

.ctmf__isin-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.ctmf__copy-icon {
    color: var(--brand);
    cursor: pointer;
    font-size: 13px;
}

.ctmf__leggi-link {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.ctmf__emittente {
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
    white-space: nowrap;
}

.ctmf__sotto {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ctmf__sott-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 7px;
    background: var(--brand-light);
    color: var(--brand);
    border-radius: var(--radius);
    white-space: nowrap;
    line-height: 1.5;
}

.ctmf__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
}

/* Distanza */
.ctmf__barrier-cell {
    display: flex;
    align-items: center;
    gap: 7px;
    justify-content: flex-end;
}

.ctmf__bdot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ctmf__dot--verde  { background: var(--green); }
.ctmf__dot--giallo { background: var(--yellow); }
.ctmf__dot--rosso  { background: var(--red); }
.ctmf__dot--nd     { background: var(--gray-400); }

.ctmf__bval {
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.ctmf__bval--verde  { color: var(--green); }
.ctmf__bval--giallo { color: var(--yellow); }
.ctmf__bval--rosso  { color: var(--red); }
.ctmf__bval--nd     { color: var(--gray-400); font-weight: 400; }

/* Osservazione */
.ctmf__obs {
    display: flex;
    flex-direction: column;
    gap: 1px;
    align-items: flex-end;
}

.ctmf__obs-days {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.ctmf__obs-date {
    font-size: 12px;
    color: var(--gray-400);
}

/* Riga nascosta dal filtro */
.ctmf__row--hidden {
    display: none;
}

/* ─── Portfolio CTA ──────────────────────────────────── */

.ctmf__cta {
    background: #fff;
    border-radius: var(--radius);
    border: 2px dashed var(--color-content-border);
    padding: 40px 32px;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s;
}

.ctmf__cta:hover {
    border-color: var(--brand-light);
}

.ctmf__cta-icon {
    width: 52px;
    height: 52px;
    background: var(--brand-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    color: var(--brand);
}

.ctmf__cta-icon svg {
    width: 26px;
    height: 26px;
}

.ctmf__cta h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.ctmf__cta p {
    font-size: 16px;
    color: var(--gray-500);
    max-width: 460px;
    margin: 0 auto 22px;
    line-height: 1.6;
}

.ctmf__btn-primary {
    display: inline-flex;
    align-items: center;
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.ctmf__btn-primary:hover {
    background: var(--brand-hover);
    color: #fff;
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

.ctmf__cta-features {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.ctmf__cta-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--gray-600);
    font-weight: 500;
}

.ctmf__cta-feat-icon {
    width: 38px;
    height: 38px;
    background: var(--gray-50);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    border: 1px solid var(--color-content-border);
    flex-shrink: 0;
}

/* ─── Disclaimer ─────────────────────────────────────── */

.ctmf__disclaimer {
    font-size: 11px;
    color: var(--gray-400);
    line-height: 1.7;
    padding-top: 16px;
    padding-bottom: 32px;
    margin-top: 8px;
}

/* ─── Tablet (≤1024px) ───────────────────────────────── */

@media (max-width: 1024px) {
    .ctmf__semaforo { gap: 1rem; }
    .ctmf__semaforo,
    .ctmf__filters,
    .ctmf__table-wrap,
    .ctmf__cta { margin-bottom: 1rem; }

    /* Su tablet/mobile: mostra header in cima, nascondi tag nei filtri */
    .ctmf__header--mobile { display: flex; }
    .ctmf__update-tag--desktop { display: none; }
}

/* ─── Mobile (≤768px) ────────────────────────────────── */

@media (max-width: 768px) {
    .ctmf__semaforo {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .ctmf__semaforo,
    .ctmf__filters,
    .ctmf__table-wrap,
    .ctmf__cta { margin-bottom: 1rem; }

    .ctmf__sem-card {
        padding: 14px 16px;
    }

    .ctmf__sem-info strong {
        font-size: 22px;
    }

    .ctmf__filters {
        flex-wrap: wrap;
        gap: 8px;
    }

    .ctmf__filter-group {
        flex-wrap: wrap;
        width: 100%;
    }

    .ctmf__select {
        flex: 1;
        min-width: 140px;
    }

    .ctmf__results {
        margin-left: 0;
    }

    .ctmf__cta {
        padding: 28px 16px;
    }

    .ctmf__cta-features {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .ctmf__table thead th,
    .ctmf__table tbody td {
        padding: 12px 12px;
    }
}

