/* SPDX-License-Identifier: GPL-3.0-only */

/*
  File: style.css
  Project: TonicTwo (Step Sequencer)
  Description:
    Two-column UI layout:
      - Left sidebar with panels for SETTINGS and RECORD YOUR MELODY
      - Right main area with the sequencer grid
    Includes modern controls styling and clear section headings.

  Author: Arantxa Garayzar Cristerna
  Updated: 2026-02-20
*/

/* ============================================================================
   1) Base / Theme
   ========================================================================== */
:root{
  --bg: #0b0f17;
  --panel: rgba(255,255,255,.06);
  --panel-2: rgba(0,0,0,.18);
  --text: #e6eaf2;
  --muted: #a8b3cf;
  --border: rgba(255,255,255,.12);
  --shadow: 0 18px 45px rgba(0,0,0,.45);
  --accent: #7c5cff;
  --accent-2: #30d5c8;
}

*{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  background:
    radial-gradient(1000px 500px at 20% 0%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(900px 500px at 90% 20%, rgba(48,213,200,.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  line-height: 1.35;
}

/* ============================================================================
   2) App Shell Layout (Sidebar + Main)
   ========================================================================== */
.app{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px;
}

.sidebar{
  position: sticky;
  top: 18px;
  align-self: start;
  height: calc(100vh - 36px);
  overflow: auto;

  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
}

.main{
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
}

.main-header{
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.main-title{
  margin: 0;
  letter-spacing: .08em;
  font-weight: 900;
}

.main-subtitle{
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ============================================================================
   3) Brand
   ========================================================================== */
.brand{
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.brand-title{
  font-weight: 900;
  letter-spacing: .10em;
  font-size: 1.05rem;
}

.brand-subtitle{
  color: var(--muted);
  font-weight: 650;
  margin-top: 6px;
}

/* ============================================================================
   4) Panels (Sidebar sections)
   ========================================================================== */
.panel{
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: var(--panel-2);
}

.panel-title{
  margin: 0 0 12px;
  color: rgba(230,234,242,.92);
  letter-spacing: .12em;
  font-size: 0.85rem;
  font-weight: 900;
}

.hint{
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ============================================================================
   5) Controls
   ========================================================================== */
.field{
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.label{
  color: var(--muted);
  font-weight: 750;
  font-size: 0.92rem;
}

.range-row{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.value{
  display: inline-block;
  min-width: 2ch;
  text-align: right;
  color: var(--text);
  font-weight: 900;
  opacity: .9;
}

/* Inputs */
input[type="number"],
input[type="text"]{
  width: 100%;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  outline: none;
}

input[type="number"]:focus-visible,
input[type="text"]:focus-visible{
  border-color: rgba(124,92,255,.55);
  box-shadow: 0 0 0 4px rgba(124,92,255,.18);
}

input[type="range"]{
  width: 100%;
}

/* Buttons */
.buttons-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button{
  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 10px 25px rgba(0,0,0,.28);
  transition: transform .12s ease, border-color .12s ease;
}

button:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.22);
}

button:active{
  transform: translateY(0px);
}

#record{ border-color: rgba(124,92,255,.35); }
#stoprecord{ border-color: rgba(48,213,200,.30); }
#clear{ border-color: rgba(255,255,255,.18); }

/* Recording indicator */
.rec-row{
  margin-bottom: 10px;
}

.rec-indicator{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(230,234,242,.75);
  font-weight: 900;
  letter-spacing: .04em;
  user-select: none;
}

.rec-indicator.is-on{
  border-color: rgba(255, 70, 70, .45);
  background: rgba(255, 70, 70, .12);
  color: rgba(255, 210, 210, .95);
  box-shadow: 0 0 0 4px rgba(255, 70, 70, .12);
}

.rec-indicator.is-on::first-letter{
  animation: recPulse 1s infinite ease-in-out;
}

@keyframes recPulse{
  0%, 100%{ opacity: .35; }
  50%{ opacity: 1; }
}

/* Audio */
audio{
  width: 100%;
  display: block;
  margin-top: 10px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.35));
}

/* ============================================================================
   6) Sequencer Board (Main)
   ========================================================================== */
#board{
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
}

#board > div{
  display: grid;
  gap: 10px;
}

#board > div > div{
  display: grid;
  grid-template-columns: 34px repeat(8, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);

  font-weight: 900;
  color: rgba(230,234,242,.92);
}

#board > div > div::first-letter{
  color: var(--muted);
}

#board input[type="checkbox"]{
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.05);
  cursor: pointer;
  transition: transform .08s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

#board input[type="checkbox"]:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.28);
}

#board input[type="checkbox"]:checked{
  background: linear-gradient(180deg, rgba(124,92,255,.95), rgba(124,92,255,.55));
  border-color: rgba(124,92,255,.75);
  box-shadow: 0 0 0 4px rgba(124,92,255,.18);
}

/* Optional subtle row accents by note id */
#C{ box-shadow: inset 4px 0 0 rgba(124,92,255,.55); }
#D{ box-shadow: inset 4px 0 0 rgba(48,213,200,.40); }
#E{ box-shadow: inset 4px 0 0 rgba(255,192,72,.40); }
#F{ box-shadow: inset 4px 0 0 rgba(255,102,153,.40); }
#G{ box-shadow: inset 4px 0 0 rgba(120,200,255,.40); }
#A{ box-shadow: inset 4px 0 0 rgba(160,255,160,.32); }
#B{ box-shadow: inset 4px 0 0 rgba(255,140,100,.35); }

/* ============================================================================
   7) Responsive
   ========================================================================== */
@media (max-width: 980px){
  .app{
    grid-template-columns: 1fr;
  }

  .sidebar{
    position: static;
    height: auto;
  }
}

@media (max-width: 520px){
  #board > div > div{
    grid-template-columns: 24px repeat(8, 1fr);
    gap: 6px;
  }

  #board input[type="checkbox"]{
    width: 20px;
    height: 20px;
    border-radius: 7px;
  }

  .buttons-row{
    grid-template-columns: 1fr;
  }
}
