/**
 * Vocal Range Calculator - Complete Styles
 * Version: 1.2.0
 */

/* ================================
   CSS VARIABLES
   ================================ */

:root {
    --vrc-primary: #6366f1;
    --vrc-primary-dark: #4f46e5;
    --vrc-primary-light: #818cf8;
    --vrc-success: #10b981;
    --vrc-error: #ef4444;
    --vrc-warning: #f59e0b;
    --vrc-info: #3b82f6;
    
    --vrc-bg: #ffffff;
    --vrc-bg-alt: #f9fafb;
    --vrc-bg-dark: #1f2937;
    
    --vrc-text: #111827;
    --vrc-text-light: #6b7280;
    --vrc-text-muted: #9ca3af;
    
    --vrc-border: #e5e7eb;
    --vrc-border-dark: #d1d5db;
    
    --vrc-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --vrc-shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --vrc-shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --vrc-shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
    
    --vrc-space-xs: 0.25rem;
    --vrc-space-sm: 0.5rem;
    --vrc-space-md: 1rem;
    --vrc-space-lg: 1.5rem;
    --vrc-space-xl: 2rem;
    --vrc-space-2xl: 3rem;
    
    --vrc-radius-sm: 0.375rem;
    --vrc-radius-md: 0.5rem;
    --vrc-radius-lg: 0.75rem;
    --vrc-radius-xl: 1rem;
    --vrc-radius-full: 9999px;
    
    --vrc-transition: all 0.3s ease;
    --vrc-transition-fast: all 0.15s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --vrc-bg: #111827;
        --vrc-bg-alt: #1f2937;
        --vrc-bg-dark: #374151;
        --vrc-text: #f9fafb;
        --vrc-text-light: #d1d5db;
        --vrc-text-muted: #9ca3af;
        --vrc-border: #374151;
        --vrc-border-dark: #4b5563;
    }
}

/* ================================
   BASE STYLES
   ================================ */

.vrc-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--vrc-space-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--vrc-text);
}

.vrc-container * {
    box-sizing: border-box;
}

/* ================================
   HEADER
   ================================ */

.vrc-header {
    text-align: center;
    margin-bottom: var(--vrc-space-2xl);
}

.vrc-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 var(--vrc-space-md) 0;
    background: linear-gradient(135deg, var(--vrc-primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.vrc-header p {
    font-size: 1.125rem;
    color: var(--vrc-text-light);
    margin: 0;
}

/* ================================
   SECTIONS
   ================================ */

.vrc-section {
    background: var(--vrc-bg);
    border: 1px solid var(--vrc-border);
    border-radius: var(--vrc-radius-xl);
    padding: var(--vrc-space-xl);
    margin-bottom: var(--vrc-space-xl);
    box-shadow: var(--vrc-shadow-md);
}

/* ================================
   MICROPHONE STATUS
   ================================ */

.vrc-mic-status {
    text-align: center;
    padding: var(--vrc-space-2xl);
    background: var(--vrc-bg-alt);
    border-radius: var(--vrc-radius-lg);
    margin-bottom: var(--vrc-space-xl);
}

.vrc-mic-icon {
    font-size: 4rem;
    margin-bottom: var(--vrc-space-md);
}

.vrc-mic-status p {
    color: var(--vrc-text-light);
    font-size: 1.125rem;
    margin: 0;
}

/* ================================
   CURRENT NOTE DISPLAY
   ================================ */

.vrc-current-note {
    text-align: center;
    padding: var(--vrc-space-xl);
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    border-radius: var(--vrc-radius-lg);
    margin-bottom: var(--vrc-space-xl);
}

.vrc-note-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: var(--vrc-space-md);
    margin-bottom: var(--vrc-space-lg);
}

.vrc-note-name {
    font-size: 4rem;
    font-weight: 700;
    color: var(--vrc-primary);
    font-family: 'Courier New', monospace;
}

.vrc-note-freq {
    font-size: 1.5rem;
    color: var(--vrc-text-light);
    font-family: 'Courier New', monospace;
}

.vrc-pitch-meter {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--vrc-border);
    border-radius: var(--vrc-radius-full);
    margin: 0 auto;
}

.vrc-pitch-indicator {
    position: absolute;
    top: -6px;
    width: 20px;
    height: 20px;
    background: var(--vrc-success);
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    transition: left 0.1s ease-out, background 0.2s ease;
    left: 50%;
    transform: translateX(-50%);
}

/* ================================
   PIANO KEYBOARD
   ================================ */

.vrc-piano-container {
    overflow-x: auto;
    overflow-y: hidden;
    margin: var(--vrc-space-xl) 0;
    padding: var(--vrc-space-md) 0;
    background: var(--vrc-bg-alt);
    border-radius: var(--vrc-radius-lg);
}

.vrc-piano {
    display: flex;
    gap: 2px;
    min-width: max-content;
    padding: var(--vrc-space-md);
}

.vrc-octave {
    position: relative;
    display: flex;
    gap: 0;
}

.vrc-key {
    cursor: pointer;
    transition: var(--vrc-transition-fast);
    user-select: none;
}

.vrc-key-white {
    position: relative;
    width: 40px;
    height: 160px;
    background: #ffffff;
    border: 2px solid var(--vrc-border-dark);
    border-radius: 0 0 var(--vrc-radius-sm) var(--vrc-radius-sm);
    box-shadow: var(--vrc-shadow-sm);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: var(--vrc-space-sm);
}

.vrc-key-black {
    position: absolute;
    width: 28px;
    height: 100px;
    background: linear-gradient(180deg, #2d3748, #1a202c);
    border: 1px solid #000;
    border-radius: 0 0 var(--vrc-radius-sm) var(--vrc-radius-sm);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 2;
}

/* Position black keys */
.vrc-key-black[data-note*="C#"] { left: 26px; }
.vrc-key-black[data-note*="D#"] { left: 66px; }
.vrc-key-black[data-note*="F#"] { left: 146px; }
.vrc-key-black[data-note*="G#"] { left: 186px; }
.vrc-key-black[data-note*="A#"] { left: 226px; }

.vrc-key-label {
    font-size: 0.75rem;
    color: var(--vrc-text-muted);
    font-weight: 600;
}

/* Piano key states */
.vrc-key-white:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.vrc-key-black:hover {
    background: linear-gradient(180deg, #3d4758, #2a3040);
}

.vrc-key-active {
    background: var(--vrc-success) !important;
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--vrc-success) !important;
}

.vrc-key-lowest {
    background: #3b82f6 !important;
    border-color: #2563eb !important;
}

.vrc-key-highest {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
}

.vrc-key-range {
    background: rgba(99,102,241,0.2) !important;
}

/* ================================
   CONTROLS & BUTTONS
   ================================ */

.vrc-controls {
    display: flex;
    gap: var(--vrc-space-md);
    justify-content: center;
    flex-wrap: wrap;
    margin: var(--vrc-space-xl) 0;
}

.vrc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--vrc-space-sm);
    padding: var(--vrc-space-md) var(--vrc-space-xl);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--vrc-radius-lg);
    cursor: pointer;
    transition: var(--vrc-transition-fast);
    box-shadow: var(--vrc-shadow-sm);
    white-space: nowrap;
}

.vrc-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--vrc-shadow-md);
}

.vrc-btn:active {
    transform: translateY(0);
}

.vrc-btn-primary {
    background: var(--vrc-primary);
    color: white;
}

.vrc-btn-primary:hover {
    background: var(--vrc-primary-dark);
}

.vrc-btn-secondary {
    background: var(--vrc-bg-alt);
    color: var(--vrc-text);
    border: 1px solid var(--vrc-border);
}

.vrc-btn-secondary:hover {
    background: var(--vrc-bg);
    border-color: var(--vrc-primary);
}

.vrc-btn-success {
    background: var(--vrc-success);
    color: white;
}

.vrc-btn-success:hover {
    background: #059669;
}

.vrc-btn-danger {
    background: var(--vrc-error);
    color: white;
}

.vrc-btn-danger:hover {
    background: #dc2626;
}

/* ================================
   RECORDED RANGE DISPLAY
   ================================ */

.vrc-recorded-range {
    background: var(--vrc-bg-alt);
    border-radius: var(--vrc-radius-lg);
    padding: var(--vrc-space-xl);
    margin-top: var(--vrc-space-xl);
}

.vrc-range-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--vrc-space-md);
    margin-bottom: var(--vrc-space-lg);
}

.vrc-range-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--vrc-space-md);
    background: var(--vrc-bg);
    border-radius: var(--vrc-radius-md);
}

.vrc-range-label {
    font-weight: 600;
    color: var(--vrc-text);
}

.vrc-range-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--vrc-primary);
}

/* ================================
   RESULTS SECTION
   ================================ */

.vrc-result-card {
    background: var(--vrc-bg-alt);
    border-radius: var(--vrc-radius-lg);
    padding: var(--vrc-space-xl);
    margin-bottom: var(--vrc-space-lg);
}

.vrc-result-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--vrc-space-lg) 0;
    color: var(--vrc-text);
}

/* Voice Type Display */
.vrc-voice-type-card {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
    border: 2px solid var(--vrc-primary-light);
}

.vrc-voice-type-display {
    text-align: center;
}

.vrc-voice-type-name {
    font-size: 3rem;
    font-weight: 700;
    color: var(--vrc-primary);
    margin-bottom: var(--vrc-space-md);
}

.vrc-voice-type-range {
    font-size: 1.25rem;
    color: var(--vrc-text-light);
}

/* Stats Grid */
.vrc-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--vrc-space-md);
}

.vrc-stat-item {
    text-align: center;
    padding: var(--vrc-space-lg);
    background: var(--vrc-bg);
    border-radius: var(--vrc-radius-md);
    border: 2px solid var(--vrc-border);
}

.vrc-stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--vrc-text-light);
    margin-bottom: var(--vrc-space-sm);
    font-weight: 600;
}

.vrc-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--vrc-primary);
    font-family: 'Courier New', monospace;
}

/* Singer Matches */
.vrc-singer-matches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--vrc-space-md);
}

.vrc-singer-card {
    background: var(--vrc-bg);
    border: 2px solid var(--vrc-border);
    border-radius: var(--vrc-radius-md);
    padding: var(--vrc-space-lg);
    transition: var(--vrc-transition-fast);
    position: relative;
}

.vrc-singer-card:hover {
    border-color: var(--vrc-primary);
    transform: translateY(-2px);
    box-shadow: var(--vrc-shadow-md);
}

.vrc-singer-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--vrc-text);
    margin-bottom: var(--vrc-space-sm);
}

.vrc-singer-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--vrc-space-sm);
    font-size: 0.875rem;
}

.vrc-singer-badge {
    position: absolute;
    top: var(--vrc-space-sm);
    right: var(--vrc-space-sm);
    background: var(--vrc-success);
    color: white;
    padding: var(--vrc-space-xs) var(--vrc-space-sm);
    border-radius: var(--vrc-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Result Actions */
.vrc-result-actions {
    display: flex;
    gap: var(--vrc-space-md);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--vrc-space-xl);
}

/* ================================
   TOAST NOTIFICATIONS
   ================================ */

.vrc-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--vrc-space-md);
    max-width: 400px;
}

.vrc-toast {
    display: flex;
    align-items: center;
    gap: var(--vrc-space-md);
    padding: var(--vrc-space-lg);
    background: white;
    border-radius: var(--vrc-radius-lg);
    box-shadow: var(--vrc-shadow-xl);
    border-left: 4px solid;
    animation: slideInRight 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.vrc-toast-success {
    border-color: var(--vrc-success);
}

.vrc-toast-error {
    border-color: var(--vrc-error);
}

.vrc-toast-info {
    border-color: var(--vrc-info);
}

.vrc-toast-warning {
    border-color: var(--vrc-warning);
}

/* ================================
   SHARE MODAL
   ================================ */

.vrc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--vrc-space-lg);
}

.vrc-modal-content {
    background: var(--vrc-bg);
    border-radius: var(--vrc-radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--vrc-space-2xl);
    position: relative;
    box-shadow: var(--vrc-shadow-xl);
}

.vrc-modal-close {
    position: absolute;
    top: var(--vrc-space-lg);
    right: var(--vrc-space-lg);
    width: 40px;
    height: 40px;
    border: none;
    background: var(--vrc-bg-alt);
    color: var(--vrc-text);
    font-size: 1.5rem;
    border-radius: var(--vrc-radius-full);
    cursor: pointer;
    transition: var(--vrc-transition-fast);
    line-height: 1;
}

.vrc-modal-close:hover {
    background: var(--vrc-error);
    color: white;
}

.vrc-modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--vrc-space-xl) 0;
}

.vrc-share-text {
    margin: var(--vrc-space-lg) 0;
    padding: var(--vrc-space-lg);
    background: var(--vrc-bg-alt);
    border-radius: var(--vrc-radius-md);
}

.vrc-share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--vrc-space-md);
}

.vrc-share-btn {
    padding: var(--vrc-space-md);
    border: 2px solid var(--vrc-border);
    background: var(--vrc-bg-alt);
    border-radius: var(--vrc-radius-md);
    cursor: pointer;
    transition: var(--vrc-transition-fast);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--vrc-space-sm);
}

.vrc-share-btn:hover {
    border-color: var(--vrc-primary);
    transform: translateY(-2px);
    box-shadow: var(--vrc-shadow-md);
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 768px) {
    .vrc-container {
        padding: var(--vrc-space-md);
    }
    
    .vrc-header h2 {
        font-size: 2rem;
    }
    
    .vrc-section {
        padding: var(--vrc-space-lg);
    }
    
    .vrc-note-name {
        font-size: 3rem;
    }
    
    .vrc-note-freq {
        font-size: 1.25rem;
    }
    
    .vrc-key-white {
        width: 30px;
        height: 120px;
    }
    
    .vrc-key-black {
        width: 20px;
        height: 75px;
    }
    
    .vrc-controls {
        flex-direction: column;
    }
    
    .vrc-btn {
        width: 100%;
    }
    
    .vrc-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .vrc-singer-matches {
        grid-template-columns: 1fr;
    }
    
    .vrc-toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .vrc-modal-content {
        padding: var(--vrc-space-lg);
    }
    
    .vrc-share-buttons {
        grid-template-columns: 1fr;
    }
    
    .vrc-voice-type-name {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .vrc-header h2 {
        font-size: 1.5rem;
    }
    
    .vrc-header p {
        font-size: 1rem;
    }
    
    .vrc-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .vrc-range-display {
        grid-template-columns: 1fr;
    }
}

/* ================================
   ACCESSIBILITY
   ================================ */

*:focus-visible {
    outline: 2px solid var(--vrc-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .vrc-controls,
    .vrc-btn,
    .vrc-toast-container,
    .vrc-modal {
        display: none !important;
    }
}

/* ================================
   UTILITY CLASSES
   ================================ */

.vrc-hidden {
    display: none !important;
}

.vrc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
