/* Circle of Fifths Styles */

.circle-of-fifths-page {
    min-height: 100vh;
    padding: 1rem;
}

.circle-container {
    position: relative;
    width: 100%;
    max-width: 600px; /* Increased from 500px for larger displays */
    aspect-ratio: 1 / 1; /* Maintain perfect square aspect ratio */
    margin: 0 auto;
    background: var(--bg);
    border-radius: 50%;
    overflow: hidden;
}

.circle-svg {
    width: 100%;
    height: 100%;
    max-width: 600px; /* Increased from 500px */
    max-height: 600px; /* Increased from 500px */
}

/* Key segment styling with improved mouse interaction */
.key-node {
    cursor: pointer;
    /* Ensure proper pointer events */
    pointer-events: all;
}


.key-node.selected circle {
    stroke: #ffd700;
    stroke-width: 3;
}

/* Ensure path elements have proper pointer events */
.major-segment,
.minor-segment {
    pointer-events: all;
    /* Prevent flickering by ensuring consistent event handling */
    fill-rule: evenodd;
}

/* Text styling - explicitly disable pointer events */
.key-label,
.accidentals,
.minor-key-label,
.minor-accidentals {
    pointer-events: none !important;
    user-select: none !important;
}

.key-label {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px; /* Increased from 16px for better readability */
    font-weight: 700;
    fill: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Enharmonic equivalent styling for key labels */
.key-label:has-text("/") {
    font-size: 16px; /* Slightly smaller when showing enharmonic equivalents */
}

.accidentals {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px; /* Increased from 10px */
    font-weight: 500;
    fill: white;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px; /* Add spacing between symbols for readability */
}

/* Center circle styling - disable pointer events */
.center-circle-svg,
.center-key,
.center-type,
.center-default {
    pointer-events: none !important;
    user-select: none !important;
}

.center-circle-svg {
    fill: var(--card);
    stroke: var(--brand1);
    stroke-width: 3;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.center-key {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 26px; /* Increased from 22px */
    font-weight: 700;
    fill: var(--text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-anchor: middle;
    dominant-baseline: central;
}

/* Smaller center key text when displaying enharmonic equivalents */
.center-key.has-enharmonic {
    font-size: 22px;
}

.center-type {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px; /* Increased from 13px */
    font-weight: 500;
    fill: var(--muted);
    text-anchor: middle;
    dominant-baseline: central;
}

.center-default {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px; /* Increased from 16px */
    font-weight: 500;
    fill: var(--muted);
    text-anchor: middle;
    dominant-baseline: central;
}

/* Segment styling for major and minor keys */
.major-segment {
    fill: var(--brand1); /* Use brand orange for major keys */
    stroke: white;
    stroke-width: 2; /* Slightly thinner to create better gaps */
    transition: all 0.2s ease;
}

.major-segment:hover {
    fill: var(--brand2); /* Slightly different shade on hover */
    stroke-width: 2.5; /* Slightly thicker on hover */
}

.major-segment.selected {
    fill: var(--brand2);
    stroke: #ffd700;
    stroke-width: 4; /* Thicker border for selected */
}

.minor-segment {
    fill: #ff9a7a; /* Lighter orange for minor keys */
    stroke: white;
    stroke-width: 2; /* Slightly thinner to create better gaps */
    transition: all 0.2s ease;
}

.minor-segment:hover {
    fill: #ffaa8a;
    stroke-width: 2.5; /* Slightly thicker on hover */
}

.minor-segment.selected {
    fill: #ffba9a;
    stroke: #ffd700;
    stroke-width: 4; /* Thicker border for selected */
}

/* Minor key text styling */
.minor-key-label {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px; /* Increased from 14px */
    font-weight: 600;
    fill: #7a2e0b; /* Dark orange for better contrast on light background */
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

/* Enharmonic equivalent styling for minor key labels */
.minor-key-label:has-text("/") {
    font-size: 14px; /* Slightly smaller when showing enharmonic equivalents */
}

.minor-accidentals {
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px; /* Increased from 9px */
    font-weight: 500;
    fill: #7a2e0b;
    opacity: 0.8;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
    letter-spacing: 0.5px; /* Add spacing between symbols for readability */
}

/* Ensure center group doesn't interfere with key selection */
.center-group {
    pointer-events: none !important;
}

/* Enharmonic equivalent styling in key info */
.enharmonic-info {
    background: rgba(255, 127, 80, 0.1);
    border: 1px solid rgba(255, 127, 80, 0.2);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    display: inline-block;
}

.enharmonic-info small {
    color: var(--text);
    font-weight: 500;
}

/* Audio disabled state styling */
.audio-disabled {
    position: relative;
}

.audio-disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: inherit;
    z-index: 1;
    pointer-events: none;
}


/* Audio disabled button styling */
.btn-audio-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.btn-audio-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}


/* Audio disabled progression buttons */
.progression-item.audio-disabled .btn {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.progression-item.audio-disabled .btn:hover {
    transform: none !important;
    box-shadow: none !important;
}

    .progression-item.audio-disabled .btn::before {
        content: '🔇';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 0.8rem;
        z-index: 1;
    }

.progression-item.audio-disabled .btn i {
    opacity: 0.3;
}

/* Audio toggle button enhanced styling */
.audio-toggle-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.audio-toggle-btn.audio-on {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
    color: white;
}

.audio-toggle-btn.audio-on:hover {
    background: linear-gradient(135deg, #1e7e34, #1c9c7a);
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.audio-toggle-btn.audio-off {
    background: linear-gradient(135deg, #6c757d, #868e96);
    border-color: #6c757d;
    color: white;
}

.audio-toggle-btn.audio-off:hover {
    background: linear-gradient(135deg, #545b62, #6f7881);
    border-color: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.audio-toggle-btn.audio-off::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 2px;
    height: 120%;
    background: rgba(255, 255, 255, 0.3);
    z-index: 1;
}
/* Disabled state for play key button */
.play-key-btn.audio-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

.play-key-btn.audio-disabled:hover {
    transform: none !important;
    box-shadow: none !important;
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
}


/* Tooltip for disabled audio elements */
.audio-disabled-tooltip {
    position: relative;
}

.audio-disabled-tooltip:hover::after {
    content: 'Audio is disabled. Enable audio to hear sound.';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.audio-disabled-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

.key-info {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0.5rem;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.key-info h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progression-chords {
    margin: 0.5rem 0;
}

.progression-chords .badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Selected key emphasis */
.selected-key-emphasis {
    background: linear-gradient(135deg, var(--brand1), var(--brand2)) !important;
    color: white !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 1rem !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    display: inline-block !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Progression popularity indicator */
.progression-popularity {
    margin-bottom: 0.5rem;
    min-width: 100px;
}

.popularity-indicator {
    text-align: center;
}

.popularity-indicator .progress {
    border-radius: 2px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.25rem 0;
}

.popularity-indicator .progress-bar {
    transition: width 0.3s ease;
    border-radius: 2px;
}

.popularity-indicator small {
    font-size: 0.7rem;
    font-weight: 500;
}

.popularity-indicator small:first-child {
    opacity: 0.8;
}

.popularity-indicator small:last-child {
    font-weight: 600;
}

/* Responsive adjustments for larger screens */
@media (min-width: 1200px) {
    .circle-container {
        max-width: 700px; /* Even larger on xl screens */
    }
    
    .circle-svg {
        max-width: 700px;
        max-height: 700px;
    }
    
    .key-label {
        font-size: 20px; /* Larger text on big screens */
    }
    
    .key-label:has-text("/") {
        font-size: 18px; /* Slightly smaller for enharmonic equivalents */
    }
    
    .minor-key-label {
        font-size: 18px;
    }
    
    .minor-key-label:has-text("/") {
        font-size: 16px; /* Slightly smaller for enharmonic equivalents */
    }
    
    .accidentals {
        font-size: 14px;
    }
    
    .minor-accidentals {
        font-size: 13px;
    }
    
    .center-key {
        font-size: 30px;
    }
    
    .center-key.has-enharmonic {
        font-size: 26px;
    }
    
    .center-type {
        font-size: 17px;
    }
    
    .center-default {
        font-size: 20px;
    }
}

/* Responsive adjustments for medium tablets */
@media (max-width: 992px) and (min-width: 769px) {
    .circle-container {
        max-width: 550px;
    }
    
    .circle-svg {
        max-width: 550px;
        max-height: 550px;
    }
    
    .key-label {
        font-size: 17px;
    }
    
    .key-label:has-text("/") {
        font-size: 15px;
    }
    
    .minor-key-label {
        font-size: 15px;
    }
    
    .minor-key-label:has-text("/") {
        font-size: 13px;
    }
    
    .accidentals {
        font-size: 11px;
    }
    
    .minor-accidentals {
        font-size: 10px;
    }
    
    .center-key {
        font-size: 24px;
    }
    
    .center-key.has-enharmonic {
        font-size: 20px;
    }
    
    .center-type {
        font-size: 14px;
    }
}

/* Responsive adjustments for tablets */
@media (max-width: 768px) {
    .circle-container {
        max-width: 450px; /* Increased from 400px */
    }
    
    .circle-svg {
        max-width: 450px;
        max-height: 450px;
    }
    
    .key-label {
        font-size: 16px; /* Increased from 14px */
    }
    
    .key-label:has-text("/") {
        font-size: 14px;
    }
    
    .minor-key-label {
        font-size: 14px; /* Increased from 12px */
    }
    
    .minor-key-label:has-text("/") {
        font-size: 12px;
    }
    
    .accidentals {
        font-size: 10px; /* Increased from 9px */
    }
    
    .minor-accidentals {
        font-size: 9px; /* Increased from 8px */
    }
    
    .center-key {
        font-size: 22px; /* Increased from 20px */
    }
    
    .center-key.has-enharmonic {
        font-size: 18px;
    }
    
    .center-type {
        font-size: 13px; /* Increased from 12px */
    }

    .circle-of-fifths-page.audio-disabled .circle-container::after {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        bottom: -40px; /* Adjusted for larger circle */
    }
}

/* Responsive adjustments for mobile phones */
@media (max-width: 576px) {
    .circle-container {
        max-width: 380px; /* Increased from 350px */
    }
    
    .circle-svg {
        max-width: 380px;
        max-height: 380px;
    }
    
    .key-label {
        font-size: 14px; /* Increased from 12px */
    }
    
    .key-label:has-text("/") {
        font-size: 12px;
    }
    
    .minor-key-label {
        font-size: 12px; /* Increased from 10px */
    }
    
    .minor-key-label:has-text("/") {
        font-size: 10px;
    }
    
    .accidentals {
        font-size: 9px; /* Increased from 8px */
    }
    
    .minor-accidentals {
        font-size: 8px; /* Increased from 7px */
    }
    
    .center-key {
        font-size: 20px; /* Increased from 18px */
    }
    
    .center-key.has-enharmonic {
        font-size: 16px;
    }
    
    .center-type {
        font-size: 12px; /* Increased from 10px */
    }
    
    .center-default {
        font-size: 14px;
    }

}

/* Extra small mobile phones */
@media (max-width: 400px) {
    .circle-container {
        max-width: 340px; /* Optimized for very small screens */
    }
    
    .circle-svg {
        max-width: 340px;
        max-height: 340px;
    }
    
    .key-label {
        font-size: 23px;
    }
    
    .key-label:has-text("/") {
        font-size: 21px;
    }
    
    .minor-key-label {
        font-size: 21px;
    }
    
    .minor-key-label:has-text("/") {
        font-size: 19px;
    }
    
    .accidentals {
        font-size: 12px;
    }
    
    .minor-accidentals {
        font-size: 9px;
    }
    
    .center-key {
        font-size: 18px;
    }
    
    .center-key.has-enharmonic {
        font-size: 14px;
    }
    
    .center-type {
        font-size: 11px;
    }
    
    .center-default {
        font-size: 13px;
    }
}

/* Loading states */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Card styling improvements */
.card {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
}

.card-header {
    background: rgba(102, 126, 234, 0.1);
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.list-group-item {
    border-left: none;
    border-right: none;
}

.list-group-item:first-child {
    border-top: none;
}

.list-group-item:last-child {
    border-bottom: none;
}

/* Button styling */
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-info:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Badge styling */
.badge {
    font-weight: 500;
}

.badge.bg-light {
    border: 1px solid #dee2e6;
}

/* Notation preference badge */
.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Audio controls */
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Practice tools section */
.d-grid .btn {
    text-align: left;
    display: flex;
    align-items: center;
}

.d-grid .btn i {
    margin-right: 0.5rem;
}

/* Progress indication for audio */
.audio-playing {
    position: relative;
    overflow: hidden;
}

.audio-playing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: audioProgress 2s infinite;
}

@keyframes audioProgress {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}