/* style.css - HTS Style Dark Theme */
:root {
    --bg-color: #1e1e1e;
    --panel-bg: #2d2d30;
    --border-color: #3f3f46;
    --text-color: #d4d4d4;
    --header-bg: #007acc;
    --highlight: #007acc;
    --accent: #ffeb3b;
    --danger: #f44336;
    --success: #4caf50;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Malgun Gothic', 'Dotum', sans-serif;
    margin: 0;
    padding: 0;
    font-size: 13px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background-color: var(--header-bg);
    color: white;
    padding: 5px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #005a9e;
}
.header h1 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}
.header h1 span {
    font-size: 14px;
    font-weight: normal;
    color: #e0e0e0;
}

/* Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 5px;
    gap: 5px;
}

.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.panel-header {
    background-color: #3e3e42;
    padding: 5px 10px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    color: #fff;
}

/* Left Panel */
.left-panel {
    width: 250px;
    min-width: 250px;
}
.tree-container {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}
.tree-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}
.tree-category {
    font-weight: bold;
    margin-bottom: 5px;
    color: #4daaf1;
    cursor: pointer;
}
.tree-category ul {
    list-style-type: none;
    padding-left: 15px;
    font-weight: normal;
    margin-top: 5px;
}
.tree-item {
    padding: 3px 5px;
    cursor: pointer;
    color: var(--text-color);
}
.tree-item:hover {
    background-color: #3f3f46;
    color: #fff;
}
.tree-item.active {
    background-color: var(--highlight);
    color: white;
}

/* Right Panel */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Setting Panel */
.condition-setting-panel {
    height: 120px;
}
.setting-controls {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.setting-controls input, .setting-controls select {
    background-color: #1e1e1e;
    color: white;
    border: 1px solid #555;
    padding: 4px 8px;
}
.btn {
    padding: 4px 15px;
    cursor: pointer;
    border: 1px solid #555;
    background-color: #3e3e42;
    color: white;
    font-size: 13px;
}
.btn:hover { background-color: #555; }
.btn-primary { background-color: var(--highlight); border-color: #005a9e; }
.btn-primary:hover { background-color: #005a9e; }
.btn-danger { background-color: var(--danger); border-color: #d32f2f; }

/* List Panel */
.condition-list-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.condition-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    border-bottom: 1px solid var(--border-color);
}
.condition-table {
    width: 100%;
    border-collapse: collapse;
}
.condition-table th, .condition-table td {
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    text-align: left;
}
.condition-table th { background-color: #333; }

.logic-expression-box {
    padding: 10px;
    background-color: #252526;
    display: flex;
    align-items: center;
    gap: 10px;
}
.logic-expression-box input {
    flex: 1;
    padding: 6px;
    font-size: 14px;
    font-weight: bold;
    background-color: #1e1e1e;
    color: var(--accent);
    border: 1px solid #555;
}

/* Bottom Panel (Grid) */
.bottom-panel {
    height: 40%;
    margin: 0 5px 5px 5px;
}
.table-responsive {
    flex: 1;
    overflow: auto;
    padding: 5px;
}

/* DataTables Overrides for Dark Mode */
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_processing, .dataTables_wrapper .dataTables_paginate {
    color: var(--text-color) !important;
}
table.dataTable tbody tr { background-color: var(--bg-color); }
table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 { background-color: #262626; }
table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 { background-color: #1e1e1e; }
table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1 { background-color: #333; }
table.dataTable tbody tr:hover { background-color: #333 !important; }
table.dataTable { border-color: var(--border-color); }
table.dataTable thead th { border-bottom: 1px solid #555; color: #fff; }

/* Modal */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7);
}
.modal-content {
    background-color: var(--panel-bg); margin: 10% auto; padding: 20px; border: 1px solid var(--highlight); width: 60%; color: white; border-radius: 5px;
}
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover { color: white; }

.tooltip-box {
    background-color: #1e1e1e; border-left: 3px solid var(--accent); padding: 10px; margin-top: 10px; font-size: 12px; color: #bbb;
}

/* --- 모바일 반응형 (Responsive Layout) --- */
@media (max-width: 768px) {
    .app-container {
        height: auto;
        min-height: 100vh;
    }
    .main-layout {
        flex-direction: column;
        overflow: visible;
    }
    .left-panel {
        width: 100%;
        min-width: 100%;
        height: 220px; /* 트리 메뉴 높이 고정 */
        flex-shrink: 0;
    }
    .right-panel {
        flex: none;
    }
    .condition-setting-panel {
        height: auto;
    }
    .setting-controls {
        flex-wrap: wrap; /* 모바일에서 폼 요소들이 줄바꿈되도록 */
    }
    .logic-expression-box {
        flex-wrap: wrap;
    }
    .bottom-panel {
        flex: none;
        height: 500px; /* 결과표 높이 */
        margin-bottom: 20px;
    }
    .modal-content {
        width: 90%;
        margin: 10% auto;
        padding: 15px;
    }
}
