/**
 * Guitar Scale Viewer - Mobile-First CSS
 * Version: 2.1.0
 * Optimized for all devices
 */

/* ===========================================
   RESET & BASE
   =========================================== */
.gsp-scale-viewer * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===========================================
   MAIN CONTAINER
   =========================================== */
.gsp-scale-viewer {
    width: 100%;
    max-width: 100%;
    margin: 40px auto;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ===========================================
   HEADER
   =========================================== */
.gsp-viewer-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 35px 25px;
    text-align: center;
    border-bottom: 3px solid rgba(255, 255, 255, 0.15);
}

.gsp-viewer-header h2 {
    margin: 0 0 12px 0;
    color: #ffffff;
    font-size: 32px;
    font-weight: 800;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.4);
    letter-spacing: 1px;
}

.gsp-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 17px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* ===========================================
   CONTROLS
   =========================================== */
.gsp-controls {
    padding: 30px 25px;
    background: rgba(0, 0, 0, 0.25);
}

.gsp-control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.gsp-control-group {
    display: flex;
    flex-direction: column;
}

.gsp-control-group label {
    display: block;
    color: #ffffff;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.gsp-select {
    width: 100%;
    padding: 15px 45px 15px 18px;
    background: #16213e;
    border: 2px solid #0f3460;
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23fff' d='M11.293 4.293L7 8.586 2.707 4.293A1 1 0 001.293 5.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 14px;
}

.gsp-select:hover {
    border-color: #667eea;
    background-color: #1a2848;
    transform: translateY(-1px);
}

.gsp-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.25);
}

.gsp-select option {
    background: #16213e;
    color: #ffffff;
    padding: 10px;
}

/* ===========================================
   LEGEND
   =========================================== */
.gsp-legend {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    padding: 22px 25px;
    background: rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
}

.gsp-legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.gsp-legend-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-block;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.gsp-legend-root {
    background: radial-gradient(circle at 30% 30%, #ef4444, #dc2626);
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.7);
}

.gsp-legend-note {
    background: radial-gradient(circle at 30% 30%, #10b981, #059669);
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.7);
}

/* ===========================================
   FRETBOARD WRAPPER
   =========================================== */
.gsp-fretboard-wrapper {
    padding: 35px 25px;
    background: #1a1a2e;
}

.gsp-fretboard-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #2a1810;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
    min-height: 300px;
}

.gsp-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

#gsp-fretboard-svg {
    width: 100%;
    height: auto;
    display: block;
}

.gsp-dots-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===========================================
   DOTS (NOTES)
   =========================================== */
.gsp-dot {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
    cursor: pointer;
    font-size: 14px;
    letter-spacing: 0.5px;
    transform: translate(-50%, -50%);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: Arial, sans-serif;
}

/* Root Note */
.gsp-dot.root {
    width: 44px;
    height: 44px;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 
        0 0 25px rgba(239, 68, 68, 0.7),
        0 5px 15px rgba(0, 0, 0, 0.5),
        inset 0 2px 5px rgba(255, 255, 255, 0.35);
    border: 2.5px solid rgba(255, 255, 255, 0.45);
    animation: gspPulse 2s ease-in-out infinite;
}

/* Regular Notes */
.gsp-dot.regular {
    width: 34px;
    height: 34px;
    font-size: 13px;
    box-shadow: 
        0 0 18px rgba(16, 185, 129, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 4px rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.35);
}

/* Pulse Animation */
@keyframes gspPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 
            0 0 25px rgba(239, 68, 68, 0.7),
            0 5px 15px rgba(0, 0, 0, 0.5),
            inset 0 2px 5px rgba(255, 255, 255, 0.35);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.08);
        box-shadow: 
            0 0 35px rgba(239, 68, 68, 0.9),
            0 7px 20px rgba(0, 0, 0, 0.6),
            inset 0 2px 5px rgba(255, 255, 255, 0.45);
    }
}

/* Active/Touch State */
.gsp-dot:active {
    transform: translate(-50%, -50%) scale(0.88);
}

/* Hover Effects (Desktop) */
@media (hover: hover) {
    .gsp-dot:hover {
        transform: translate(-50%, -50%) scale(1.35);
        z-index: 100;
    }
    
    .gsp-dot.root:hover {
        animation: none;
        box-shadow: 
            0 0 40px rgba(239, 68, 68, 1),
            0 10px 25px rgba(0, 0, 0, 0.6),
            inset 0 2px 7px rgba(255, 255, 255, 0.5);
    }
    
    .gsp-dot.regular:hover {
        box-shadow: 
            0 0 30px rgba(16, 185, 129, 0.9),
            0 7px 18px rgba(0, 0, 0, 0.5),
            inset 0 2px 5px rgba(255, 255, 255, 0.35);
    }
}

/* Tooltip */
.gsp-dot::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.96), rgba(20, 20, 40, 0.96));
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

@media (hover: hover) {
    .gsp-dot:hover::after {
        opacity: 1;
        transform: translateX(-50%) translateY(-6px);
    }
}

.gsp-dot:active::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
}

/* ===========================================
   NOTES DISPLAY
   =========================================== */
.gsp-notes-display {
    padding: 28px 25px;
    color: #ffffff;
    font-size: 18px;
    text-align: center;
    background: rgba(0, 0, 0, 0.25);
    border-top: 2px solid rgba(255, 255, 255, 0.12);
}

.gsp-notes-display strong {
    color: #ffffff;
    font-weight: 700;
}

#gsp-notes-list {
    color: #667eea;
    font-weight: 800;
    letter-spacing: 2.5px;
    display: inline-block;
    margin-left: 12px;
    font-size: 19px;
}

/* ===========================================
   INFO BOX
   =========================================== */
.gsp-info-box {
    padding: 25px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.18));
    border-top: 2px solid rgba(102, 126, 234, 0.35);
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.7;
}

.gsp-info-box p {
    margin: 0;
}

.gsp-info-box strong {
    color: #ffffff;
    font-weight: 700;
}

/* ===========================================
   RESPONSIVE - TABLET
   =========================================== */
@media (max-width: 900px) {
    .gsp-viewer-header {
        padding: 30px 20px;
    }
    
    .gsp-viewer-header h2 {
        font-size: 28px;
    }
    
    .gsp-subtitle {
        font-size: 15px;
    }
    
    .gsp-control-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

/* ===========================================
   RESPONSIVE - MOBILE
   =========================================== */
@media (max-width: 768px) {
    .gsp-scale-viewer {
        margin: 20px auto;
        border-radius: 16px;
    }
    
    .gsp-viewer-header {
        padding: 25px 18px;
    }
    
    .gsp-viewer-header h2 {
        font-size: 24px;
    }
    
    .gsp-subtitle {
        font-size: 14px;
    }
    
    .gsp-controls {
        padding: 25px 18px;
    }
    
    .gsp-control-row {
        gap: 16px;
    }
    
    .gsp-control-group label {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .gsp-select {
        padding: 13px 40px 13px 15px;
        font-size: 15px;
    }
    
    .gsp-fretboard-wrapper {
        padding: 25px 18px;
    }
    
    .gsp-dot.root {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .gsp-dot.regular {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .gsp-legend {
        gap: 22px;
        padding: 18px;
    }
    
    .gsp-legend-item {
        font-size: 15px;
    }
    
    .gsp-notes-display {
        padding: 22px 18px;
        font-size: 16px;
    }
    
    #gsp-notes-list {
        font-size: 17px;
        letter-spacing: 2px;
    }
    
    .gsp-info-box {
        padding: 18px;
        font-size: 14px;
    }
}

/* ===========================================
   RESPONSIVE - SMALL MOBILE
   =========================================== */
@media (max-width: 480px) {
    .gsp-scale-viewer {
        margin: 15px 10px;
        border-radius: 14px;
    }
    
    .gsp-viewer-header {
        padding: 20px 15px;
    }
    
    .gsp-viewer-header h2 {
        font-size: 20px;
    }
    
    .gsp-subtitle {
        font-size: 13px;
    }
    
    .gsp-controls {
        padding: 20px 15px;
    }
    
    .gsp-control-row {
        gap: 14px;
    }
    
    .gsp-control-group label {
        font-size: 14px;
    }
    
    .gsp-select {
        padding: 12px 38px 12px 13px;
        font-size: 14px;
    }
    
    .gsp-fretboard-wrapper {
        padding: 20px 12px;
    }
    
    .gsp-dot.root {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
    
    .gsp-dot.regular {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    
    .gsp-legend {
        flex-direction: column;
        gap: 14px;
        padding: 15px;
    }
    
    .gsp-legend-item {
        font-size: 14px;
    }
    
    .gsp-notes-display {
        padding: 18px 15px;
        font-size: 15px;
    }
    
    #gsp-notes-list {
        display: block;
        margin: 12px 0 0 0;
        font-size: 16px;
        letter-spacing: 1.5px;
    }
    
    .gsp-info-box {
        padding: 15px;
        font-size: 13px;
    }
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */
.gsp-mobile-tooltip {
    position: fixed !important;
    z-index: 99999 !important;
    pointer-events: none !important;
}