.reference-page {
    max-width: 100%;
}

.ref-header {
    text-align: center;
    margin-bottom: 2rem;
}

.ref-header h2 {
    font-size: 1.75rem;
    color: var(--accent-cyan);
    margin-bottom: 0.5rem;
}

.ref-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ref-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.ref-tab {
    padding: 0.6rem 1.2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ref-tab:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

.ref-tab.active {
    background: rgba(0, 217, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.ref-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.ref-search-wrap {
    flex: 1;
    min-width: 200px;
}

.ref-search {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.ref-search:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.2);
}

.ref-search::placeholder {
    color: var(--text-muted);
}

.ref-filter {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
}

.ref-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.ref-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-card);
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ref-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.ref-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    color: var(--accent-cyan);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.ref-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.ref-table tbody tr {
    transition: background 0.15s ease;
}

.ref-table tbody tr:hover {
    background: rgba(0, 217, 255, 0.05);
}

.ref-table tbody tr:last-child td {
    border-bottom: none;
}

.ref-port-cell {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-green);
    white-space: nowrap;
}

.ref-name-cell {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.ref-proto-cell {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.ref-mono-cell {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ref-desc-cell {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 300px;
}

.ref-num-cell {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    color: var(--text-primary);
    white-space: nowrap;
}

.ref-usage-cell {
    font-size: 0.75rem;
    max-width: 280px;
    word-break: break-all;
}

.ref-cat-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent-cyan);
    white-space: nowrap;
}

.ref-status-cell {
    text-align: center;
    color: var(--accent-green);
    font-weight: 700;
}

.ref-mastered {
    background: rgba(0, 255, 136, 0.03);
}

.ref-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1rem;
}

/* ── OSI Model Cards ─────────────────────── */

.osi-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.osi-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-left: 5px solid var(--layer-color);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.osi-card:hover {
    border-color: var(--layer-color);
}

.osi-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.15);
}

.osi-layer-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--layer-color);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.osi-layer-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    flex: 1;
}

.osi-pdu {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--layer-color);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.osi-card-body {
    padding: 0.75rem 1.25rem 1rem;
}

.osi-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.osi-details {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.osi-detail-group {
    flex: 1;
    min-width: 200px;
}

.osi-detail-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.osi-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.osi-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 3px;
    color: var(--accent-cyan);
}

.osi-tag-device {
    background: rgba(255, 159, 67, 0.1);
    border-color: rgba(255, 159, 67, 0.25);
    color: #ff9f43;
}

/* ── Encryption Status Badges ────────────── */

.ref-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ref-status-current {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.25);
    color: var(--accent-green);
}

.ref-status-deprecated {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: #ff6b6b;
}

.ref-type-symmetric {
    background: rgba(0, 217, 255, 0.1);
    border-color: rgba(0, 217, 255, 0.2);
    color: var(--accent-cyan);
}

.ref-type-asymmetric {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.25);
    color: #a855f7;
}

.ref-type-hashing {
    background: rgba(255, 159, 67, 0.1);
    border-color: rgba(255, 159, 67, 0.25);
    color: #ff9f43;
}

/* ── CIDR Calculator ─────────────────────── */

.cidr-section-title {
    font-size: 1.1rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    font-weight: 700;
}

.cidr-calculator {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.cidr-calc-input-wrap {
    margin-bottom: 1rem;
}

.cidr-calc-placeholder {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cidr-calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.cidr-calc-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cidr-calc-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.cidr-calc-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-green);
}

/* ── Private/Reserved Ranges ────────────── */

.cidr-private-section {
    margin-bottom: 1.5rem;
}

.cidr-toggle-btn {
    width: 100%;
    text-align: left;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cidr-toggle-btn:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 217, 255, 0.05);
}

.cidr-toggle-icon {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    transition: transform 0.2s ease;
}

.cidr-private-content {
    margin-top: 0.75rem;
}

/* Subnet calculation guide */
.cidr-guide {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.cidr-guide-step {
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.cidr-guide-step-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
}

.cidr-guide-step-content h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.cidr-guide-step-content p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.cidr-guide-example {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.cidr-guide-example code {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre;
}

.cidr-guide-example .guide-hl {
    color: var(--accent-cyan);
    font-weight: 700;
}

.cidr-guide-tip {
    color: var(--accent-orange) !important;
    font-style: italic;
    font-size: 0.8rem !important;
}

@media (max-width: 768px) {
    .cidr-guide-step {
        flex-direction: column;
        gap: 0.5rem;
    }

    .cidr-guide-example code {
        font-size: 0.7rem;
    }
}

.ref-scope-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.scope-private {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.25);
    color: var(--accent-green);
}

.scope-special {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.25);
    color: var(--accent-orange);
}

/* ── CIDR Highlights ─────────────────────── */

.cidr-highlight {
    background: rgba(0, 217, 255, 0.05);
}

.cidr-highlight td:first-child {
    position: relative;
}

.cidr-highlight td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-cyan);
}

/* ── Pentest Phase Badges ────────────────── */

.ref-phase-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.ref-phase-recon {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.2);
    color: var(--accent-cyan);
}

.ref-phase-enum {
    background: rgba(254, 202, 87, 0.1);
    border: 1px solid rgba(254, 202, 87, 0.25);
    color: #feca57;
}

.ref-phase-exploit {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: #ff6b6b;
}

.ref-phase-post {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: #a855f7;
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 768px) {
    .ref-toolbar {
        flex-direction: column;
    }

    .ref-search-wrap {
        min-width: unset;
        width: 100%;
    }

    .ref-filter {
        width: 100%;
    }

    .ref-table {
        font-size: 0.8rem;
    }

    .ref-table th,
    .ref-table td {
        padding: 0.5rem 0.6rem;
    }

    .ref-cat-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }

    .osi-card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .osi-details {
        flex-direction: column;
        gap: 0.75rem;
    }

    .osi-detail-group {
        min-width: unset;
    }

    .ref-desc-cell {
        max-width: 200px;
    }

    .ref-usage-cell {
        max-width: 160px;
    }

    .cidr-calc-grid {
        grid-template-columns: 1fr;
    }

    .cidr-calculator {
        padding: 1rem;
    }
}
