/* ========================================================================
   DSRL WORKSPACE SPECIFIC STYLES
   Focus: Grid Precision, Proportions, Layout Fixes
   ======================================================================== */

/* --- ROOT LAYOUT --- */
.workspace-body {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.tools-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1;
    overflow: hidden; /* Важно: чтобы скроллились только части */
}

/* --- SIDEBAR --- */
.tools-sidebar {
    background-color: #161b22;
    border-right: 1px solid #30363d;
    padding: 24px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-group {
    margin-bottom: 24px;
}

.group-title {
    padding: 0 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #8b949e;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
}

.sidebar-item {
    width: 100%;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    padding: 10px 20px;
    color: #c9d1d9;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: 0.15s ease;
    display: block;
}

.sidebar-item:hover {
    background-color: #21262d;
    color: #58a6ff;
}

.sidebar-item.active {
    background-color: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
    border-left-color: #58a6ff;
    font-weight: 600;
}

/* --- WORKSPACE VIEWPORT --- */
.tools-workspace {
    background-color: #0d1117;
    background-image: radial-gradient(circle at 50% 50%, #161b22 0%, #0d1117 100%);
    padding: 40px;
    overflow-y: auto;
    display: block;
}

.tool-view {
    max-width: 900px;
    margin: 0 auto;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #58a6ff;
    border-bottom: 1px solid #30363d;
    padding-bottom: 12px;
}

/* --- CARDS & PANELS --- */
.workspace-card {
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8b949e;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* --- CONTROLS: FIXED PROPORTIONS --- */
.controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.controls-row .btn, 
.controls-row input, 
.controls-row select {
    height: 38px !important; /* Принудительная высота для всех */
    margin-bottom: 0;
}

textarea {
    width: 100%;
    background-color: #010409;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 12px;
    border-radius: 6px;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* --- SPLIT VIEW (50/50) --- */
.split-view {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.pane {
    flex: 1;
    min-width: 0; /* Предотвращает раздувание */
}

/* --- OUTPUT BOXES --- */
.result-box {
    background-color: #000;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 16px;
    color: #3fb950;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    word-break: break-all;
    min-height: 40px;
    position: relative;
}

.code-box {
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* --- SPECIAL WIDGETS --- */

/* Subnet Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #30363d;
}

.data-table td:first-child {
    color: #8b949e;
    width: 180px;
}

/* Binary Visualizer */
.binary-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: #010409;
    padding: 20px;
    border-radius: 6px;
    justify-content: center;
}

.bin-octet {
    text-align: center;
}

.bin-octet .bin {
    display: block;
    color: #58a6ff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* Stat Pills */
.stats-row {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.stat-pill {
    background: #21262d;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    color: #8b949e;
}

/* --- RESPONSIVE FIXES --- */

/* Планшеты (Desktop-to-Tablet) */
@media (max-width: 1024px) {
    .tools-layout {
        grid-template-columns: 220px 1fr;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .tools-layout {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .tools-sidebar {
        border-right: none;
        border-bottom: 1px solid #30363d;
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
        height: auto;
        white-space: nowrap;
    }

    .sidebar-group {
        display: flex;
        margin-bottom: 0;
    }

    .group-title {
        display: none;
    }

    .sidebar-item {
        border-left: none;
        border-bottom: 2px solid transparent;
        padding: 8px 15px;
    }

    .sidebar-item.active {
        border-bottom-color: #58a6ff;
    }

    .tools-workspace {
        padding: 20px;
    }

    .split-view {
        flex-direction: column;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Тонкая настройка скроллбаров */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b949e;
}