:root {
	--track-height: 40px;
}


* {
	box-sizing: border-box;
}

body,
html {
	margin: 0;
	padding: 0;
	font-family: 'Inter', sans-serif;
	background-color: #f7f7f7;
}

.nav-ss {
	display: flex;
	justify-content: center;
	width: 100px;
}

#navbar {
	background-color: #1e1e1e;
	color: #fff;
	padding: 12px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 2px solid #333;
}

#navbar button {
	font-family: 'Inter';
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 16px;
}

#fileMenuButton,
#docsButton {
	background-color: transparent;
}

#navbar .menu {
	position: relative;
}

.dropdown {
	display: none;
	position: absolute;
	top: 40px;
	left: 0;
	background: #2e2e2e;
	border-radius: 10px;
	overflow: hidden;
	z-index: 1000;
	padding: 5px;
}

.dropdown button {
	display: block;
	width: 180px;
	padding: 10px 15px;
	text-align: left;
	cursor: pointer;
	font-size: 14px;
	border-radius: 12px;
	background-color: #2e2e2e;
}

.dropdown button:hover {
	background-color: #3c3c3c;
}

hr {
	border: 1px solid #3c3c3c;
}

#visualizer {
	width: 300px;
	height: 50px;
	background-color: #000;
	border-radius: 6px;
	display: flex;
}

#featuresBar {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #2c2c2c;
	padding: 10px;
	text-align: center;
  gap: 5%;
}

#featuresBar button {
	background-color: #3c3c3c;
	color: #fff;
	border: none;
	padding: 10px 18px;
	margin: 0 10px;
	cursor: pointer;
	font-size: 18px;
	border-radius: 6px;
	transition: background-color 0.2s;
}

#featuresBar button:hover {
	background-color: #555;
}

.fb-bpm {
  display: grid;
  gap: 5px;
}

#playButton.active {
	background-color: #0a0;
}

#playButton.active:hover {
	background-color: rgb(22, 122, 22);
}

#tracklistLength {
	color: #fff;
	font-size: 16px;
	margin-left: 20px;
}

#mainContent {
	display: flex;
	height: calc(100vh - 80px);
}


#patternsPanel {
	width: 30%;
	background-color: #fff;
	padding: 15px;
	border-right: 1px solid #ddd;
	overflow-y: auto;
}

#patternsPanel button {
	font-family: 'Inter';
	width: 100%;
	padding: 10px;
	margin-bottom: 15px;
	font-size: 16px;
	border: none;
	border-radius: 10px;
	background-color: #0d6efd;
	color: #fff;
	cursor: pointer;
	transition: background-color 0.2s;
}

#patternsPanel button:hover {
	background-color: #0b5ed7;
}

#patternsList {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.pattern-item {
	background-color: #fafafa;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.pattern-item:hover {
	background-color: #f0f0f0;
}

#timelinePanel {
	width: 70%;
	position: relative;
	padding: 10px;
	background-color: #fff;
	overflow-y: none;
	overflow-x: scroll;
	border-left: 1px solid #ddd;
}

#timeline {
	min-width: 10000px;
	position: relative;
	height: 700px;
	background:
		repeating-linear-gradient(to bottom, transparent, transparent calc(var(--track-height) - 1px), #e0e0e0 calc(var(--track-height) - 1px), #e0e0e0 var(--track-height)),
		repeating-linear-gradient(to right, #e0e0e0 1px, transparent 1px);
}

.timeline-marker {
	position: absolute;
	width: 1px;
	height: 100%;
	background: #ccc;
  }
  .timeline-marker-label {
	position: absolute;
	font-size: 10px;
	color: #333;
  }

.timeline-item {
	position: absolute;
	background-color: #5a9;
	color: #fff;
	padding: 5px;
	cursor: move;
	border-radius: 8px;
	user-select: none;
	height: var(--track-height);
	line-height: var(--track-height);
	transition: opacity 0.15s ease;
}

.timeline-item-resizer {
  position: absolute;
  right: 0;
  top: 0;
  width: 10px;
  height: 100%;
  padding: 5px;
  cursor: ew-resize;
  border-radius: 10px;
  background-color: rgba(0, 0, 0, 0.2);
}

#playhead {
	position: absolute;
	top: 0;
	left: 0;
	width: 2px;
	height: 100%;
	background-color: #0a0;
	pointer-events: none;
}

.modal {
	display: none;
	position: fixed;
	z-index: 2000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background-color: rgba(0, 0, 0, 0.5);
	padding: 20px;
}

.modal-content {
	background-color: #fff;
	margin: auto;
	padding: 20px;
	border-radius: 8px;
	max-width: 800px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	position: relative;
}

.modal-content h2 {
	margin-top: 0;
}

.close {
	position: absolute;
	right: 15px;
	top: 10px;
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
	color: #dc3545;
}

.close:hover {
	color: #c82333;
}

.pattern-controls {
	display: grid;
	gap: 15px;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 15px;
}

.pattern-controls label {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: #333;
}

.pattern-controls input[type="text"],
.pattern-controls input[type="range"],
.pattern-controls input[type="number"] {
	font-family: 'Inter';
	border: 1px solid #ccc;
	border-radius: 8px;
	padding: 4px;
	font-size: 14px;
}

#bpmLabel {
  color: white;
}

#bpmInput {
  font-family: 'Inter';
	border: 1px solid #ccc;
  background-color: transparent;
  color: white;
	border-radius: 8px;
	padding: 4px;
	font-size: 14px;
}

#removePatternBtn {
	font-family: 'Inter';
	background-color: #dc3545;
	color: #fff;
	border: none;
	padding: 8px 12px;
	border-radius: 10px;
	cursor: pointer;
	margin-top: 10px;
	width: 30%;
	transition: background-color 0.2s;
}

#removePatternBtn:hover {
	background-color: #c82333;
}

#pianoRollEditorBtn {
	font-family: 'Inter';
	background-color: #fff;
	border: 2px solid #ccc;
	color: black;
	padding: 6px 10px;
	border-radius: 10px;
	cursor: pointer;
	margin-top: 10px;
	margin-left: 10px;
	width: 50%;
	transition: background-color 0.2s;
}

#pianoRollEditorBtn:hover {
	background-color: #ccc;
}

#savePatternBtn,
.upload-btn,
.spr-btn {
	font-family: 'Inter';
	background-color: #0d6efd;
	color: #fff;
	border: none;
	padding: 8px 12px;
	border-radius: 10px;
	margin-top: 10px;
	cursor: pointer;
	transition: background-color 0.2s;
	width: 30%;
}

.hl-button {
	font-family: 'Inter';
	background-color: #0d6efd;
	color: #fff;
	border: none;
	padding: 10px;
	border-radius: 15px;
	margin-top: 10px;
	cursor: pointer;
	transition: background-color 0.2s;
	width: 100%;
}

.red-button {
	background-color: #dc3545;
}

i {
	margin-right: 5px;
}

#savePatternBtn:hover {
	background-color: #0b5ed7;
}

.upload-btn {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 30px;
	width: 50%;
}

.popup-container {
	display: flex;
	border: 1px solid #ddd;
	border-radius: 10px;
	overflow: hidden;
	height: 300px;
}

.popup-menu {
	width: 30%;
	background-color: #f1f1f1;
	padding: 10px;
	border-right: 1px solid #ddd;
}

.popup-menu ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.popup-menu li {
	padding: 8px 10px;
	margin-bottom: 5px;
	cursor: pointer;
	border-radius: 8px;
	transition: background-color 0.2s;
}

.popup-menu li:hover,
.popup-menu li.active {
	background-color: #e0e0e0;
}

.popup-content {
	width: 70%;
	padding: 10px;
	overflow-y: auto;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.sound-item {
	display: flex;
	justify-content: center;
	align-items: center;
	border: 1px solid #ccc;
	max-height: 60px;
	padding: 8px;
	width: 120px;
	text-align: center;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
	text-overflow: ellipsis;
}

.sound-item.selected {
	border-color: #0d6efd;
	background-color: #e7f1ff;
}

.sound-item:hover {
	background-color: #ccc;
}

.more-content {
	padding: 20px;
	text-align: center;
}

.more-content p {
	margin: 0 0 10px;
	font-size: 16px;
}

.more-content a {
	color: #0d6efd;
	text-decoration: none;
	font-weight: 600;
}

.more-content a:hover {
	text-decoration: underline;
}

.error-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 2000;
}

.error-content {
	background: #fff;
	width: 300px;
	padding: 40px;
	border-radius: 20px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	text-align: center;
}

.error-content h2 {
	margin-top: 0;
	color: #dc3545;
}

.close-error {
	position: absolute;
	right: 15px;
	top: 10px;
	font-size: 20px;
	font-weight: bold;
	cursor: pointer;
	color: #dc3545;
}

.close-error:hover {
	color: #c82333;
}

#pianoRollWrapper {
	display: flex;
	flex-direction: column;
	overflow-x: auto;
	white-space: nowrap;
  }
  
  #pianoRollTimeMarkers {
  display: grid;
  grid-template-columns: repeat(80, 12.5px);
}	
  
  #pianoRollTimeMarkers div {
	width: 100px;
	text-align: center;
	border-right: 1px solid #ccc;
  }
  
  #pianoRollMain {
	display: flex;
	height: calc(100% - 30px);
  }
  
  #pianoRollNotes {
	width: 80px; /* Fixed width for note labels */
	background-color: #e9ecef;
	border-right: 1px solid #ccc;
	overflow: hidden;
	padding-top: 5px;
  }
  
  #pianoRollNotes div {
	height: 40px;
	line-height: 40px;
	text-align: right;
	padding-right: 10px;
	border-bottom: 1px solid #ccc;
	font-weight: bold;
	color: #333;
	font-size: 14px;
  }
  
  #pianoRollContainer {
	width: calc(100% - 80px);
	overflow: auto;
  }
  
  /* Override cells inside the piano roll to be much smaller */
  #pianoRollContainer .piano-cell {
	width: 12.5px;  /* 100px / 8 (so 8 cells = 1 second) */
	min-width: 12.5px;
	height: 40px;
	border: 1px solid #ccc;
	box-sizing: border-box;
	cursor: pointer;
  }

  .piano-grid {
	display: grid;
	/* 10-second duration with 8 columns per second = 80 columns */
	grid-template-columns: repeat(80, 12.5px);
	/* 24 rows (one per note row) */
	grid-template-rows: repeat(24, 40px);
	position: relative;
  }
  

  .piano-cell.active {
	background: #0d6efd;
  }