/* BNetzA — Module Styles */

/* Expand/collapse button (mirrors .st-expand-btn from Speedtest) */
.bnetz-expand-btn {
    background: none; border: none; cursor: pointer; padding: 4px;
    color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
    vertical-align: middle;
}
.bnetz-expand-btn:hover { color: var(--text-primary); }
.bnetz-expand-btn.open { transform: rotate(90deg); color: var(--accent); }
.bnetz-expand-btn i { width: 14px; height: 14px; }

/* Refresh button (mirrors #speedtest-refresh-btn) */
.bnetz-refresh-btn {
    background: none; border: none; cursor: pointer; padding: 6px;
    color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); transition: color 0.2s ease, background 0.2s ease;
}
.bnetz-refresh-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.bnetz-refresh-btn i { width: 16px; height: 16px; }

/* Inline action icons (complaint, PDF, delete) */
.bnetz-actions-cell { white-space: nowrap; }
.bnetz-action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px; margin-right: 4px; border-radius: var(--radius-sm, 4px);
    color: var(--text-muted); text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}
.bnetz-action-btn:hover { color: var(--accent); background: rgba(168,85,247,0.1); }
.bnetz-action-btn i { width: 15px; height: 15px; }
.bnetz-action-delete:hover { color: var(--crit); background: rgba(239,68,68,0.1); }

/* Verdict icon */
.bnetz-verdict { text-align: center; }
.bnetz-verdict i { width: 18px; height: 18px; }
.bnetz-verdict-text { display: none; }

/* Detail expand cell */
.bnetz-detail-cell { padding: 0 8px 12px 24px; }

/* Detail grid (Download / Upload side-by-side) */
.bnetz-detail-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px; margin-top: 8px;
}

/* Section label (Download / Upload) */
.bnetz-detail-label {
    font-size: 0.85em; font-weight: 600; color: var(--text-secondary);
    display: block; margin-bottom: 4px;
}

/* Compact measurement table */
.bnetz-detail-table {
    width: 100%; font-size: 0.8em; border-collapse: collapse;
}
.bnetz-detail-table th {
    text-align: left; padding: 3px 6px; font-weight: 600;
    color: var(--text-secondary); border-bottom: 1px solid var(--card-border);
}
.bnetz-detail-table td {
    padding: 3px 6px;
}
.bnetz-detail-table tr + tr { border-bottom: 1px solid var(--card-border); }
.bnetz-detail-speed-col { text-align: right; }

@media (max-width: 600px) {
    .bnetz-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    #bnetz-table-card {
        overflow-x: hidden;
    }

    #bnetz-table,
    #bnetz-table > tbody {
        display: block;
        width: 100%;
    }

    #bnetz-table > thead {
        display: none;
    }

    #bnetz-table > tbody > tr[data-bnetz-idx] {
        display: block;
        padding: 10px 12px;
        border-bottom: 1px solid var(--card-border, var(--input-border));
    }

    #bnetz-table > tbody > tr[data-bnetz-idx] > td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-tint, rgba(255,255,255,0.08));
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: right;
    }

    #bnetz-table > tbody > tr[data-bnetz-idx] > td:last-child {
        border-bottom: none;
    }

    #bnetz-table > tbody > tr[data-bnetz-idx] > td::before {
        content: attr(data-label);
        flex: 0 0 min(46%, 150px);
        color: var(--text-secondary, var(--text-muted));
        font-size: 0.82em;
        font-weight: 600;
        text-align: left;
    }

    #bnetz-table > tbody > tr[data-bnetz-idx] > td:first-child {
        align-items: center;
    }

    .bnetz-expand-btn {
        min-width: 36px;
        min-height: 36px;
        margin-right: 4px;
    }

    #bnetz-table > tbody > tr[data-bnetz-idx] > .bnetz-verdict {
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
    }

    .bnetz-verdict-text {
        display: inline;
        overflow-wrap: anywhere;
    }

    .bnetz-actions-cell {
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
        white-space: normal;
    }

    .bnetz-actions-cell::before {
        margin-right: auto;
    }

    .bnetz-action-btn {
        min-width: 40px;
        min-height: 40px;
        margin-right: 0;
    }

    .bnetz-detail-cell {
        display: block;
        width: 100%;
        padding: 10px 12px 14px;
        overflow-x: hidden;
    }

    .bnetz-detail-table {
        table-layout: fixed;
    }

    .bnetz-detail-table th,
    .bnetz-detail-table td {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
