/* =========================================================
   Ethernet Explorer Widget
   ========================================================= */

.ethernet-widget {
    margin-top: 1.5rem;
    padding: 1.3rem;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: #f8fafc;
}

.ethernet-control-group {
    margin-bottom: 1rem;
}

.ethernet-control-group .control-label {
    display: block;
    margin-bottom: 0.55rem;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ethernet-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.ethernet-mode-btn {
    appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 0.58rem 1rem;
    background: white;
    color: #334155;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ethernet-mode-btn:hover {
    border-color: #0f172a;
    color: #0f172a;
}

.ethernet-mode-btn.active {
    background: #0f172a;
    border-color: #0f172a;
    color: white;
}

.ethernet-secondary-btn {
    background: white;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.ethernet-secondary-btn:hover {
    color: #0f172a;
    border-color: #0f172a;
    background: #f8fafc;
}

.ethernet-visual-card {
    margin-top: 1.25rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: white;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.ethernet-svg {
    display: block;
    width: 100%;
    height: auto;
    min-height: 300px;
}

.ethernet-explanation-panel,
.ethernet-sequence {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    background: white;
    border: 1px solid #e2e8f0;
}

.ethernet-explanation-panel h3,
.ethernet-sequence h3 {
    margin-top: 0;
    margin-bottom: 0.4rem;
}

.ethernet-status {
    min-height: 1.7rem;
    margin-bottom: 0;
    font-weight: 700;
    color: #0f172a;
}

.ethernet-status.good {
    color: #166534;
}

.ethernet-status.warning {
    color: #9a3412;
}

.ethernet-status.info {
    color: #1d4ed8;
}

.ethernet-sequence ol {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.ethernet-sequence li {
    margin-bottom: 0.35rem;
}

.ethernet-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    color: #475569;
    font-size: 0.92rem;
}

.ethernet-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.ethernet-legend-dot {
    width: 13px;
    height: 13px;
    border-radius: 999px;
    display: inline-block;
}

.ethernet-legend-line {
    width: 24px;
    height: 3px;
    display: inline-block;
    border-radius: 999px;
    background: #94a3b8;
}

.sender-dot {
    background: #2563eb;
}

.receiver-dot {
    background: #16a34a;
}

.collision-dot {
    background: #dc2626;
}

/* SVG */
.ethernet-link {
    stroke: #94a3b8;
    stroke-width: 6;
    stroke-linecap: round;
}

.ethernet-bus {
    stroke: #334155;
    stroke-width: 8;
    stroke-linecap: round;
}

.ethernet-switch {
    fill: #e2e8f0;
    stroke: #64748b;
    stroke-width: 2;
}

.ethernet-device {
    fill: white;
    stroke: #334155;
    stroke-width: 2.5;
}

.ethernet-device.sender {
    fill: #dbeafe;
    stroke: #2563eb;
}

.ethernet-device.receiver {
    fill: #dcfce7;
    stroke: #16a34a;
}

.ethernet-label {
    fill: #0f172a;
    font-size: 18px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
}

.ethernet-small-label {
    fill: #475569;
    font-size: 16px;
    font-weight: 650;
    text-anchor: middle;
}

.ethernet-packet {
    fill: #2563eb;
    stroke: white;
    stroke-width: 2;
}

.ethernet-packet.alt {
    fill: #7c3aed;
}

.ethernet-collision {
    fill: #dc2626;
    stroke: white;
    stroke-width: 3;
}

.ethernet-jam {
    fill: #f97316;
}

.ethernet-buffer {
    fill: #fef3c7;
    stroke: #d97706;
    stroke-width: 2;
}

.ethernet-buffer-text {
    fill: #92400e;
    font-size: 14px;
    font-weight: 700;
    text-anchor: middle;
}

.ethernet-fade {
    opacity: 0.35;
}

/* Simple SVG animations */
@keyframes ethernet-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.18); opacity: 0.72; }
}

@keyframes ethernet-collision-pop {
    0% { transform: scale(0.4); opacity: 0; }
    70% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.ethernet-pulse {
    transform-origin: center;
    animation: ethernet-pulse 0.7s ease-in-out infinite;
}

.ethernet-collision-pop {
    transform-origin: center;
    animation: ethernet-collision-pop 0.35s ease-out both;
}

@media (max-width: 720px) {
    .ethernet-widget {
        padding: 1rem;
    }

    .ethernet-svg {
        min-height: 240px;
    }

    .ethernet-button-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ethernet-button-row .small-button,
    .ethernet-mode-btn {
        justify-content: center;
        width: 100%;
    }

    .ethernet-legend {
        flex-direction: column;
        gap: 0.45rem;
    }
}
