/* Copyright (c) 2026 Nate Norrish. All rights reserved.
   This software is proprietary and confidential. Unauthorized copying,
   modification, distribution, or use of this software is strictly prohibited. */

/* apps/chiptune/client/App.css */
*
{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body
{
	background: #1a1a2e;
	color: #e0e0e0;
	font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 13px;
	overflow: hidden;
	height: 100vh;
	overscroll-behavior-x: none;
}

#app
{
	height: 100%;
	display: flex;
	flex-direction: column;
}

x-app
{
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* Toolbar */

.toolbar
{
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: #0f3460;
	border-bottom: 2px solid #1a1a2e;
	flex-shrink: 0;
}

.btn
{
	background: #16213e;
	color: #e0e0e0;
	border: 1px solid #333;
	padding: 6px 16px;
	font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 12px;
	cursor: pointer;
	border-radius: 3px;
}

.btn:hover
{
	background: #1a3a5c;
}

.btn-play
{
	background: #e94560;
	border-color: #e94560;
	color: #fff;
}

.btn-play:hover
{
	background: #d63851;
}

.btn-play.playing
{
	background: #f0a030;
	border-color: #f0a030;
}

.toolbar-sep
{
	width: 1px;
	height: 24px;
	background: #333;
	margin: 0 4px;
}

.toolbar-label
{
	color: #888;
	font-size: 11px;
	text-transform: uppercase;
}

.btn-connect.connected
{
	background: #1a6b3a;
	border-color: #1a6b3a;
	color: #fff;
}

.toolbar-session
{
	width: 80px;
}

.toolbar-input
{
	width: 60px;
	background: #16213e;
	color: #e0e0e0;
	border: 1px solid #333;
	padding: 4px 8px;
	font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 12px;
	border-radius: 3px;
	text-align: center;
}

/* Main area (instruments + grid) */

.main-area
{
	flex: 1;
	display: flex;
	overflow: hidden;
}

/* Instrument panel */

.inst-panel
{
	width: 200px;
	min-width: 200px;
	background: #12122a;
	border-right: 1px solid #222;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.inst-header
{
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 10px;
	font-size: 11px;
	color: #888;
	text-transform: uppercase;
	border-bottom: 1px solid #222;
	flex-shrink: 0;
}

.inst-add-btn
{
	padding: 2px 8px;
	font-size: 14px;
	line-height: 1;
}

.inst-list
{
	flex: 1;
	overflow-y: auto;
}

.inst-item
{
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	cursor: pointer;
	border-bottom: 1px solid #1a1a2e;
	transition: background 0.08s;
}

.inst-item:hover
{
	background: #1a2a4e;
}

.inst-item.active
{
	background: #1a3a5c;
	border-left: 3px solid #e94560;
	padding-left: 7px;
}

.inst-swatch
{
	width: 12px;
	height: 12px;
	border-radius: 2px;
	flex-shrink: 0;
}

.inst-num
{
	color: #555;
	font-size: 10px;
	width: 14px;
	text-align: center;
	flex-shrink: 0;
}

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

.inst-wave
{
	font-size: 9px;
	color: #555;
	text-transform: uppercase;
}

/* Instrument edit form */

.inst-edit
{
	padding: 8px;
}

.inst-edit-row
{
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}

.inst-edit-label
{
	width: 52px;
	min-width: 52px;
	font-size: 10px;
	color: #888;
	text-transform: uppercase;
}

.inst-edit-input
{
	flex: 1;
	background: #16213e;
	color: #e0e0e0;
	border: 1px solid #333;
	padding: 3px 6px;
	font-size: 11px;
	border-radius: 3px;
	font-family: inherit;
}

.inst-edit-input[type="color"]
{
	padding: 1px 3px;
	height: 24px;
	cursor: pointer;
}

select.inst-edit-input
{
	cursor: pointer;
}

.inst-edit-slider
{
	flex: 1;
	height: 4px;
	accent-color: #e94560;
	cursor: pointer;
}

.inst-edit-val
{
	width: 32px;
	font-size: 10px;
	color: #888;
	text-align: right;
}

.inst-edit-buttons
{
	display: flex;
	gap: 4px;
	margin-top: 10px;
}

.inst-done-btn
{
	background: #1a6b3a;
	border-color: #1a6b3a;
	color: #fff;
	flex: 1;
}

.inst-done-btn:hover
{
	background: #1e7e42;
}

.inst-del-btn
{
	background: #6b1a1a;
	border-color: #6b1a1a;
	color: #fff;
}

.inst-del-btn:hover
{
	background: #7e1e1e;
}

/* Grid */

.grid
{
	flex: 1;
	overflow: auto;
	padding: 12px;
	position: relative;
}

.grid-row
{
	display: flex;
	gap: 2px;
	margin-bottom: 2px;
}

.grid-header
{
	margin-bottom: 6px;
}

.grid-label
{
	width: 90px;
	min-width: 90px;
	padding: 0 8px;
	display: flex;
	align-items: center;
	font-size: 11px;
	color: #888;
	text-transform: uppercase;
	position: sticky;
	left: 0;
	z-index: 3;
	background: #1a1a2e;
}

.grid-step-num
{
	width: 52px;
	min-width: 52px;
	text-align: center;
	font-size: 10px;
	color: #555;
	padding: 2px 0;
}

.grid-cell
{
	width: 52px;
	min-width: 52px;
	height: 36px;
	background: #16213e;
	border: 1px solid #222;
	border-left: 3px solid #333;
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 11px;
	font-weight: bold;
	color: #556;
	transition: background 0.08s, border-color 0.08s;
	user-select: none;
	outline: none;
	position: relative;
	overflow: visible;
}

.grid-cell:hover
{
	background: #1a2a4e;
	border-color: #444;
}

.grid-cell.has-note
{
	color: #e0e0e0;
	background: #1e2a48;
}

/* Selection box overlay */
.selection-box
{
	display: none;
	position: absolute;
	border: 2px solid #e94560;
	border-radius: 4px;
	box-shadow: 0 0 8px rgba(233, 69, 96, 0.4);
	background: rgba(233, 69, 96, 0.1);
	pointer-events: none;
	z-index: 5;
}

.grid-cell.playhead
{
	background: #2a1a3e;
	border-color: #f0a030;
	box-shadow: 0 0 4px rgba(240, 160, 48, 0.3);
}

.grid-cell.playhead.has-note
{
	background: #3a2a1e;
	color: #fff;
}

/* Note blocks (overlay spanning cells) */

.note-block
{
	position: absolute;
	top: 2px;
	left: 2px;
	height: calc(100% - 4px);
	border-radius: 3px;
	display: flex;
	align-items: center;
	padding: 0 6px;
	font-size: 10px;
	font-weight: bold;
	color: rgba(255, 255, 255, 0.9);
	z-index: 2;
	cursor: grab;
	white-space: nowrap;
	overflow: hidden;
	pointer-events: auto;
}

.note-resize-handle
{
	position: absolute;
	right: 0;
	top: 0;
	width: 6px;
	height: 100%;
	cursor: ew-resize;
	border-radius: 0 3px 3px 0;
	background: rgba(255, 255, 255, 0.15);
	transition: background 0.1s;
}

.note-resize-handle:hover
{
	background: rgba(255, 255, 255, 0.35);
}

.note-block.dragging
{
	opacity: 0.8;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
	cursor: grabbing;
}

.grid-cell.spanned
{
	pointer-events: none;
	opacity: 0.4;
}

.grid-cell.spanned.playhead
{
	opacity: 0.6;
}

/* Beat grouping: every 4th cell gets extra left margin */
.grid-cell.beat-start
{
	margin-left: 6px;
}

.grid-step-num.beat-start
{
	margin-left: 6px;
}

/* Help text */

.help-bar
{
	display: flex;
	gap: 16px;
	padding: 6px 16px;
	background: #111;
	border-top: 1px solid #222;
	font-size: 10px;
	color: #555;
	flex-shrink: 0;
}

.help-bar span
{
	white-space: nowrap;
}

.help-key
{
	color: #888;
	background: #1a1a2e;
	padding: 1px 4px;
	border-radius: 2px;
	border: 1px solid #333;
	font-size: 9px;
}

/* Dialog */

x-dialog
{
	display: none;
}

.dialog-overlay
{
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dialog-box
{
	background: #12122a;
	border: 1px solid #333;
	border-radius: 6px;
	min-width: 320px;
	max-width: 480px;
	max-height: 80vh;
	overflow-y: auto;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.dialog-header
{
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-bottom: 1px solid #222;
}

.dialog-title
{
	font-size: 13px;
	font-weight: bold;
	color: #e0e0e0;
}

.dialog-close
{
	background: none;
	border: none;
	color: #888;
	font-size: 18px;
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
}

.dialog-close:hover
{
	color: #e94560;
}

.dialog-body
{
	padding: 12px 14px;
}


