/* =============================================
   Tin Whistle Fingering Chart App - Styles
   ============================================= */

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

:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --background: #ecf0f1;
  --card-bg: #ffffff;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --border-radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
  --transition: 0.3s ease;
}

/* =============================================
   Typography & Base Styles
   ============================================= */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--background);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.4;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

/* =============================================
   Container & Layout
   ============================================= */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  background-color: var(--card-bg);
  padding: 0 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border-bottom: 3px solid var(--secondary-color);
}

header h1 {
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

header h2 {
  color: var(--text-light);
  font-size: 1.2rem;
}

main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

/* =============================================
   Controls Panel
   ============================================= */

.controls-panel {
  background-color: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-group select,
.control-group input[type='checkbox'] {
  padding: 0.75rem;
  border: 2px solid var(--background);
  border-radius: 4px;
  font-size: 0.95rem;
  color: var(--text-dark);
  background-color: var(--background);
  transition: border-color var(--transition);
  cursor: pointer;
}

.control-group select:hover,
.control-group select:focus,
.control-group input[type='checkbox']:hover,
.control-group input[type='checkbox']:focus {
  border-color: var(--secondary-color);
  outline: none;
}

.control-group input[type='checkbox'] {
  width: auto;
  padding: 0.5rem;
  accent-color: var(--secondary-color);
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  width: 20px;
  height: 20px;
  margin: 0;
}

/* =============================================
   Chart Section
   ============================================= */

.chart-section {
  background-color: var(--card-bg);
  padding: 2rem 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.chart-section h2 {
  margin-top: 0;
}

/* =============================================
   Support Section
   ============================================= */

.support-section {
  background-color: rgba(30, 127, 184, 0.1);
  color: var(--text-dark);
  padding: 2rem 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  margin: 0;
  border-left: 4px solid rgba(30, 127, 184, 0.3);
}

.support-section h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.support-section p {
  color: var(--text-dark);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.support-button {
  display: inline-block;
  transition: transform var(--transition), box-shadow var(--transition);
}

.support-button:hover {
  transform: translateY(-2px);
}

.support-button img {
  height: 60px;
  width: auto;
  display: block;
}

#chart-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
}

.fingering-chart-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  width: 100%;
  justify-content: center;
  align-items: flex-start;
}

.fingering-diagram-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  min-height: 380px;
  padding: 1.5rem;
  background-color: var(--background);
  border-radius: 8px;
  transition: background-color var(--transition), border-color var(--transition);
  flex: 0 0 auto;
}

.fingering-diagram-wrapper:hover {
  background-color: #d5dbdb;
}

.fingering-diagram-wrapper.in-scale {
  background-color: rgba(30, 127, 184, 0.15);
}

.fingering-diagram-wrapper.in-scale:hover {
  background-color: rgba(30, 127, 184, 0.25);
}

.fingering-diagram-wrapper.difficult {
  background-color: rgba(231, 76, 60, 0.15);
}

.fingering-diagram-wrapper.difficult:hover {
  background-color: rgba(231, 76, 60, 0.25);
}

.fingering-diagram-wrapper.has-alternates {
  border-right: 4px solid var(--secondary-color);
  cursor: pointer;
  transition: border-color var(--transition);
}

.fingering-diagram-wrapper.has-alternates:hover {
  border-right-color: #2980b9;
}

.fingering-note-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.fingering-primary {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}

.fingering-disclosure-btn {
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-top: 0.5rem;
}

.fingering-disclosure-btn:hover {
  background-color: #2980b9;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.fingering-disclosure-btn:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.fingering-alternates {
  display: none;
  flex-direction: row;
  gap: 0.75rem;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-start;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
}

@keyframes expandAlternates {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

.fingering-diagram-wrapper.expanded .fingering-alternates {
  display: flex;
  animation: expandAlternates 0.3s ease-out forwards;
}

.fingering-alternates[hidden] {
  display: none;
}

.fingering-alternate-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  padding: 0.5rem;
  background-color: var(--card-bg);
  border-radius: 6px;
  border: 1px solid #ddd;
  flex: 0 0 auto;
}

.fingering-diagram {
  width: 100%;
  height: 100%;
  max-width: 200px;
  max-height: 400px;
}

.fingering-diagram-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}

.interval-position-label {
  font-size: 14px;
  color: #555;
  font-weight: 500;
  text-align: center;
  min-height: 1.2em;
  margin-top: 1.5rem;
}

.octave-indicator {
  font-size: 28px;
  color: #000;
  font-weight: bold;
  text-align: center;
  letter-spacing: 0.3em;
  line-height: 1;
  margin: 0 0 0 0.5rem;
  padding: 0;
  width: 100%;
}

.chord-position-label {
  font-size: 14px;
  color: #555;
  font-weight: 500;
  text-align: center;
}

.note-label {
  fill: var(--primary-color);
}

.hole {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.hole:hover {
  opacity: 0.8;
}

.hole-label {
  fill: var(--text-light);
  font-size: 12px;
}

/* =============================================
   Progression Section
   ============================================= */

.progression-section {
  background-color: var(--card-bg);
  padding: 2rem 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.progression-section h2 {
  margin-top: 0;
}

.progression-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
}

.progression-controls .control-group {
  flex: 1;
  min-width: 200px;
}

#progression-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.arpeggio-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: flex-start;
  align-items: flex-start;
}

.arpeggio-section {
  background-color: var(--background);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--secondary-color);
}

.arpeggio-title {
  margin-top: 0;
  color: var(--secondary-color);
  font-size: 1.1rem;
}

.arpeggio-roman {
  color: #000;
  font-weight: bold;
}

.arpeggio-dot {
  color: #000;
  margin: 0 0.25rem;
}

.arpeggio-chord-name {
  color: var(--secondary-color);
}

.arpeggio-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-start;
  align-items: flex-start;
}

.mini-diagram {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 290px;
  padding: 1rem;
  background-color: var(--card-bg);
  border-radius: 6px;
  border: 1px solid var(--background);
  transition: background-color var(--transition);
}

.mini-diagram.in-scale {
  background-color: rgba(30, 127, 184, 0.15);
}

/* =============================================
   Responsive Design
   ============================================= */

@media (max-width: 768px) {
  .legend-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .container {
    padding: 1rem;
  }

  header {
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .controls-panel {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .chart-section,
  .progression-section {
    padding: 1.5rem 1rem;
  }

  #chart-container {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
  }

  .fingering-diagram-wrapper {
    min-height: 280px;
    padding: 0.75rem;
  }

  .arpeggio-container {
    grid-template-columns: 1fr;
  }

  .arpeggio-charts {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
  }

  .mini-diagram {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  .legend-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .container {
    padding: 0.75rem;
  }

  header {
    padding: 1rem 0.75rem;
    margin-bottom: 1rem;
  }

  h1 {
    font-size: 1.25rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  h4 {
    font-size: 0.95rem;
  }

  .controls-panel {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .chart-section,
  .progression-section {
    padding: 1rem 0.75rem;
  }

  #chart-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .fingering-diagram-wrapper {
    min-height: 240px;
    padding: 0.5rem;
  }

  .arpeggio-charts {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .mini-diagram {
    min-height: 180px;
  }

  .note-label {
    font-size: 14px;
  }

  .hole-label {
    font-size: 10px;
  }
}

/* =============================================
   Utility Classes
   ============================================= */

.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

/* =============================================
   Animations
   ============================================= */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fingering-diagram {
  animation: fadeIn 0.4s ease-out;
}

.arpeggio-section {
  animation: fadeIn 0.4s ease-out;
}

/* =============================================
   Navigation Row & Tips Panel
   ============================================= */

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background-color: none;
}

.nav-link {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.nav-link:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

.tips-details {
  cursor: pointer;
}

.tips-summary {
  color: var(--secondary-color);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: background-color var(--transition), color var(--transition);
  user-select: none;
}

.tips-summary:hover {
  background-color: rgba(52, 152, 219, 0.1);
}

.tips-panel-wrapper {
  display: none;
  margin-top: 1rem;
}

.tips-content {
  background-color: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--secondary-color);
  animation: fadeIn 0.3s ease-out;
}

.tips-content h3 {
  color: var(--primary-color);
  margin-bottom: 0rem;
  margin-top: 1rem;
  font-size: 1.25rem;
}

.tips-section {
  margin-bottom: 1.5rem;
}

.tips-section:last-child {
  margin-bottom: 0;
}

.tips-section h4 {
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.tips-section p {
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.tips-section ul {
  margin-left: 1.5rem;
  color: var(--text-dark);
}

.tips-section li {
  margin-bottom: 0.3rem;
}

/* =============================================
   Legend Grid
   ============================================= */

.legend-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
}

.legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.legend-svg {
  width: 60px;
  height: 60px;
}

.hole-closed {
  fill: #2c3e50;
  stroke: #2c3e50;
  stroke-width: 2;
}

.hole-open {
  fill: none;
  stroke: #2c3e50;
  stroke-width: 2;
}

.hole-half {
  fill: #2c3e50;
  stroke: #2c3e50;
  stroke-width: 2;
  opacity: 0.5;
}

.scale-indicator {
  background-color: rgba(30, 127, 184, 0.15);
  color: var(--text-dark);
  padding: 1rem;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  text-align: center;
  border: 2px solid rgba(30, 127, 184, 0.3);
}

.non-scale-indicator {
  background-color: var(--background);
  color: var(--text-dark);
  padding: 1rem;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  text-align: center;
  border: 2px solid var(--text-light);
}

.difficult-indicator {
  background-color: rgba(231, 76, 60, 0.15);
  color: var(--text-dark);
  padding: 1rem;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  text-align: center;
  border: 2px solid rgba(231, 76, 60, 0.3);
}

/* =============================================
   About the Author Section
   ============================================= */

.about-author-section {
  background-color: var(--card-bg);
  padding: 2rem 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-top: 3rem;
}

.about-author-container {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}

.about-author-image {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.author-photo {
  width: 180px;
  height: 180px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--secondary-color);
}

.about-author-content {
  display: flex;
  flex-direction: column;

}

.about-author-content h2 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.author-bio {
  color: var(--text-dark);
  font-size: 1.2rem;
  line-height: 1.7;
  margin-bottom: 0;
  flex-grow: 1;
}

.author-credentials {
  color: var(--text-light);
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .about-author-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 100%;
  }

  .author-photo {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .about-author-content h2 {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .about-author-section {
    padding: 1.5rem 0.75rem;
  }

  .about-author-container {
    gap: 1rem;
  }

  .author-photo {
    width: 120px;
    height: 120px;
  }

  .about-author-content h2 {
    font-size: 1.25rem;
  }

  .author-bio,
  .author-credentials {
    font-size: 0.9rem;
  }
}
