/* 
  ViperHarmonics: Expert Component Library
  Fluid & High-Fidelity UI
*/

/* Buttons & Interactive */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1.125rem;
    font-weight: 500;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-ui);
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0.5rem 2rem rgba(245, 158, 11, 0.4);
}

.btn-pulse {
    animation: btnAttract 2s infinite ease-in-out;
}

@keyframes btnAttract {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(245, 158, 11, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.5rem;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius);
}

.icon-btn:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2rem);
    -webkit-backdrop-filter: blur(2rem);
    z-index: 1000;
    transition: opacity 0.5s ease;
    background: var(--bg);
}

.splash-title {
    font-size: clamp(2rem, 10vw, 4rem);
    font-weight: 600;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Control Panels */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    min-height: 1.5rem;
}

.value-display {
    color: var(--accent);
    font-family: var(--font-mono);
}

/* Fluid Accessibility Slider */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    min-height: var(--touch-target);
    margin: 0;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    margin-top: -0.625rem;
    box-shadow: 0 0 0.75rem rgba(245, 158, 11, 0.5);
    border: 3px solid var(--bg);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 0.25rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.125rem;
}

/* Stepper Component */
.stepper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    border: 1px solid var(--panel-border);
    min-height: var(--touch-target);
    overflow: hidden;
}

.stepper button {
    flex: 1;
    color: var(--text);
    padding: 0.5rem;
    font-size: 1.25rem;
    min-height: var(--touch-target);
    transition: background 0.2s;
}

.stepper button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.stepper .step-val {
    flex: 1.5;
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 3.5rem;
    height: var(--touch-target);
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0.75rem; 
    left: 0; 
    right: 0; 
    bottom: 0.75rem;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 2rem;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 1.125rem;
    width: 1.125rem;
    left: 0.25rem;
    bottom: 0.1875rem;
    background-color: var(--text);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider-toggle { background-color: var(--accent); }
input:checked + .slider-toggle:before { transform: translateX(1.8rem); }

/* Notation Workspace */
.notation-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.notation-header span {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.notation-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.notation-actions button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    min-height: 2.25rem;
    transition: all 0.2s;
}

.notation-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.notation-display {
    flex: 1;
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: clamp(1rem, 3vw, 1.25rem);
    line-height: 1.6;
    color: var(--accent);
    background: transparent;
    border: none;
    resize: none;
    outline: none;
}

/* Keyboard System */
.keyboard-svg {
    border-radius: 0.25rem;
    filter: drop-shadow(0 1rem 2rem rgba(0,0,0,0.6));
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 1;
    max-height: 40vh;
}

.keyboard-svg .white, .keyboard-svg .black {
    cursor: pointer;
    transition: fill 0.1s, transform 0.05s;
    transform-origin: top;
    stroke: #111;
    stroke-width: 1;
}

.keyboard-svg .white { fill: #fdfdfd; }
.keyboard-svg .black { fill: #1a1a1a; }

.keyboard-svg .white.active { fill: #ffe0b2; transform: scaleY(0.98); }
.keyboard-svg .black.active { fill: #e65100; transform: scaleY(0.96); }

/* Overlays & Dialogs */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1rem;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.overlay-content {
    background: #12131a;
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius);
    padding: clamp(1.5rem, 5vw, 2.5rem);
    width: 100%;
    max-width: 40rem;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 2rem 4rem rgba(0,0,0,0.5);
    border-top: 4px solid var(--accent);
}

.overlay-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem; /* Increased */
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
}

.overlay-content p {
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.overlay-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    color: var(--text-muted);
    font-size: 1.75rem;
    width: var(--touch-target);
    height: var(--touch-target);
}

.songs-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.song-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s;
}

.song-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--accent);
    transform: translateX(0.25rem);
}

.active-play {
    color: var(--accent) !important;
    border-color: var(--accent) !important;
    background: rgba(245, 158, 11, 0.1) !important;
}

/* Accessibility & Utils */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Specific UI Utilites */
.splash-subtitle {
    margin-bottom: 2rem;
    color: var(--text-muted);
}

.midi-group {
    margin-top: auto;
}

#midiInputDevices {
    display: none; /* JS will toggle visibility */
}

.shortcut-note {
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

.key-list-modern {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.key-category {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--panel-border);
}

.key-category h4 {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.key-category p {
    font-family: var(--font-mono);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature-notes p {
    margin-bottom: 1.5rem;
}

.info-body {
    margin-top: 1.5rem;
}

.info-body h4 {
    color: var(--accent);
    margin: 1.5rem 0 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-body p {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.info-footer {
    margin-top: 1.5rem;
    border-top: 1px solid var(--panel-border);
    padding-top: 1rem;
}

.info-footer a {
    color: var(--accent);
    text-decoration: none;
}

/* Shared Track UI */
.notation-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.3);
    animation: slideInBadge 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInBadge {
    from { opacity: 0; transform: translateX(-1rem); }
    to { opacity: 1; transform: translateX(0); }
}

/* Trendy Share & Arrival Modals */
.share-modal, .arrival-modal {
    text-align: center;
}

.share-preview {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid var(--panel-border);
}

.share-url-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.share-url-container input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    padding: 0 1rem;
    border-radius: 0.5rem;
    outline: none;
    font-size: 0.9rem;
}

.social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 1rem;
}

.social-btn {
    aspect-ratio: 1;
    border-radius: 50%;
    border: none;
    font-size: 1.5rem;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-btn:hover { transform: scale(1.1); filter: brightness(1.1); }
.social-btn.native { background: var(--accent); }
.social-btn.whatsapp { background: #25D366; }
.social-btn.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-btn.facebook { background: #1877F2; }
.social-btn.email { background: var(--text-muted); }

.arrival-icon {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    animation: pulseIcon 2s infinite;
}

.arrival-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.arrival-note {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.feature-notes {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--panel-border);
    text-align: left;
}

.feature-notes h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-notes p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

@keyframes pulseIcon {
    0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
}

.pulse-once {
    animation: pulseHighlight 1s ease-out 3; /* Pulse 3 times on arrival */
}

@keyframes pulseHighlight {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Premium Share Components */
#share-qr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    width: 200px;
    height: 200px;
    background: transparent;
    border-radius: 1rem;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px rgba(245, 158, 11, 0.1);
    border: 1px solid var(--panel-border);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#share-qr-container:hover {
    transform: scale(1.05);
}

#share-qr-container svg {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.share-modal {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 3.5rem;
}

.share-track-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
    text-align: left;
}

.input-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-field-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.input-field-group input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--panel-border) !important;
    color: #fff !important;
    padding: 0.8rem 1rem !important;
    border-radius: var(--border-radius) !important;
    font-size: 1.1rem !important;
    width: 100%;
    transition: all 0.3s;
}

.input-field-group input:focus {
    border-color: var(--accent) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
    outline: none;
}
