* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    font-size: 13px;
    background: #f5f5f5;
    color: #333;
}

.files-container {
    height: 100vh;
    overflow: hidden;
    background: white;
}

.files-layout {
    display: flex;
    height: 100%;
}

/* Left Panel - Info Note */
.left-panel {
    width: 240px;
    background: #f9f9f9;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.info-note {
    background: #fffbea;
    border: 1px solid #e8d7a1;
    border-radius: 4px;
    padding: 15px;
    line-height: 1.6;
    font-size: 12px;
}

.info-note p {
    margin: 0;
}

.info-note strong {
    color: #856404;
}

/* Right Panel - File Browser */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
    background: white;
}

.launch-btn {
    padding: 10px 20px;
    background: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.launch-btn:hover {
    background: #4cae4c;
}

.file-instruction {
    padding: 15px 20px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
    color: #666;
}

/* File Tree */
.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

.tree-item {
    display: flex;
    align-items: flex-start;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
}

.tree-item:hover {
    background: #f5f5f5;
}

.toggle-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    margin-right: 4px;
    flex-shrink: 0;
    cursor: pointer;
}

.folder-icon {
    font-size: 16px;
    margin-right: 6px;
    flex-shrink: 0;
}

.item-name {
    font-weight: 500;
    color: #333;
    margin-right: 6px;
}

.item-info {
    color: #666;
    font-size: 12px;
}

/* Tree Children (nested folders) */
.tree-children {
    display: none;
    padding-left: 20px;
    width: 100%;
}

.tree-item[data-expanded="true"] > .tree-children {
    display: block;
}

.tree-item[data-expanded="true"] > .toggle-icon::before {
    content: "▼";
}

.tree-item[data-expanded="false"] > .toggle-icon::before {
    content: "▶";
}

/* Folder specific styling */
.tree-item.folder {
    flex-wrap: wrap;
}

.tree-item.folder .tree-children {
    flex-basis: 100%;
    margin-top: 4px;
}

/* Scrollbar Styling */
.left-panel::-webkit-scrollbar,
.file-tree::-webkit-scrollbar {
    width: 8px;
}

.left-panel::-webkit-scrollbar-track,
.file-tree::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.left-panel::-webkit-scrollbar-thumb,
.file-tree::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.left-panel::-webkit-scrollbar-thumb:hover,
.file-tree::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* File Manager Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-window {
    background: white;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 24px;
}

.close-btn:hover {
    color: #d9534f;
}

.modal-body {
    flex: 1;
    overflow: hidden;
    padding: 20px;
}

.file-manager-layout {
    display: flex;
    gap: 20px;
    height: 100%;
}

/* File Browser Section */
.file-browser-section {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.toolbar {
    background: #f9f9f9;
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.toolbar-btn {
    background: white;
    border: 1px solid #ccc;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 3px;
}

.toolbar-btn:hover {
    background: #f0f0f0;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.file-table thead {
    background: #f0f0f0;
    position: sticky;
    top: 0;
}

.file-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    color: #333;
}

.file-table tbody {
    overflow-y: auto;
}

.file-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.folder-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

.folder-row:hover {
    background: #f9f9f9;
}

.folder-row.selected {
    background: #e3f2fd;
}

.folder-icon {
    margin-right: 6px;
    font-size: 14px;
}

.folder-name {
    font-weight: 500;
}

/* Properties Section */
.file-properties-section {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
}

.properties-panel,
.upload-panel {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background: #f9f9f9;
}

.properties-panel h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #333;
}

.property-group {
    margin-bottom: 12px;
}

.property-group label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
}

.property-input {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    width: 100%;
}

.property-input.small {
    width: calc(100% - 40px);
    display: inline-block;
}

.property-input.full-width {
    width: 100%;
}

.color-picker-btn {
    padding: 6px 8px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 4px;
    font-size: 14px;
}

.color-picker-btn:hover {
    background: #f0f0f0;
}

/* Upload Section */
.upload-section {
    margin-top: 15px;
}

.upload-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-input {
    display: none;
}

.choose-file-btn {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.choose-file-btn:hover {
    background: #e8e8e8;
}

.file-name {
    font-size: 11px;
    color: #666;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-btn {
    padding: 6px 12px;
    background: #5cb85c;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.upload-btn:hover {
    background: #4cae4c;
}

/* Modal Footer */
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
}

.btn-insert,
.btn-cancel {
    padding: 8px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}

.btn-insert {
    background: #5cb85c;
    color: white;
}

.btn-insert:hover {
    background: #4cae4c;
}

.btn-cancel {
    background: #ccc;
    color: #333;
}

.btn-cancel:hover {
    background: #bbb;
}

/* Responsive */
@media (max-width: 1024px) {
    .files-layout {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        max-height: 30vh;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .launch-btn {
        justify-content: center;
    }
    
    .file-manager-layout {
        flex-direction: column;
    }
    
    .file-properties-section {
        width: 100%;
    }
}
