* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f0f2f5;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #2c3e50;
    color: white;
    height: 60px;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.system-title {
    font-size: 18px;
    font-weight: 600;
    margin-right: 15px;
}

.header-left select {
    padding: 8px 12px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    background-color: #34495e;
    color: white;
    cursor: pointer;
}

.header-left select:hover {
    background-color: #3d566e;
}

.menu-item {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
}

.menu-item:hover {
    background-color: #34495e;
}

.menu-item.active {
    background-color: #3498db;
}

.header-right button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.header-right button:hover {
    background-color: #2980b9;
}

#main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#content-area {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

#right-panel {
    width: 35%;
    min-width: 300px;
    max-width: 500px;
    background-color: white;
    border-left: 1px solid #ddd;
    overflow-y: auto;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

#right-panel.hidden {
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

#device-tooltip {
    position: absolute;
    left: 20px;
    right: 20px;
    top: 60px;
    width: auto;
    max-height: 40%;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 15px;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

#device-tooltip.hidden {
    display: none;
}

.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.card-header h3 {
    color: #2c3e50;
    font-size: 16px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #219a52;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

table tr:hover {
    background-color: #f8f9fa;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #2c3e50;
}

.modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

#canvas-container {
    width: 100%;
    flex-grow: 1;
    height: 100%;
    min-height: 500px;
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.panel-editor {
    display: flex;
    gap: 20px;
}

.panel-editor-left {
    flex: 1;
}

.panel-editor-right {
    width: 200px;
}

.interface-library {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.interface-item {
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.3s;
}

.interface-item:hover {
    border-color: #3498db;
    background-color: #f0f7ff;
}

.interface-item svg {
    width: 40px;
    height: 40px;
}

.panel-canvas {
    border: 2px dashed #ddd;
    border-radius: 8px;
    min-height: 400px;
    position: relative;
    background-color: #f8f9fa;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state h4 {
    margin-bottom: 10px;
    color: #666;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

#panel-detail {
    padding: 20px;
}

#panel-detail h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

#panel-detail .detail-item {
    margin-bottom: 5px;
}

#panel-detail .detail-item label {
    font-weight: 600;
    color: #666;
    display: inline-block;
    width: 80px;
}

#panel-detail .panel-svg {
    margin-top: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    background-color: #f8f9fa;
    width: 100%;
    max-width: 100%;
    overflow: auto;
}

#panel-detail .panel-svg svg {
    width: 100% !important;
    height: auto !important;
    display: block;
}

.panel-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.interface-item {
    cursor: grab;
    user-select: none;
}

.interface-item:active {
    cursor: grabbing;
}

.panel-canvas {
    position: relative;
}

.panel-interface {
    cursor: pointer;
    color: #333 !important;
}

.panel-interface svg {
    display: block;
    color: inherit;
}

.panel-interface svg * {
    stroke: currentColor !important;
}

.selected-interface {
    animation: selectedBlink 1s infinite;
}

.selected-interface svg * {
    stroke: #ff0000 !important;
}

.connected-interface svg * {
    stroke: #00aa00 !important;
}

@keyframes selectedBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.panel-interface-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-row input[type="color"] {
    width: 50px;
    height: 35px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.color-picker-row input[type="range"] {
    width: 100px;
}

.color-picker-row span {
    min-width: 40px;
    font-size: 12px;
    color: #666;
}

.recent-colors {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.recent-colors-label {
    font-size: 12px;
    color: #666;
    width: 100%;
    margin-bottom: 4px;
}

.recent-color-item {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: transform 0.2s;
}

.recent-color-item:hover {
    transform: scale(1.1);
    border-color: #3498db;
}