/* Phong cách chung */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f2f5;
    color: #333;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
    font-size: 28px;
}

/* Phần nhập/xuất */
.import-export {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.import-export button {
    padding: 10px 20px;
    font-size: 16px;
}

/* Khung chính */
.creator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 900px) {
    .creator-container {
        grid-template-columns: 1fr;
    }
}

/* Phần ảnh */
.upload-section {
    padding: 20px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.canvas-container {
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    padding: 15px;
    background-color: white;
    margin-top: 15px;
    text-align: center;
}

#component-canvas {
    max-width: 100%;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    display: block;
    margin: 0 auto;
}

/* Điều khiển kích thước */
.size-controls {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.size-controls label {
    font-weight: 500;
}

.size-controls input {
    width: 80px;
    padding: 8px;
}

/* Phần điểm nối */
.connection-section {
    padding: 20px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.connection-controls {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
}

.connection-controls label {
    font-weight: 500;
    white-space: nowrap;
}

.connection-controls input, 
.connection-controls select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 100%;
}

.connection-controls button {
    grid-column: span 2;
    margin-top: 10px;
    padding: 10px;
}

/* Danh sách điểm nối */
#connections-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 20px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    background-color: white;
}

.connection-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #6c757d;
}

.connection-item.power { border-left-color: #dc3545; }
.connection-item.signal { border-left-color: #28a745; }
.connection-item.ground { border-left-color: #6c757d; }

.connection-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.connection-details {
    flex-grow: 1;
    min-width: 0;
}

.connection-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.connection-properties {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #6c757d;
}

.remove-connection {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 10px;
    flex-shrink: 0;
}

.no-connections {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 15px;
}

/* Phần thông tin */
.info-section {
    padding: 20px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    grid-column: span 2;
}

@media (max-width: 900px) {
    .info-section {
        grid-column: span 1;
    }
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Nút bấm */
button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0069d9;
}

button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}