/* ==========================================================================
   Drawlogic WebRTC DataChannel & RUDP Transport Lab Styles
   ========================================================================== */

.rudp-lab-shell {
    margin-top: 1.5rem;
    margin-bottom: 3.5rem;
    color: #e2e8f0;
}

.is-embed-shell {
    margin: 0;
    padding: 0.75rem;
    max-width: 100% !important;
}

.rudp-lab-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rudp-lab-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.rudp-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
}

.rudp-lab-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.rudp-lab-header p {
    font-size: 1.05rem;
    color: #94a3b8;
    line-height: 1.6;
    max-width: 850px;
    margin-bottom: 1.25rem;
}

/* Control Deck */
.rudp-control-deck {
    margin-bottom: 1.5rem;
}

.rudp-control-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.rudp-slider-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.rudp-control-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rudp-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rudp-field-header label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rudp-val-pill {
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    font-family: Consolas, monospace;
}

.rudp-field-hint {
    font-size: 0.72rem;
    color: #64748b;
}

.rudp-control-field input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    margin: 0.4rem 0;
}

.rudp-control-field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38bdf8;
    cursor: pointer;
    border: 2px solid #0f172a;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.rudp-select {
    background: #090d14;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: #f8fafc;
    font-size: 0.85rem;
    outline: none;
    margin: 0.2rem 0;
}

.rudp-deck-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rudp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    background: #38bdf8;
    color: #090d14;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rudp-btn:hover {
    background: #7dd3fc;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.rudp-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.rudp-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Arena & Simulation Canvas */
.rudp-arena-container {
    background: #080c14;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.rudp-arena-header {
    background: rgba(15, 23, 42, 0.85);
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rudp-arena-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
}

.rudp-arena-legend {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.legend-chip {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-server { background: rgba(255, 255, 255, 0.1); color: #cbd5e1; border: 1px dashed rgba(255, 255, 255, 0.3); }
.legend-tcp { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.legend-udp { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.4); }
.legend-rudp { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

.rudp-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
    background: radial-gradient(circle at center, #0e1726 0%, #05080f 100%);
    cursor: crosshair;
}

#rudp-simulation-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.rudp-cursor-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: #38bdf8;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Three Protocol Track Cards */
.rudp-tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.rudp-track-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.track-tcp { border-top: 3px solid #f59e0b; }
.track-udp { border-top: 3px solid #f43f5e; }
.track-rudp { border-top: 3px solid #10b981; }

.track-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.track-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.track-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-tcp { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.dot-udp { background: #f43f5e; box-shadow: 0 0 8px #f43f5e; }
.dot-rudp { background: #10b981; box-shadow: 0 0 8px #10b981; }

.track-card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.track-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

.track-desc {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.track-stats {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.track-stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.stat-label { color: #64748b; }
.stat-val { font-weight: 700; color: #f1f5f9; }

/* Inspector Deck */
.rudp-inspector-deck {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.rudp-inspector-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1.25rem;
}

.rudp-inspector-header h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.rudp-inspector-sub {
    font-size: 0.72rem;
    color: #64748b;
    display: block;
    margin-bottom: 1rem;
}

.rudp-bitfield-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 4px;
    margin-bottom: 0.85rem;
}

.bit-box {
    aspect-ratio: 1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: Consolas, monospace;
    transition: all 0.2s ease;
}

.bit-box.is-ack { background: rgba(16, 185, 129, 0.25); border: 1px solid #10b981; color: #34d399; }
.bit-box.is-lost { background: rgba(244, 63, 94, 0.25); border: 1px solid #f43f5e; color: #fb7185; }
.bit-box.is-pending { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: #64748b; }

.rudp-bitfield-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.72rem;
    color: #94a3b8;
}

.bit-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 0.25rem;
}

.bit-ack { background: #10b981; }
.bit-lost { background: #f43f5e; }
.bit-pending { background: #64748b; }

.rudp-telemetry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.telem-box {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
}

.telem-number {
    font-size: 1.4rem;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.1;
    font-family: Consolas, monospace;
}

.telem-name {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    text-transform: uppercase;
}

.text-warn { color: #f59e0b !important; }
.text-success { color: #10b981 !important; }
.font-mono { font-family: Consolas, monospace; }

@media (max-width: 768px) {
    .rudp-lab-header h1 { font-size: 1.7rem; }
    .rudp-slider-row { grid-template-columns: 1fr; }
    .rudp-canvas-wrapper { height: 300px; }
    .rudp-bitfield-grid { grid-template-columns: repeat(8, 1fr); }
}

