/**
 * Music Genre Bubbles - Modern Purple Theme
 * Version: 2.0.0
 * Aligned with Music Mood Survey design
 */

/* ============================================================================
   FULL SCREEN LAYOUT
   ============================================================================ */
.mgb-fullwidth-container {
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f0e7f7 0%, #e0e7fc 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mgb-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ============================================================================
   BUBBLE SECTION (LEFT SIDE)
   ============================================================================ */
.mgb-bubble-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 50px 60px;
    position: relative;
}

.mgb-main-title {
    font-size: 52px;
    font-weight: 700;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 40px 0;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.mgb-d3-canvas {
    flex: 1;
    position: relative;
    min-height: 500px;
}

.mgb-counter {
    position: absolute;
    bottom: 60px;
    left: 60px;
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.15);
}

/* ============================================================================
   PLAYER SECTION (RIGHT SIDE) - FIXED WIDTH
   ============================================================================ */
.mgb-player-section {
    width: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 40px 30px;
    gap: 20px;
    box-shadow: -8px 0 40px rgba(147, 51, 234, 0.1);
    border-left: 1px solid rgba(147, 51, 234, 0.1);
}

/* ============================================================================
   MUSIC PLAYER - FIXED DIMENSIONS (SAME AS VIDEO PLAYER)
   ============================================================================ */
.mgb-music-player {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: 0 8px 32px rgba(147, 51, 234, 0.12);
    border: 1px solid rgba(147, 51, 234, 0.1);
    display: flex;
    flex-direction: column;
    min-height: 320px;
    max-height: 320px;
}

.mgb-player-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mgb-player-header {
    text-align: center;
    margin-bottom: 12px;
}

.mgb-genre-name {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.mgb-genre-detail {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    min-height: 40px;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mgb-song-info {
    text-align: center;
    font-size: 14px;
    color: #374151;
    margin-bottom: 16px;
    font-weight: 500;
    min-height: 20px;
}

.mgb-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 16px;
}

.mgb-ctrl-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.mgb-ctrl-btn:hover {
    color: #9333ea;
    transform: scale(1.15);
    background: rgba(147, 51, 234, 0.1);
}

.mgb-play-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(147, 51, 234, 0.35);
    transition: all 0.2s ease;
}

.mgb-play-button:hover {
    transform: scale(1.08);
    box-shadow: 0 16px 38px rgba(147, 51, 234, 0.45);
}

.mgb-play-button:active {
    transform: scale(0.98);
}

.mgb-progress {
    margin-top: auto;
}

.mgb-progress-track {
    height: 6px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.mgb-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #9333ea 0%, #db2777 100%);
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 6px;
}

/* ============================================================================
   VIDEO PLAYER - AUTO HEIGHT (FIT CONTENT)
   ============================================================================ */
.mgb-video-player {
    background: #ffffff;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 8px 32px rgba(147, 51, 234, 0.12);
    border: 1px solid rgba(147, 51, 234, 0.1);
    /* Removed flex: 1 - now auto height */
}

.mgb-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, #faf5ff 0%, #f3f4f6 100%);
}

.mgb-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px;
}

.mgb-video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.mgb-video-placeholder svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.mgb-placeholder-text {
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
}

/* ============================================================================
   BUBBLE STYLES
   ============================================================================ */
.mgb-bubble {
    position: absolute;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    line-height: 1.2;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    word-wrap: break-word;
}

.mgb-bubble.unexplored {
    background-color: rgba(255, 255, 255, 0.3) !important;
    border: 2px dashed rgba(147, 51, 234, 0.3) !important;
    color: rgba(147, 51, 234, 0.6);
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.mgb-bubble.unexplored:hover {
    border-color: rgba(147, 51, 234, 0.6) !important;
    color: rgba(147, 51, 234, 0.9);
    transform: scale(1.08);
    background-color: rgba(255, 255, 255, 0.5) !important;
}

.mgb-bubble.explored {
    color: #1f2937;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.mgb-bubble.explored:hover {
    transform: scale(1.12);
    z-index: 100;
    box-shadow: 0 10px 24px rgba(147, 51, 234, 0.3);
}

/* ============================================================================
   ADMIN STYLES (MODERN PURPLE THEME)
   ============================================================================ */
.mgb-wrap {
    max-width: 1400px;
    margin: 20px;
}

.mgb-wrap h1 {
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 32px;
    margin-bottom: 24px;
}

.mgb-admin-panel {
    display: flex;
    gap: 24px;
    margin-top: 24px;
}

.mgb-add-box {
    width: 400px;
    background: #fff;
    padding: 28px;
    border: 1px solid rgba(147, 51, 234, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.08);
    flex-shrink: 0;
}

.mgb-add-box h3 {
    margin-top: 0;
    color: #1d2327;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid rgba(147, 51, 234, 0.1);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.mgb-add-box p {
    margin: 16px 0;
}

.mgb-add-box label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.mgb-add-box input[type="text"],
.mgb-add-box input[type="url"],
.mgb-add-box select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.mgb-add-box input[type="text"]:focus,
.mgb-add-box input[type="url"]:focus,
.mgb-add-box select:focus {
    border-color: #9333ea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.mgb-color-input {
    width: 100%;
    height: 48px !important;
    padding: 4px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mgb-color-input:hover {
    border-color: #9333ea;
}

.mgb-add-box button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.mgb-add-box button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(147, 51, 234, 0.4);
}

.mgb-add-box button[type="submit"]:active {
    transform: translateY(0);
}

.mgb-list-box {
    flex: 1;
    min-width: 500px;
    background: #fff;
    padding: 28px;
    border: 1px solid rgba(147, 51, 234, 0.1);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.08);
}

.mgb-list-box h3 {
    margin-top: 0;
    color: #1d2327;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid rgba(147, 51, 234, 0.1);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.wp-list-table {
    width: 100%;
    border-collapse: collapse;
}

.wp-list-table th {
    background: linear-gradient(135deg, #faf5ff 0%, #f9fafb 100%);
    border-bottom: 2px solid rgba(147, 51, 234, 0.1);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
}

.wp-list-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
}

.wp-list-table tr:hover {
    background: rgba(147, 51, 234, 0.03);
}

.mgb-edit-btn {
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    color: white !important;
    border: none !important;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mgb-edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.mgb-delete-genre-btn {
    background: transparent !important;
    color: #dc2626 !important;
    border: 2px solid #dc2626 !important;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
    transition: all 0.2s ease;
}

.mgb-delete-genre-btn:hover {
    background: #dc2626 !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* ============================================================================
   MODAL STYLES
   ============================================================================ */
.mgb-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.mgb-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(147, 51, 234, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mgb-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(147, 51, 234, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #faf5ff 0%, #f9fafb 100%);
}

.mgb-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mgb-close {
    color: #9ca3af;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mgb-close:hover {
    color: #9333ea;
    transform: rotate(90deg);
}

#mgb-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.mgb-modern-form input,
.mgb-modern-form textarea,
.mgb-modern-form select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.mgb-modern-form input:focus,
.mgb-modern-form textarea:focus,
.mgb-modern-form select:focus {
    border-color: #9333ea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.mgb-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(147, 51, 234, 0.1);
    background: #fff;
}

.mgb-save-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.mgb-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* ============================================================================
   VISUAL EDITOR CANVAS
   ============================================================================ */
.mgb-canvas {
    width: 1000px;
    height: 700px;
    background: linear-gradient(135deg, #faf5ff 0%, #f3f4f6 100%);
    border: 2px solid rgba(147, 51, 234, 0.2);
    position: relative;
    margin-top: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.1);
}

.mgb-editor-item {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 11px;
    font-weight: bold;
    cursor: grab;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 5px;
    box-sizing: border-box;
    word-wrap: break-word;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.mgb-editor-item:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

.mgb-editor-item:hover {
    z-index: 10;
    box-shadow: 0 6px 16px rgba(147, 51, 234, 0.3);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */
@media (max-width: 1024px) {
    .mgb-layout {
        flex-direction: column;
    }
    
    .mgb-player-section {
        width: 100%;
        padding: 30px 20px;
        flex-direction: column;
        gap: 20px;
    }
    
    .mgb-music-player {
        min-height: 280px;
        max-height: 280px;
    }
    
    .mgb-bubble-section {
        padding: 30px 20px;
    }
    
    .mgb-main-title {
        font-size: 36px;
    }
    
    .mgb-counter {
        font-size: 20px;
        bottom: 30px;
        left: 30px;
    }
    
    /* Scale down bubbles for tablet */
    .mgb-bubble {
        transform: scale(0.85);
    }
    
    .mgb-bubble:hover {
        transform: scale(0.95);
    }
    
    .mgb-bubble.explored:hover {
        transform: scale(1.0);
    }
}

@media (max-width: 768px) {
    .mgb-main-title {
        font-size: 28px;
        margin-bottom: 24px;
    }
    
    .mgb-player-section {
        flex-direction: column;
        gap: 16px;
        padding: 20px 16px;
    }
    
    .mgb-music-player {
        min-height: 280px;
        max-height: 280px;
        padding: 24px 20px;
    }
    
    .mgb-play-button {
        width: 64px;
        height: 64px;
    }
    
    .mgb-bubble-section {
        padding: 20px 16px;
        min-height: 400px;
    }
    
    .mgb-d3-canvas {
        min-height: 400px;
    }
    
    .mgb-counter {
        font-size: 18px;
        bottom: 20px;
        left: 20px;
    }
    
    /* Scale down bubbles significantly for mobile */
    .mgb-bubble {
        transform: scale(0.7);
        transform-origin: center center;
    }
    
    .mgb-bubble.unexplored:hover {
        transform: scale(0.78);
    }
    
    .mgb-bubble.explored:hover {
        transform: scale(0.85);
    }
    
    .mgb-admin-panel {
        flex-direction: column;
    }
    
    .mgb-add-box,
    .mgb-list-box {
        width: 100%;
        min-width: auto;
    }
    
    .mgb-canvas {
        width: 100%;
        max-width: 100%;
        height: 500px;
    }
    
    .mgb-modal-content {
        width: 95%;
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .mgb-main-title {
        font-size: 24px;
    }
    
    .mgb-genre-name {
        font-size: 16px;
    }
    
    .mgb-play-button {
        width: 56px;
        height: 56px;
    }
    
    .mgb-controls {
        gap: 20px;
    }
    
    .mgb-music-player {
        padding: 20px 16px;
        min-height: 260px;
        max-height: 260px;
    }
    
    .mgb-bubble-section {
        padding: 16px 12px;
        min-height: 350px;
    }
    
    .mgb-d3-canvas {
        min-height: 350px;
    }
    
    /* Further scale down for small phones */
    .mgb-bubble {
        transform: scale(0.6);
    }
    
    .mgb-bubble.unexplored:hover {
        transform: scale(0.68);
    }
    
    .mgb-bubble.explored:hover {
        transform: scale(0.75);
    }
    
    .mgb-counter {
        font-size: 16px;
        bottom: 16px;
        left: 16px;
        padding: 6px 12px;
    }
}